diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2013-12-09 13:43:02 -0600 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2013-12-09 13:43:02 -0600 |
commit | 772867eb51fc4137acceb7b9fb61b8bd742f9b8b (patch) | |
tree | 4a86ebef4030f9dfdb2ccf72ae6ea8378df2c22e /src/main/java/net/minecraft/server/EntityHanging.java | |
parent | 305e5f4f08a39976857ad9af61bfcf77fc9bfa78 (diff) | |
download | craftbukkit-772867eb51fc4137acceb7b9fb61b8bd742f9b8b.tar craftbukkit-772867eb51fc4137acceb7b9fb61b8bd742f9b8b.tar.gz craftbukkit-772867eb51fc4137acceb7b9fb61b8bd742f9b8b.tar.lz craftbukkit-772867eb51fc4137acceb7b9fb61b8bd742f9b8b.tar.xz craftbukkit-772867eb51fc4137acceb7b9fb61b8bd742f9b8b.zip |
Call event when pistons push an item frame/painting. Fixes BUKKIT-5110
When pistons push/pull blocks they call Entity.move(float, float) to move
entities out of their path. For hanging entities this code path makes them
simply die and drop as an item. We now call an event in this scenario so
plugins can control this behavior.
Diffstat (limited to 'src/main/java/net/minecraft/server/EntityHanging.java')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityHanging.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main/java/net/minecraft/server/EntityHanging.java b/src/main/java/net/minecraft/server/EntityHanging.java index 4de0b17b..670ca65b 100644 --- a/src/main/java/net/minecraft/server/EntityHanging.java +++ b/src/main/java/net/minecraft/server/EntityHanging.java @@ -237,7 +237,7 @@ public abstract class EntityHanging extends Entity { this.world.getServer().getPluginManager().callEvent(paintingEvent); } - if (dead || event.isCancelled() || (paintingEvent != null && paintingEvent.isCancelled())) { + if (this.dead || event.isCancelled() || (paintingEvent != null && paintingEvent.isCancelled())) { return true; } // CraftBukkit end @@ -253,7 +253,17 @@ public abstract class EntityHanging extends Entity { public void move(double d0, double d1, double d2) { if (!this.world.isStatic && !this.dead && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) { - if (dead) return; // CraftBukkit + if (this.dead) return; // CraftBukkit + + // CraftBukkit start + // TODO - Does this need its own cause? Seems to only be triggered by pistons + HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.PHYSICS); + this.world.getServer().getPluginManager().callEvent(event); + + if (this.dead || event.isCancelled()) { + return; + } + // CraftBukkit end this.die(); this.b((Entity) null); |