@@ -1,34 +1,33 @@
|
||||
--- a/net/minecraft/server/PathfinderGoalEatTile.java
|
||||
+++ b/net/minecraft/server/PathfinderGoalEatTile.java
|
||||
@@ -3,6 +3,11 @@
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.Material;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class PathfinderGoalEatTile extends PathfinderGoal {
|
||||
|
||||
private static final Predicate<IBlockData> b = BlockStatePredicate.a((Block) Blocks.TALLGRASS).a(BlockLongGrass.TYPE, Predicates.equalTo(BlockLongGrass.EnumTallGrassType.GRASS));
|
||||
@@ -50,7 +55,8 @@
|
||||
BlockPosition blockposition = new BlockPosition(this.c.locX, this.c.locY, this.c.locZ);
|
||||
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);
|
||||
|
||||
if (PathfinderGoalEatTile.b.apply(this.d.getType(blockposition))) {
|
||||
- if (this.d.getGameRules().getBoolean("mobGriefing")) {
|
||||
if (PathfinderGoalEatTile.a.test(this.c.getType(blockposition))) {
|
||||
- if (this.c.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);
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.b, blockposition, Blocks.AIR.getBlockData(), !this.c.getGameRules().getBoolean("mobGriefing")).isCancelled()) {
|
||||
this.c.setAir(blockposition, false);
|
||||
}
|
||||
|
||||
@@ -59,7 +65,8 @@
|
||||
@@ -58,7 +63,8 @@
|
||||
BlockPosition blockposition1 = blockposition.down();
|
||||
|
||||
if (this.d.getType(blockposition1).getBlock() == Blocks.GRASS) {
|
||||
- if (this.d.getGameRules().getBoolean("mobGriefing")) {
|
||||
if (this.c.getType(blockposition1).getBlock() == Blocks.GRASS_BLOCK) {
|
||||
- if (this.c.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.triggerEffect(2001, blockposition1, Block.getId(Blocks.GRASS));
|
||||
this.d.setTypeAndData(blockposition1, Blocks.DIRT.getBlockData(), 2);
|
||||
+ 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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user