--- a/net/minecraft/world/entity/ai/goal/PathfinderGoalEatTile.java +++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalEatTile.java @@ -11,6 +11,10 @@ import net.minecraft.world.level.block.state.IBlockData; import net.minecraft.world.level.block.state.predicate.BlockStatePredicate; +// CraftBukkit start +import org.bukkit.craftbukkit.event.CraftEventFactory; +// CraftBukkit end + public class PathfinderGoalEatTile extends PathfinderGoal { private static final Predicate a = BlockStatePredicate.a(Blocks.GRASS); @@ -63,7 +67,8 @@ BlockPosition blockposition = this.b.getChunkCoordinates(); if (PathfinderGoalEatTile.a.test(this.c.getType(blockposition))) { - if (this.c.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) { + // CraftBukkit + if (!CraftEventFactory.callEntityChangeBlockEvent(this.b, blockposition, Blocks.AIR.getBlockData(), !this.c.getGameRules().getBoolean(GameRules.MOB_GRIEFING)).isCancelled()) { this.c.b(blockposition, false); } @@ -72,7 +77,8 @@ BlockPosition blockposition1 = blockposition.down(); if (this.c.getType(blockposition1).a(Blocks.GRASS_BLOCK)) { - if (this.c.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) { + // CraftBukkit + if (!CraftEventFactory.callEntityChangeBlockEvent(this.b, blockposition, Blocks.AIR.getBlockData(), !this.c.getGameRules().getBoolean(GameRules.MOB_GRIEFING)).isCancelled()) { this.c.triggerEffect(2001, blockposition1, Block.getCombinedId(Blocks.GRASS_BLOCK.getBlockData())); this.c.setTypeAndData(blockposition1, Blocks.DIRT.getBlockData(), 2); }