Paper/nms-patches/BlockPumpkin.patch

82 lines
3.9 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/BlockPumpkin.java
+++ b/net/minecraft/server/BlockPumpkin.java
2017-05-14 04:00:00 +02:00
@@ -4,6 +4,12 @@
import java.util.Iterator;
2016-05-10 13:47:39 +02:00
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
+
2016-02-29 22:32:46 +01:00
public class BlockPumpkin extends BlockFacingHorizontal {
private ShapeDetector snowGolemPart;
2017-05-14 04:00:00 +02:00
@@ -43,18 +49,25 @@
EntityPlayer entityplayer;
int j;
2016-06-09 03:43:49 +02:00
+ BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld()); // CraftBukkit - Use BlockStateListPopulator
if (shapedetector_shapedetectorcollection != null) {
for (i = 0; i < this.getDetectorSnowGolem().b(); ++i) {
2015-02-26 23:41:06 +01:00
ShapeDetectorBlock shapedetectorblock = shapedetector_shapedetectorcollection.a(0, i, 0);
2015-07-30 08:56:52 +02:00
- world.setTypeAndData(shapedetectorblock.getPosition(), Blocks.AIR.getBlockData(), 2);
+ // CraftBukkit start
+ // world.setTypeAndData(shapedetectorblock.d(), Blocks.AIR.getBlockData(), 2);
2015-07-30 08:56:52 +02:00
+ BlockPosition pos = shapedetectorblock.getPosition();
+ blockList.setTypeId(pos.getX(), pos.getY(), pos.getZ(), 0);
+ // CraftBukkit end
}
EntitySnowman entitysnowman = new EntitySnowman(world);
2015-07-30 08:56:52 +02:00
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)) {
+ blockList.updateList();
2017-05-14 04:00:00 +02:00
iterator = world.a(EntityPlayer.class, entitysnowman.getBoundingBox().g(5.0D)).iterator();
2017-05-14 04:00:00 +02:00
while (iterator.hasNext()) {
@@ -71,12 +84,17 @@
2016-11-17 02:41:03 +01:00
world.update(shapedetectorblock1.getPosition(), Blocks.AIR, false);
}
2015-02-26 23:41:06 +01:00
+ } // CraftBukkit end
2016-06-09 03:43:49 +02:00
} else {
shapedetector_shapedetectorcollection = this.getDetectorIronGolem().a(world, blockposition);
if (shapedetector_shapedetectorcollection != null) {
for (i = 0; i < this.getDetectorIronGolem().c(); ++i) {
for (int k = 0; k < this.getDetectorIronGolem().b(); ++k) {
- world.setTypeAndData(shapedetector_shapedetectorcollection.a(i, k, 0).getPosition(), Blocks.AIR.getBlockData(), 2);
+ // CraftBukkit start
+ // world.setTypeAndData(shapedetector_shapedetectorcollection.a(i, k, 0).getPosition(), Blocks.AIR.getBlockData(), 2);
+ BlockPosition pos = shapedetector_shapedetectorcollection.a(i, k, 0).getPosition();
+ blockList.setTypeId(pos.getX(), pos.getY(), pos.getZ(), 0);
+ // CraftBukkit end
}
}
2017-05-14 04:00:00 +02:00
@@ -85,7 +103,9 @@
2016-06-09 03:43:49 +02:00
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
2015-02-26 23:41:06 +01:00
+ if (world.addEntity(entityirongolem, SpawnReason.BUILD_IRONGOLEM)) {
+ blockList.updateList();
2017-05-14 04:00:00 +02:00
iterator = world.a(EntityPlayer.class, entityirongolem.getBoundingBox().g(5.0D)).iterator();
2017-05-14 04:00:00 +02:00
while (iterator.hasNext()) {
@@ -105,6 +125,7 @@
2016-06-09 03:43:49 +02:00
}
}
}
2015-02-26 23:41:06 +01:00
+ } // CraftBukkit end
}
}