0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git synced 2024-11-26 00:26:14 +00:00
craftbukkit/nms-patches/net/minecraft/world/entity/ai/goal/PathfinderGoalEatTile.patch
2024-10-23 02:15:00 +11:00

32 lines
1.8 KiB
Diff

--- 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 int EAT_ANIMATION_TICKS = 40;
@@ -64,7 +68,7 @@
BlockPosition blockposition = this.mob.blockPosition();
if (PathfinderGoalEatTile.IS_TALL_GRASS.test(this.level.getBlockState(blockposition))) {
- if (getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
+ if (CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition, Blocks.AIR.defaultBlockState(), !getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit
this.level.destroyBlock(blockposition, false);
}
@@ -73,7 +77,7 @@
BlockPosition blockposition1 = blockposition.below();
if (this.level.getBlockState(blockposition1).is(Blocks.GRASS_BLOCK)) {
- if (getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
+ if (CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition1, Blocks.AIR.defaultBlockState(), !getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit
this.level.levelEvent(2001, blockposition1, Block.getId(Blocks.GRASS_BLOCK.defaultBlockState()));
this.level.setBlock(blockposition1, Blocks.DIRT.defaultBlockState(), 2);
}