PaperMC/nms-patches/BlockCrops.patch

36 lines
1.3 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/BlockCrops.java
+++ b/net/minecraft/server/BlockCrops.java
@@ -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);
2016-02-29 22:32:46 +01:00
@@ -53,7 +55,10 @@
float f = a((Block) this, world, blockposition);
if (random.nextInt((int) (25.0F / f) + 1) == 0) {
2016-02-29 22:32:46 +01:00
- world.setTypeAndData(blockposition, this.setAge(i + 1), 2);
+ // CraftBukkit start
2016-02-29 22:32:46 +01:00
+ IBlockData data = this.setAge(i + 1);
2015-02-26 23:41:06 +01:00
+ CraftEventFactory.handleBlockGrowEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this, toLegacyData(data));
+ // CraftBukkit end
}
}
}
2016-02-29 22:32:46 +01:00
@@ -68,7 +73,10 @@
i = j;
}
2016-02-29 22:32:46 +01:00
- world.setTypeAndData(blockposition, this.setAge(i), 2);
+ // CraftBukkit start
2016-02-29 22:32:46 +01:00
+ IBlockData data = this.setAge(i);
2015-02-26 23:41:06 +01:00
+ CraftEventFactory.handleBlockGrowEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this, toLegacyData(data));
+ // CraftBukkit end
}
2016-02-29 22:32:46 +01:00
protected int b(World world) {