diff options
author | EvilSeph <evilseph@gmail.com> | 2012-03-09 14:36:21 -0500 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2012-03-09 14:36:21 -0500 |
commit | 848344250d072d24d8cec9aaa95e48a35054ae0d (patch) | |
tree | 3d6fe47332ecb8a90102f995153adbbd5d3ecd97 /src | |
parent | 9b5a4d68b9658ffae40aa027a4fb758a3b68cfb4 (diff) | |
download | craftbukkit-848344250d072d24d8cec9aaa95e48a35054ae0d.tar craftbukkit-848344250d072d24d8cec9aaa95e48a35054ae0d.tar.gz craftbukkit-848344250d072d24d8cec9aaa95e48a35054ae0d.tar.lz craftbukkit-848344250d072d24d8cec9aaa95e48a35054ae0d.tar.xz craftbukkit-848344250d072d24d8cec9aaa95e48a35054ae0d.zip |
Fixed sheep not firing events when eating grass. Fixes BUKKIT-1104
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/net/minecraft/server/PathfinderGoalEatTile.java | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalEatTile.java b/src/main/java/net/minecraft/server/PathfinderGoalEatTile.java index 196d5682..af3608ba 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalEatTile.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalEatTile.java @@ -1,5 +1,10 @@ package net.minecraft.server; +// CraftBukkit start +import org.bukkit.craftbukkit.event.CraftEventFactory; +import org.bukkit.Material; +// CraftBukkit end + public class PathfinderGoalEatTile extends PathfinderGoal { private EntityLiving b; @@ -50,14 +55,22 @@ public class PathfinderGoalEatTile extends PathfinderGoal { int k = MathHelper.floor(this.b.locZ); if (this.c.getTypeId(i, j, k) == Block.LONG_GRASS.id) { - this.c.triggerEffect(2001, i, j, k, Block.LONG_GRASS.id + 4096); - this.c.setTypeId(i, j, k, 0); - this.b.z(); + // CraftBukkit start + if (!CraftEventFactory.callEntityChangeBlockEvent(this.b.getBukkitEntity(), this.b.world.getWorld().getBlockAt(i, j, k), Material.AIR).isCancelled()) { + this.c.triggerEffect(2001, i, j, k, Block.LONG_GRASS.id + 4096); + this.c.setTypeId(i, j, k, 0); + this.b.z(); + } + // CraftBukkit end } else if (this.c.getTypeId(i, j - 1, k) == Block.GRASS.id) { - this.c.triggerEffect(2001, i, j - 1, k, Block.GRASS.id); - this.c.setTypeId(i, j - 1, k, Block.DIRT.id); - this.b.z(); + // CraftBukkit start + if (!CraftEventFactory.callEntityChangeBlockEvent(this.b.getBukkitEntity(), this.b.world.getWorld().getBlockAt(i, j - 1, k), Material.DIRT).isCancelled()) { + this.c.triggerEffect(2001, i, j - 1, k, Block.GRASS.id); + this.c.setTypeId(i, j - 1, k, Block.DIRT.id); + this.b.z(); + } + // CraftBukkit end } } } -} +}
\ No newline at end of file |