summaryrefslogtreecommitdiffstats
path: root/nms-patches/BlockCrops.patch
blob: aeb94240de3738f7f30418836b113d98d2d7a7ab (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
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockCrops.java	2014-11-28 17:43:42.885707440 +0000
+++ src/main/java/net/minecraft/server/BlockCrops.java	2014-11-28 17:38:17.000000000 +0000
@@ -2,6 +2,8 @@
 
 import java.util.Random;
 
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
 public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement {
 
     public static final BlockStateInteger AGE = BlockStateInteger.of("age", 0, 7);
@@ -31,7 +33,10 @@
                 float f = a((Block) this, world, blockposition);
 
                 if (random.nextInt((int) (25.0F / f) + 1) == 0) {
-                    world.setTypeAndData(blockposition, iblockdata.set(BlockCrops.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
                 }
             }
         }
@@ -45,7 +50,10 @@
             i = 7;
         }
 
-        world.setTypeAndData(blockposition, iblockdata.set(BlockCrops.AGE, Integer.valueOf(i)), 2);
+        // CraftBukkit start
+        IBlockData data = iblockdata.set(AGE, Integer.valueOf(i));
+        CraftEventFactory.handleBlockGrowEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this, toLegacyData(data)); 
+        // CraftBukkit end
     }
 
     protected static float a(Block block, World world, BlockPosition blockposition) {