mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-10 12:02:36 +01:00
b3a8254758
By: md_5 <git@md-5.net>
41 lines
2.3 KiB
Diff
41 lines
2.3 KiB
Diff
--- 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.set(BlockStem.AGE, i + 1);
|
|
- worldserver.setTypeAndData(blockposition, iblockdata, 2);
|
|
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, iblockdata, 2); // CraftBukkit
|
|
} else {
|
|
EnumDirection enumdirection = EnumDirection.EnumDirectionLimit.HORIZONTAL.a(random);
|
|
BlockPosition blockposition1 = blockposition.shift(enumdirection);
|
|
IBlockData iblockdata1 = worldserver.getType(blockposition1.down());
|
|
|
|
if (worldserver.getType(blockposition1).isAir() && (iblockdata1.a(Blocks.FARMLAND) || iblockdata1.a((Tag) TagsBlock.DIRT))) {
|
|
- worldserver.setTypeUpdate(blockposition1, this.fruit.getBlockData());
|
|
+ // CraftBukkit start
|
|
+ if (!CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition1, this.fruit.getBlockData())) {
|
|
+ return;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
worldserver.setTypeUpdate(blockposition, (IBlockData) this.fruit.d().getBlockData().set(BlockFacingHorizontal.FACING, enumdirection));
|
|
}
|
|
}
|
|
@@ -93,7 +99,7 @@
|
|
int i = Math.min(7, (Integer) iblockdata.get(BlockStem.AGE) + MathHelper.nextInt(worldserver.random, 2, 5));
|
|
IBlockData iblockdata1 = (IBlockData) iblockdata.set(BlockStem.AGE, i);
|
|
|
|
- worldserver.setTypeAndData(blockposition, iblockdata1, 2);
|
|
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, iblockdata1, 2); // CraftBukkit
|
|
if (i == 7) {
|
|
iblockdata1.b(worldserver, blockposition, worldserver.random);
|
|
}
|