mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 15:30:19 +01:00
SPIGOT-4392: Stem updates even if BlockGrowEvent cancelled
This commit is contained in:
parent
c1ecaa2ff7
commit
020b495274
1 changed files with 7 additions and 3 deletions
|
@ -9,7 +9,7 @@
|
||||||
public class BlockStem extends BlockPlant implements IBlockFragilePlantElement {
|
public class BlockStem extends BlockPlant implements IBlockFragilePlantElement {
|
||||||
|
|
||||||
public static final BlockStateInteger AGE = BlockProperties.W;
|
public static final BlockStateInteger AGE = BlockProperties.W;
|
||||||
@@ -33,14 +35,14 @@
|
@@ -33,14 +35,18 @@
|
||||||
|
|
||||||
if (i < 7) {
|
if (i < 7) {
|
||||||
iblockdata = (IBlockData) iblockdata.set(BlockStem.AGE, Integer.valueOf(i + 1));
|
iblockdata = (IBlockData) iblockdata.set(BlockStem.AGE, Integer.valueOf(i + 1));
|
||||||
|
@ -22,11 +22,15 @@
|
||||||
|
|
||||||
if (world.getType(blockposition1).isAir() && (block == Blocks.FARMLAND || block == Blocks.DIRT || block == Blocks.COARSE_DIRT || block == Blocks.PODZOL || block == Blocks.GRASS_BLOCK)) {
|
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());
|
- world.setTypeUpdate(blockposition1, this.blockFruit.getBlockData());
|
||||||
+ CraftEventFactory.handleBlockGrowEvent(world, blockposition1, this.blockFruit.getBlockData()); // CraftBukkit
|
+ // CraftBukkit start
|
||||||
|
+ if (!CraftEventFactory.handleBlockGrowEvent(world, blockposition1, this.blockFruit.getBlockData())) {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ // CraftBukkit end
|
||||||
world.setTypeUpdate(blockposition, (IBlockData) this.blockFruit.e().getBlockData().set(BlockFacingHorizontal.FACING, enumdirection));
|
world.setTypeUpdate(blockposition, (IBlockData) this.blockFruit.e().getBlockData().set(BlockFacingHorizontal.FACING, enumdirection));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,7 +96,7 @@
|
@@ -94,7 +100,7 @@
|
||||||
int i = Math.min(7, ((Integer) iblockdata.get(BlockStem.AGE)).intValue() + MathHelper.nextInt(world.random, 2, 5));
|
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));
|
IBlockData iblockdata1 = (IBlockData) iblockdata.set(BlockStem.AGE, Integer.valueOf(i));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue