summaryrefslogtreecommitdiffstats
path: root/nms-patches/BlockPumpkinCarved.patch
blob: 336d8eb7f95821e6c21053644ad33e9022c74089 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
--- 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) {
             for (i = 0; i < this.e().b(); ++i) {
                 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) {
                 for (i = 0; i < this.g().c(); ++i) {
                     for (int l = 0; l < this.g().b(); ++l) {
-                        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()) {