mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 07:48:53 +01:00
75 lines
4.1 KiB
Diff
75 lines
4.1 KiB
Diff
--- a/net/minecraft/server/BlockPumpkinCarved.java
|
|
+++ b/net/minecraft/server/BlockPumpkinCarved.java
|
|
@@ -4,6 +4,12 @@
|
|
import java.util.function.Predicate;
|
|
import javax.annotation.Nullable;
|
|
|
|
+// CraftBukkit start
|
|
+import org.bukkit.craftbukkit.util.BlockStateListPopulator;
|
|
+import org.bukkit.event.block.BlockRedstoneEvent;
|
|
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
|
+// CraftBukkit end
|
|
+
|
|
public class BlockPumpkinCarved extends BlockFacingHorizontal {
|
|
|
|
public static final BlockStateDirection a = BlockFacingHorizontal.FACING;
|
|
@@ -42,19 +48,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()) {
|
|
@@ -74,8 +89,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
|
|
}
|
|
}
|
|
|
|
@@ -84,7 +99,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()) {
|