2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/BlockStem.java
|
|
|
|
+++ b/net/minecraft/server/BlockStem.java
|
2018-07-15 02:00:00 +02:00
|
|
|
@@ -3,6 +3,8 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
import java.util.Random;
|
2016-05-10 13:47:39 +02:00
|
|
|
import javax.annotation.Nullable;
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
|
|
|
+
|
|
|
|
public class BlockStem extends BlockPlant implements IBlockFragilePlantElement {
|
|
|
|
|
2018-08-26 04:00:00 +02:00
|
|
|
public static final BlockStateInteger AGE = BlockProperties.W;
|
2018-09-25 06:34:05 +02:00
|
|
|
@@ -33,14 +35,18 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
if (i < 7) {
|
2018-07-15 02:00:00 +02:00
|
|
|
iblockdata = (IBlockData) iblockdata.set(BlockStem.AGE, Integer.valueOf(i + 1));
|
2014-11-25 22:32:16 +01:00
|
|
|
- world.setTypeAndData(blockposition, iblockdata, 2);
|
2018-07-15 02:00:00 +02:00
|
|
|
+ CraftEventFactory.handleBlockGrowEvent(world, blockposition, iblockdata, 2); // CraftBukkit
|
2014-11-25 22:32:16 +01:00
|
|
|
} else {
|
2018-07-15 02:00:00 +02:00
|
|
|
EnumDirection enumdirection = EnumDirection.EnumDirectionLimit.HORIZONTAL.a(random);
|
|
|
|
BlockPosition blockposition1 = blockposition.shift(enumdirection);
|
|
|
|
Block block = world.getType(blockposition1.down()).getBlock();
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2018-07-15 02:00:00 +02:00
|
|
|
if (world.getType(blockposition1).isAir() && (block == Blocks.FARMLAND || block == Blocks.DIRT || block == Blocks.COARSE_DIRT || block == Blocks.PODZOL || block == Blocks.GRASS_BLOCK)) {
|
|
|
|
- world.setTypeUpdate(blockposition1, this.blockFruit.getBlockData());
|
2018-09-25 06:34:05 +02:00
|
|
|
+ // CraftBukkit start
|
|
|
|
+ if (!CraftEventFactory.handleBlockGrowEvent(world, blockposition1, this.blockFruit.getBlockData())) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2018-07-22 04:00:00 +02:00
|
|
|
world.setTypeUpdate(blockposition, (IBlockData) this.blockFruit.e().getBlockData().set(BlockFacingHorizontal.FACING, enumdirection));
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
}
|
2018-09-25 06:34:05 +02:00
|
|
|
@@ -94,7 +100,7 @@
|
2018-07-15 02:00:00 +02:00
|
|
|
int i = Math.min(7, ((Integer) iblockdata.get(BlockStem.AGE)).intValue() + MathHelper.nextInt(world.random, 2, 5));
|
|
|
|
IBlockData iblockdata1 = (IBlockData) iblockdata.set(BlockStem.AGE, Integer.valueOf(i));
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2018-07-15 02:00:00 +02:00
|
|
|
- world.setTypeAndData(blockposition, iblockdata1, 2);
|
|
|
|
+ CraftEventFactory.handleBlockGrowEvent(world, blockposition, iblockdata1, 2); // CraftBukkit
|
|
|
|
if (i == 7) {
|
|
|
|
iblockdata1.a(world, blockposition, world.random);
|
|
|
|
}
|