PaperMC/nms-patches/BlockPumpkin.patch

81 lines
4.3 KiB
Diff
Raw Normal View History

2015-02-26 23:41:06 +01:00
--- /home/matt/mc-dev-private//net/minecraft/server/BlockPumpkin.java 2015-02-26 22:40:22.223608143 +0000
+++ src/main/java/net/minecraft/server/BlockPumpkin.java 2015-02-26 22:40:22.223608143 +0000
@@ -2,6 +2,12 @@
import com.google.common.base.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 BlockPumpkin extends BlockDirectional {
private ShapeDetector snowGolemPart;
2015-02-26 23:41:06 +01:00
@@ -40,17 +46,24 @@
int j;
2015-02-26 23:41:06 +01:00
if ((shapedetector_shapedetectorcollection = this.getDetectorSnowGolem().a(world, blockposition)) != null) {
+ BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld()); // CraftBukkit - Use BlockStateListPopulator
for (i = 0; i < this.getDetectorSnowGolem().b(); ++i) {
2015-02-26 23:41:06 +01:00
ShapeDetectorBlock shapedetectorblock = shapedetector_shapedetectorcollection.a(0, i, 0);
- world.setTypeAndData(shapedetectorblock.d(), Blocks.AIR.getBlockData(), 2);
+ // CraftBukkit start
+ // world.setTypeAndData(shapedetectorblock.d(), Blocks.AIR.getBlockData(), 2);
+ BlockPosition pos = shapedetectorblock.d();
+ blockList.setTypeId(pos.getX(), pos.getY(), pos.getZ(), 0);
+ // CraftBukkit end
}
EntitySnowman entitysnowman = new EntitySnowman(world);
2015-02-26 23:41:06 +01:00
BlockPosition blockposition1 = shapedetector_shapedetectorcollection.a(0, 2, 0).d();
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();
2015-02-26 23:41:06 +01:00
for (j = 0; j < 120; ++j) {
world.addParticle(EnumParticle.SNOW_SHOVEL, (double) blockposition1.getX() + world.random.nextDouble(), (double) blockposition1.getY() + world.random.nextDouble() * 2.5D, (double) blockposition1.getZ() + world.random.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]);
@@ -61,10 +74,16 @@
2015-02-26 23:41:06 +01:00
world.update(shapedetectorblock1.d(), Blocks.AIR);
}
2015-02-26 23:41:06 +01:00
+ } // CraftBukkit end
} else if ((shapedetector_shapedetectorcollection = this.getDetectorIronGolem().a(world, blockposition)) != null) {
+ BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld()); // CraftBukkit - Use BlockStateListPopulator
for (i = 0; i < this.getDetectorIronGolem().c(); ++i) {
for (int k = 0; k < this.getDetectorIronGolem().b(); ++k) {
2015-02-26 23:41:06 +01:00
- world.setTypeAndData(shapedetector_shapedetectorcollection.a(i, k, 0).d(), Blocks.AIR.getBlockData(), 2);
+ // CraftBukkit start
+ // world.setTypeAndData(shapedetectorcollection.a(i, k, 0).d(), Blocks.AIR.getBlockData(), 2);
2015-02-26 23:41:06 +01:00
+ BlockPosition pos = shapedetector_shapedetectorcollection.a(i, k, 0).d();
+ blockList.setTypeId(pos.getX(), pos.getY(), pos.getZ(), 0);
+ // CraftBukkit end
}
}
2015-02-26 23:41:06 +01:00
@@ -73,7 +92,10 @@
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);
2015-02-26 23:41:06 +01:00
+
+ // CraftBukkit start
2015-02-26 23:41:06 +01:00
+ if (world.addEntity(entityirongolem, SpawnReason.BUILD_IRONGOLEM)) {
+ blockList.updateList();
2015-02-26 23:41:06 +01:00
for (j = 0; j < 120; ++j) {
world.addParticle(EnumParticle.SNOWBALL, (double) blockposition2.getX() + world.random.nextDouble(), (double) blockposition2.getY() + world.random.nextDouble() * 3.9D, (double) blockposition2.getZ() + world.random.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]);
@@ -86,6 +108,7 @@
world.update(shapedetectorblock2.d(), Blocks.AIR);
}
}
2015-02-26 23:41:06 +01:00
+ } // CraftBukkit end
}
}