diff options
author | feildmaster <admin@feildmaster.com> | 2012-03-10 23:01:39 -0600 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2012-03-11 01:30:16 -0500 |
commit | 4545336fdfa50258ceb70797121ea51f811da3e6 (patch) | |
tree | 994fbde5065ee94a54ac37f12396b3f39932b463 /src/main/java/net/minecraft/server/BlockPumpkin.java | |
parent | 433efec68fabbc14e913886e4c6eb899cb594326 (diff) | |
download | craftbukkit-4545336fdfa50258ceb70797121ea51f811da3e6.tar craftbukkit-4545336fdfa50258ceb70797121ea51f811da3e6.tar.gz craftbukkit-4545336fdfa50258ceb70797121ea51f811da3e6.tar.lz craftbukkit-4545336fdfa50258ceb70797121ea51f811da3e6.tar.xz craftbukkit-4545336fdfa50258ceb70797121ea51f811da3e6.zip |
Only remove blocks when golem is successfully spawned. Fixes BUKKIT-1094
Diffstat (limited to 'src/main/java/net/minecraft/server/BlockPumpkin.java')
-rw-r--r-- | src/main/java/net/minecraft/server/BlockPumpkin.java | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/src/main/java/net/minecraft/server/BlockPumpkin.java b/src/main/java/net/minecraft/server/BlockPumpkin.java index 6c34d3da..cb7824e5 100644 --- a/src/main/java/net/minecraft/server/BlockPumpkin.java +++ b/src/main/java/net/minecraft/server/BlockPumpkin.java @@ -1,6 +1,7 @@ package net.minecraft.server; // CraftBukkit start +import org.bukkit.craftbukkit.util.BlockStateListPopulator; import org.bukkit.event.block.BlockRedstoneEvent; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; // CraftBukkit end @@ -41,16 +42,20 @@ public class BlockPumpkin extends BlockDirectional { if (world.suppressPhysics) return; // CraftBukkit if (world.getTypeId(i, j - 1, k) == Block.SNOW_BLOCK.id && world.getTypeId(i, j - 2, k) == Block.SNOW_BLOCK.id) { if (!world.isStatic && world.getServer().getServer().spawnAnimals) { // CraftBukkit - make snowmen obey spawning rules - world.setRawTypeId(i, j, k, 0); - world.setRawTypeId(i, j - 1, k, 0); - world.setRawTypeId(i, j - 2, k, 0); + // CraftBukkit start - Use BlockStateListPopulator + BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld()); + + blockList.setTypeId(i, j, k, 0); + blockList.setTypeId(i, j - 1, k, 0); + blockList.setTypeId(i, j - 2, k, 0); + EntitySnowman entitysnowman = new EntitySnowman(world); entitysnowman.setPositionRotation((double) i + 0.5D, (double) j - 1.95D, (double) k + 0.5D, 0.0F, 0.0F); - world.addEntity(entitysnowman, SpawnReason.BUILD_SNOWMAN); // CraftBukkit - world.update(i, j, k, 0); - world.update(i, j - 1, k, 0); - world.update(i, j - 2, k, 0); + if (world.addEntity(entitysnowman, SpawnReason.BUILD_SNOWMAN)) { + blockList.updateList(); + } + // CraftBukkit end } for (int l = 0; l < 120; ++l) { @@ -61,37 +66,32 @@ public class BlockPumpkin extends BlockDirectional { boolean flag1 = world.getTypeId(i, j - 1, k - 1) == Block.IRON_BLOCK.id && world.getTypeId(i, j - 1, k + 1) == Block.IRON_BLOCK.id; if (flag || flag1) { - world.setRawTypeId(i, j, k, 0); - world.setRawTypeId(i, j - 1, k, 0); - world.setRawTypeId(i, j - 2, k, 0); + // CraftBukkit start - Use BlockStateListPopulator + BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld()); + + blockList.setTypeId(i, j, k, 0); + blockList.setTypeId(i, j - 1, k, 0); + blockList.setTypeId(i, j - 2, k, 0); if (flag) { - world.setRawTypeId(i - 1, j - 1, k, 0); - world.setRawTypeId(i + 1, j - 1, k, 0); + blockList.setTypeId(i - 1, j - 1, k, 0); + blockList.setTypeId(i + 1, j - 1, k, 0); } else { - world.setRawTypeId(i, j - 1, k - 1, 0); - world.setRawTypeId(i, j - 1, k + 1, 0); + blockList.setTypeId(i, j - 1, k - 1, 0); + blockList.setTypeId(i, j - 1, k + 1, 0); } EntityIronGolem entityirongolem = new EntityIronGolem(world); entityirongolem.b(true); entityirongolem.setPositionRotation((double) i + 0.5D, (double) j - 1.95D, (double) k + 0.5D, 0.0F, 0.0F); - world.addEntity(entityirongolem, SpawnReason.BUILD_IRONGOLEM); + if (world.addEntity(entityirongolem, SpawnReason.BUILD_IRONGOLEM)) { + for (int i1 = 0; i1 < 120; ++i1) { + world.a("snowballpoof", (double) i + world.random.nextDouble(), (double) (j - 2) + world.random.nextDouble() * 3.9D, (double) k + world.random.nextDouble(), 0.0D, 0.0D, 0.0D); + } - for (int i1 = 0; i1 < 120; ++i1) { - world.a("snowballpoof", (double) i + world.random.nextDouble(), (double) (j - 2) + world.random.nextDouble() * 3.9D, (double) k + world.random.nextDouble(), 0.0D, 0.0D, 0.0D); - } - - world.update(i, j, k, 0); - world.update(i, j - 1, k, 0); - world.update(i, j - 2, k, 0); - if (flag) { - world.update(i - 1, j - 1, k, 0); - world.update(i + 1, j - 1, k, 0); - } else { - world.update(i, j - 1, k - 1, 0); - world.update(i, j - 1, k + 1, 0); + blockList.updateList(); } + // CraftBukkit end } } } |