aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/og/net/minecraft/world/level/block/BlockStem.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/og/net/minecraft/world/level/block/BlockStem.patch')
-rw-r--r--patch-remap/og/net/minecraft/world/level/block/BlockStem.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/level/block/BlockStem.patch b/patch-remap/og/net/minecraft/world/level/block/BlockStem.patch
new file mode 100644
index 0000000000..d1f2af0417
--- /dev/null
+++ b/patch-remap/og/net/minecraft/world/level/block/BlockStem.patch
@@ -0,0 +1,42 @@
+--- a/net/minecraft/world/level/block/BlockStem.java
++++ b/net/minecraft/world/level/block/BlockStem.java
+@@ -27,6 +27,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 MapCodec<BlockStem> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
+@@ -79,7 +81,7 @@
+
+ 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);
+@@ -91,7 +93,11 @@
+ Optional<Block> optional1 = iregistry.getOptional(this.attachedStem);
+
+ if (optional.isPresent() && optional1.isPresent()) {
+- worldserver.setBlockAndUpdate(blockposition1, ((Block) optional.get()).defaultBlockState());
++ // CraftBukkit start
++ if (!CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition1, ((Block) optional.get()).defaultBlockState())) {
++ return;
++ }
++ // CraftBukkit end
+ worldserver.setBlockAndUpdate(blockposition, (IBlockData) ((Block) optional1.get()).defaultBlockState().setValue(BlockFacingHorizontal.FACING, enumdirection));
+ }
+ }
+@@ -121,7 +127,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);
+ }