Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/nms-patches/PathfinderGoalEatTile.patch

34 Zeilen
1.7 KiB
Diff

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/PathfinderGoalEatTile.java
+++ b/net/minecraft/server/PathfinderGoalEatTile.java
2018-07-15 02:00:00 +02:00
@@ -2,6 +2,10 @@
import java.util.function.Predicate;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+// CraftBukkit end
+
public class PathfinderGoalEatTile extends PathfinderGoal {
2018-07-15 02:00:00 +02:00
private static final Predicate<IBlockData> a = BlockStatePredicate.a(Blocks.GRASS);
@@ -49,7 +53,8 @@
BlockPosition blockposition = new BlockPosition(this.b.locX, this.b.locY, this.b.locZ);
2018-07-15 02:00:00 +02:00
if (PathfinderGoalEatTile.a.test(this.c.getType(blockposition))) {
- if (this.c.getGameRules().getBoolean("mobGriefing")) {
+ // CraftBukkit
2018-07-15 02:00:00 +02:00
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.b, blockposition, Blocks.AIR.getBlockData(), !this.c.getGameRules().getBoolean("mobGriefing")).isCancelled()) {
this.c.setAir(blockposition, false);
}
2018-07-15 02:00:00 +02:00
@@ -58,7 +63,8 @@
BlockPosition blockposition1 = blockposition.down();
2018-07-15 02:00:00 +02:00
if (this.c.getType(blockposition1).getBlock() == Blocks.GRASS_BLOCK) {
- if (this.c.getGameRules().getBoolean("mobGriefing")) {
+ // CraftBukkit
2018-07-15 02:00:00 +02:00
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.b, blockposition, Blocks.AIR.getBlockData(), !this.c.getGameRules().getBoolean("mobGriefing")).isCancelled()) {
this.c.triggerEffect(2001, blockposition1, Block.getCombinedId(Blocks.GRASS_BLOCK.getBlockData()));
this.c.setTypeAndData(blockposition1, Blocks.DIRT.getBlockData(), 2);
}