--- a/net/minecraft/world/level/block/BlockPumpkinCarved.java +++ b/net/minecraft/world/level/block/BlockPumpkinCarved.java @@ -26,6 +26,11 @@ import net.minecraft.world.level.block.state.properties.BlockStateDirection; import net.minecraft.world.level.material.Material; +// CraftBukkit start +import org.bukkit.craftbukkit.util.BlockStateListPopulator; +import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; +// CraftBukkit end + public class BlockPumpkinCarved extends BlockFacingHorizontal implements ItemWearable { public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING; @@ -64,19 +69,28 @@ EntityPlayer entityplayer; int j; + BlockStateListPopulator blockList = new BlockStateListPopulator(world); // CraftBukkit - Use BlockStateListPopulator if (shapedetector_shapedetectorcollection != null) { for (i = 0; i < this.getSnowmanShape().b(); ++i) { ShapeDetectorBlock shapedetectorblock = shapedetector_shapedetectorcollection.a(0, i, 0); - world.setTypeAndData(shapedetectorblock.getPosition(), Blocks.AIR.getBlockData(), 2); - world.triggerEffect(2001, shapedetectorblock.getPosition(), Block.getCombinedId(shapedetectorblock.a())); + blockList.setTypeAndData(shapedetectorblock.getPosition(), Blocks.AIR.getBlockData(), 2); // CraftBukkit + // world.triggerEffect(2001, shapedetectorblock.getPosition(), Block.getCombinedId(shapedetectorblock.a())); // CraftBukkit } EntitySnowman entitysnowman = (EntitySnowman) EntityTypes.SNOW_GOLEM.a(world); BlockPosition blockposition1 = shapedetector_shapedetectorcollection.a(0, 2, 0).getPosition(); entitysnowman.setPositionRotation((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.05D, (double) blockposition1.getZ() + 0.5D, 0.0F, 0.0F); - world.addEntity(entitysnowman); + // CraftBukkit start + if (!world.addEntity(entitysnowman, SpawnReason.BUILD_SNOWMAN)) { + return; + } + for (BlockPosition pos : blockList.getBlocks()) { + world.triggerEffect(2001, pos, Block.getCombinedId(world.getType(pos))); + } + blockList.updateList(); + // CraftBukkit end iterator = world.a(EntityPlayer.class, entitysnowman.getBoundingBox().g(5.0D)).iterator(); while (iterator.hasNext()) { @@ -96,8 +110,8 @@ for (int k = 0; k < this.getIronGolemShape().b(); ++k) { ShapeDetectorBlock shapedetectorblock2 = shapedetector_shapedetectorcollection.a(i, k, 0); - world.setTypeAndData(shapedetectorblock2.getPosition(), Blocks.AIR.getBlockData(), 2); - world.triggerEffect(2001, shapedetectorblock2.getPosition(), Block.getCombinedId(shapedetectorblock2.a())); + blockList.setTypeAndData(shapedetectorblock2.getPosition(), Blocks.AIR.getBlockData(), 2); // CraftBukkit + // world.triggerEffect(2001, shapedetectorblock2.getPosition(), Block.getCombinedId(shapedetectorblock2.a())); // CraftBukkit } } @@ -106,7 +120,15 @@ entityirongolem.setPlayerCreated(true); entityirongolem.setPositionRotation((double) blockposition2.getX() + 0.5D, (double) blockposition2.getY() + 0.05D, (double) blockposition2.getZ() + 0.5D, 0.0F, 0.0F); - world.addEntity(entityirongolem); + // CraftBukkit start + if (!world.addEntity(entityirongolem, SpawnReason.BUILD_IRONGOLEM)) { + return; + } + for (BlockPosition pos : blockList.getBlocks()) { + world.triggerEffect(2001, pos, Block.getCombinedId(world.getType(pos))); + } + blockList.updateList(); + // CraftBukkit end iterator = world.a(EntityPlayer.class, entityirongolem.getBoundingBox().g(5.0D)).iterator(); while (iterator.hasNext()) {