summaryrefslogtreecommitdiffstats
path: root/nms-patches/BlockCocoa.patch
blob: 470a26f63f1f89c5f18bd67b59a56e23f7aa0c45 (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
--- a/net/minecraft/server/BlockCocoa.java
+++ b/net/minecraft/server/BlockCocoa.java
@@ -2,6 +2,8 @@
 
 import java.util.Random;
 
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
 public class BlockCocoa extends BlockFacingHorizontal implements IBlockFragilePlantElement {
 
     public static final BlockStateInteger AGE = BlockStateInteger.of("age", 0, 2);
@@ -23,7 +25,10 @@
             int i = ((Integer) iblockdata.get(BlockCocoa.AGE)).intValue();
 
             if (i < 2) {
-                world.setTypeAndData(blockposition, iblockdata.set(BlockCocoa.AGE, Integer.valueOf(i + 1)), 2);
+                // CraftBukkit start
+                IBlockData data = iblockdata.set(AGE, Integer.valueOf(i + 1));
+                CraftEventFactory.handleBlockGrowEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this, toLegacyData(data));
+                // CraftBukkit end
             }
         }
 
@@ -124,7 +129,10 @@
     }
 
     public void b(World world, Random random, BlockPosition blockposition, IBlockData iblockdata) {
-        world.setTypeAndData(blockposition, iblockdata.set(BlockCocoa.AGE, Integer.valueOf(((Integer) iblockdata.get(BlockCocoa.AGE)).intValue() + 1)), 2);
+        // CraftBukkit start
+        IBlockData data = iblockdata.set(AGE, Integer.valueOf(((Integer) iblockdata.get(AGE)).intValue() + 1));
+        CraftEventFactory.handleBlockGrowEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this, toLegacyData(data));
+        // CraftBukkit end
     }
 
     public IBlockData fromLegacyData(int i) {