2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/level/block/BlockStem.java
|
|
|
|
+++ b/net/minecraft/world/level/block/BlockStem.java
|
2023-12-05 17:40:00 +01:00
|
|
|
@@ -27,6 +27,8 @@
|
2021-03-15 23:00:00 +01:00
|
|
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
|
|
|
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
|
|
|
+
|
|
|
|
public class BlockStem extends BlockPlant implements IBlockFragilePlantElement {
|
|
|
|
|
2023-12-05 17:40:00 +01:00
|
|
|
public static final MapCodec<BlockStem> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
|
|
|
|
@@ -79,7 +81,7 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
if (i < 7) {
|
2021-11-21 23:00:00 +01:00
|
|
|
iblockdata = (IBlockData) iblockdata.setValue(BlockStem.AGE, i + 1);
|
|
|
|
- worldserver.setBlock(blockposition, iblockdata, 2);
|
2019-12-10 23:00:00 +01:00
|
|
|
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, iblockdata, 2); // CraftBukkit
|
2014-11-25 22:32:16 +01:00
|
|
|
} else {
|
2022-06-07 18:00:00 +02:00
|
|
|
EnumDirection enumdirection = EnumDirection.EnumDirectionLimit.HORIZONTAL.getRandomDirection(randomsource);
|
2021-11-21 23:00:00 +01:00
|
|
|
BlockPosition blockposition1 = blockposition.relative(enumdirection);
|
2023-12-05 17:40:00 +01:00
|
|
|
@@ -91,7 +93,11 @@
|
|
|
|
Optional<Block> optional1 = iregistry.getOptional(this.attachedStem);
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2023-12-05 17:40:00 +01:00
|
|
|
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));
|
|
|
|
}
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
2023-12-05 17:40:00 +01:00
|
|
|
@@ -121,7 +127,7 @@
|
2021-11-21 23:00:00 +01:00
|
|
|
int i = Math.min(7, (Integer) iblockdata.getValue(BlockStem.AGE) + MathHelper.nextInt(worldserver.random, 2, 5));
|
|
|
|
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockStem.AGE, i);
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
- worldserver.setBlock(blockposition, iblockdata1, 2);
|
2019-12-10 23:00:00 +01:00
|
|
|
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, iblockdata1, 2); // CraftBukkit
|
2018-07-15 02:00:00 +02:00
|
|
|
if (i == 7) {
|
2021-11-21 23:00:00 +01:00
|
|
|
iblockdata1.randomTick(worldserver, blockposition, worldserver.random);
|
2018-07-15 02:00:00 +02:00
|
|
|
}
|