Paper/nms-patches/BlockPumpkinCarved.patch

66 Zeilen
3.2 KiB
Diff

2018-07-15 02:00:00 +02:00
--- a/net/minecraft/server/BlockPumpkinCarved.java
+++ b/net/minecraft/server/BlockPumpkinCarved.java
@@ -3,6 +3,12 @@
import java.util.Iterator;
import java.util.function.Predicate;
+// 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;
@@ -38,18 +44,24 @@
int j;
int k;
+ BlockStateListPopulator blockList = new BlockStateListPopulator(world); // CraftBukkit - Use BlockStateListPopulator
if (shapedetector_shapedetectorcollection != null) {
2018-07-22 04:00:00 +02:00
for (i = 0; i < this.e().b(); ++i) {
2018-07-15 02:00:00 +02:00
ShapeDetectorBlock shapedetectorblock1 = shapedetector_shapedetectorcollection.a(0, i, 0);
- world.setTypeAndData(shapedetectorblock1.getPosition(), Blocks.AIR.getBlockData(), 2);
+ blockList.setTypeAndData(shapedetectorblock1.getPosition(), Blocks.AIR.getBlockData(), 2); // CraftBukkit
}
EntitySnowman entitysnowman = new EntitySnowman(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;
+ }
+ blockList.updateList();
+ // CraftBukkit end
iterator = world.a(EntityPlayer.class, entitysnowman.getBoundingBox().g(5.0D)).iterator();
while (iterator.hasNext()) {
@@ -70,7 +82,7 @@
if (shapedetector_shapedetectorcollection != null) {
2018-07-22 04:00:00 +02:00
for (i = 0; i < this.g().c(); ++i) {
for (int l = 0; l < this.g().b(); ++l) {
2018-07-15 02:00:00 +02:00
- world.setTypeAndData(shapedetector_shapedetectorcollection.a(i, l, 0).getPosition(), Blocks.AIR.getBlockData(), 2);
+ blockList.setTypeAndData(shapedetector_shapedetectorcollection.a(i, l, 0).getPosition(), Blocks.AIR.getBlockData(), 2); // CraftBukkit
}
}
@@ -79,7 +91,12 @@
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;
+ }
+ blockList.updateList();
+ // CraftBukkit end
iterator = world.a(EntityPlayer.class, entityirongolem.getBoundingBox().g(5.0D)).iterator();
while (iterator.hasNext()) {