3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-24 15:20:11 +01:00
Paper/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
2019-04-23 04:00:00 +02:00
@@ -3,6 +3,10 @@
import java.util.EnumSet;
2018-07-15 02:00:00 +02:00
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);
2019-04-23 04:00:00 +02:00
@@ -55,7 +59,8 @@
2020-06-25 02:00:00 +02:00
BlockPosition blockposition = this.b.getChunkCoordinates();
2018-07-15 02:00:00 +02:00
if (PathfinderGoalEatTile.a.test(this.c.getType(blockposition))) {
2019-06-21 12:00:00 +02:00
- if (this.c.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) {
+ // CraftBukkit
2019-06-21 12:00:00 +02:00
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.b, blockposition, Blocks.AIR.getBlockData(), !this.c.getGameRules().getBoolean(GameRules.MOB_GRIEFING)).isCancelled()) {
2019-04-23 04:00:00 +02:00
this.c.b(blockposition, false);
}
2019-04-23 04:00:00 +02:00
@@ -64,7 +69,8 @@
BlockPosition blockposition1 = blockposition.down();
2020-06-25 02:00:00 +02:00
if (this.c.getType(blockposition1).a(Blocks.GRASS_BLOCK)) {
2019-06-21 12:00:00 +02:00
- if (this.c.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) {
+ // CraftBukkit
2019-06-21 12:00:00 +02:00
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.b, blockposition, Blocks.AIR.getBlockData(), !this.c.getGameRules().getBoolean(GameRules.MOB_GRIEFING)).isCancelled()) {
2018-07-15 02:00:00 +02:00
this.c.triggerEffect(2001, blockposition1, Block.getCombinedId(Blocks.GRASS_BLOCK.getBlockData()));
this.c.setTypeAndData(blockposition1, Blocks.DIRT.getBlockData(), 2);
}