mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 19:15:32 +01:00
90ac03522a
This reverts commit d6e3dff7d8
.
35 lines
2.0 KiB
Diff
35 lines
2.0 KiB
Diff
--- ../work/decompile-8eb82bde//net/minecraft/server/PathfinderGoalEatTile.java 2014-11-28 17:43:43.285707431 +0000
|
|
+++ src/main/java/net/minecraft/server/PathfinderGoalEatTile.java 2014-11-28 17:38:18.000000000 +0000
|
|
@@ -3,6 +3,11 @@
|
|
import com.google.common.base.Predicate;
|
|
import com.google.common.base.Predicates;
|
|
|
|
+// CraftBukkit start
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
+import org.bukkit.Material;
|
|
+// CraftBukkit end
|
|
+
|
|
public class PathfinderGoalEatTile extends PathfinderGoal {
|
|
|
|
private static final Predicate b = BlockStatePredicate.a((Block) Blocks.TALLGRASS).a(BlockLongGrass.TYPE, Predicates.equalTo(EnumTallGrassType.GRASS));
|
|
@@ -50,7 +55,8 @@
|
|
BlockPosition blockposition = new BlockPosition(this.c.locX, this.c.locY, this.c.locZ);
|
|
|
|
if (PathfinderGoalEatTile.b.apply(this.d.getType(blockposition))) {
|
|
- if (this.d.getGameRules().getBoolean("mobGriefing")) {
|
|
+ // CraftBukkit
|
|
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.c, this.c.world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), Material.AIR, !this.d.getGameRules().getBoolean("mobGriefing")).isCancelled()) {
|
|
this.d.setAir(blockposition, false);
|
|
}
|
|
|
|
@@ -59,7 +65,8 @@
|
|
BlockPosition blockposition1 = blockposition.down();
|
|
|
|
if (this.d.getType(blockposition1).getBlock() == Blocks.GRASS) {
|
|
- if (this.d.getGameRules().getBoolean("mobGriefing")) {
|
|
+ // CraftBukkit
|
|
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.c, this.c.world.getWorld().getBlockAt(blockposition1.getX(), blockposition1.getY(), blockposition1.getZ()), Material.DIRT, !this.d.getGameRules().getBoolean("mobGriefing")).isCancelled()) {
|
|
this.d.triggerEffect(2001, blockposition1, Block.getId(Blocks.GRASS));
|
|
this.d.setTypeAndData(blockposition1, Blocks.DIRT.getBlockData(), 2);
|
|
}
|