--- a/net/minecraft/world/level/block/BlockStem.java +++ b/net/minecraft/world/level/block/BlockStem.java @@ -21,6 +21,8 @@ import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShapeCollision; +import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit + public class BlockStem extends BlockPlant implements IBlockFragilePlantElement { public static final int MAX_AGE = 7; @@ -57,14 +59,18 @@ if (i < 7) { iblockdata = (IBlockData) iblockdata.setValue(BlockStem.AGE, i + 1); - worldserver.setBlock(blockposition, iblockdata, 2); + CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, iblockdata, 2); // CraftBukkit } else { EnumDirection enumdirection = EnumDirection.EnumDirectionLimit.HORIZONTAL.getRandomDirection(randomsource); BlockPosition blockposition1 = blockposition.relative(enumdirection); IBlockData iblockdata1 = worldserver.getBlockState(blockposition1.below()); if (worldserver.getBlockState(blockposition1).isAir() && (iblockdata1.is(Blocks.FARMLAND) || iblockdata1.is(TagsBlock.DIRT))) { - worldserver.setBlockAndUpdate(blockposition1, this.fruit.defaultBlockState()); + // CraftBukkit start + if (!CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition1, this.fruit.defaultBlockState())) { + return; + } + // CraftBukkit end worldserver.setBlockAndUpdate(blockposition, (IBlockData) this.fruit.getAttachedStem().defaultBlockState().setValue(BlockFacingHorizontal.FACING, enumdirection)); } } @@ -93,7 +99,7 @@ int i = Math.min(7, (Integer) iblockdata.getValue(BlockStem.AGE) + MathHelper.nextInt(worldserver.random, 2, 5)); IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockStem.AGE, i); - worldserver.setBlock(blockposition, iblockdata1, 2); + CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, iblockdata1, 2); // CraftBukkit if (i == 7) { iblockdata1.randomTick(worldserver, blockposition, worldserver.random); }