Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-21 05:50:05 +01:00
34 Zeilen
1.7 KiB
Diff
34 Zeilen
1.7 KiB
Diff
--- a/net/minecraft/server/PathfinderGoalEatTile.java
|
|
+++ b/net/minecraft/server/PathfinderGoalEatTile.java
|
|
@@ -3,6 +3,10 @@
|
|
import java.util.EnumSet;
|
|
import java.util.function.Predicate;
|
|
|
|
+// CraftBukkit start
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
+// CraftBukkit end
|
|
+
|
|
public class PathfinderGoalEatTile extends PathfinderGoal {
|
|
|
|
private static final Predicate<IBlockData> a = BlockStatePredicate.a(Blocks.GRASS);
|
|
@@ -55,7 +59,8 @@
|
|
BlockPosition blockposition = new BlockPosition(this.b);
|
|
|
|
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);
|
|
}
|
|
|
|
@@ -64,7 +69,8 @@
|
|
BlockPosition blockposition1 = blockposition.down();
|
|
|
|
if (this.c.getType(blockposition1).getBlock() == 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);
|
|
}
|