diff options
author | md_5 <git@md-5.net> | 2016-11-23 10:34:08 +1100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2016-11-23 10:34:08 +1100 |
commit | c1462a24d83ef50e4cfd81948fd8868f00aaaccd (patch) | |
tree | 56428ed4ef513ca14a6c77b7dbed5593577a2fe5 | |
parent | 7691c87df6ae10249dfc618feab7be21b966f4cb (diff) | |
download | craftbukkit-c1462a24d83ef50e4cfd81948fd8868f00aaaccd.tar craftbukkit-c1462a24d83ef50e4cfd81948fd8868f00aaaccd.tar.gz craftbukkit-c1462a24d83ef50e4cfd81948fd8868f00aaaccd.tar.lz craftbukkit-c1462a24d83ef50e4cfd81948fd8868f00aaaccd.tar.xz craftbukkit-c1462a24d83ef50e4cfd81948fd8868f00aaaccd.zip |
SPIGOT-2765: Special case entity triggered explosions for HangingBreakEvent
-rw-r--r-- | nms-patches/EntityHanging.patch | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/nms-patches/EntityHanging.patch b/nms-patches/EntityHanging.patch index 66deea74..a810e53c 100644 --- a/nms-patches/EntityHanging.patch +++ b/nms-patches/EntityHanging.patch @@ -1,18 +1,19 @@ --- a/net/minecraft/server/EntityHanging.java +++ b/net/minecraft/server/EntityHanging.java -@@ -4,6 +4,11 @@ +@@ -4,6 +4,12 @@ import javax.annotation.Nullable; import org.apache.commons.lang3.Validate; +// CraftBukkit start +import org.bukkit.entity.Hanging; ++import org.bukkit.event.hanging.HangingBreakByEntityEvent; +import org.bukkit.event.hanging.HangingBreakEvent; +// CraftBukkit end + public abstract class EntityHanging extends Entity { private static final Predicate<Entity> c = new Predicate() { -@@ -41,43 +46,52 @@ +@@ -41,43 +47,52 @@ this.updateBoundingBox(); } @@ -97,7 +98,7 @@ return i % 32 == 0 ? 0.5D : 0.0D; } -@@ -88,6 +102,24 @@ +@@ -88,6 +103,24 @@ if (this.d++ == 100 && !this.world.isClientSide) { this.d = 0; if (!this.dead && !this.survives()) { @@ -122,14 +123,14 @@ this.die(); this.a((Entity) null); } -@@ -140,6 +172,21 @@ +@@ -140,6 +173,21 @@ return false; } else { if (!this.dead && !this.world.isClientSide) { + // CraftBukkit start - fire break events + HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.DEFAULT); + if (damagesource.getEntity() != null) { -+ event = new org.bukkit.event.hanging.HangingBreakByEntityEvent((Hanging) this.getBukkitEntity(), damagesource.getEntity() == null ? null : damagesource.getEntity().getBukkitEntity()); ++ event = new HangingBreakByEntityEvent((Hanging) this.getBukkitEntity(), damagesource.getEntity() == null ? null : damagesource.getEntity().getBukkitEntity(), damagesource.isExplosion() ? HangingBreakEvent.RemoveCause.EXPLOSION : HangingBreakEvent.RemoveCause.ENTITY); + } else if (damagesource.isExplosion()) { + event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.EXPLOSION); + } @@ -144,7 +145,7 @@ this.die(); this.ap(); this.a(damagesource.getEntity()); -@@ -151,6 +198,18 @@ +@@ -151,6 +199,18 @@ public void move(EnumMoveType enummovetype, double d0, double d1, double d2) { if (!this.world.isClientSide && !this.dead && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) { @@ -163,7 +164,7 @@ this.die(); this.a((Entity) null); } -@@ -158,7 +217,7 @@ +@@ -158,7 +218,7 @@ } public void f(double d0, double d1, double d2) { |