2025-03-26 03:05:00 +11:00

39 lines
2.1 KiB
Diff

--- a/net/minecraft/world/level/block/BlockCrops.java
+++ b/net/minecraft/world/level/block/BlockCrops.java
@@ -23,6 +23,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class BlockCrops extends VegetationBlock implements IBlockFragilePlantElement {
public static final MapCodec<BlockCrops> CODEC = simpleCodec(BlockCrops::new);
@@ -86,7 +88,7 @@
float f = getGrowthSpeed(this, worldserver, blockposition);
if (randomsource.nextInt((int) (25.0F / f) + 1) == 0) {
- worldserver.setBlock(blockposition, this.getStateForAge(i + 1), 2);
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, this.getStateForAge(i + 1), 2); // CraftBukkit
}
}
}
@@ -96,7 +98,7 @@
public void growCrops(World world, BlockPosition blockposition, IBlockData iblockdata) {
int i = Math.min(this.getMaxAge(), this.getAge(iblockdata) + this.getBonemealAgeIncrease(world));
- world.setBlock(blockposition, this.getStateForAge(i), 2);
+ CraftEventFactory.handleBlockGrowEvent(world, blockposition, this.getStateForAge(i), 2); // CraftBukkit
}
protected int getBonemealAgeIncrease(World world) {
@@ -159,7 +161,7 @@
@Override
protected void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity, InsideBlockEffectApplier insideblockeffectapplier) {
if (world instanceof WorldServer worldserver) {
- if (entity instanceof EntityRavager && worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
+ if (entity instanceof EntityRavager && CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.AIR.defaultBlockState(), !worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit
worldserver.destroyBlock(blockposition, true, entity);
}
}