From c8f17232cf6eacbebf9b7feb4763d22fedc6daec Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 25 Jan 2015 10:45:02 +1100 Subject: SPIGOT-161: Don't apply velocity changes if we didn't damage on explosion. --- nms-patches/Explosion.patch | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/nms-patches/Explosion.patch b/nms-patches/Explosion.patch index 89089e0d..a5ef1741 100644 --- a/nms-patches/Explosion.patch +++ b/nms-patches/Explosion.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/Explosion.java 2014-11-28 17:43:43.189707433 +0000 -+++ src/main/java/net/minecraft/server/Explosion.java 2014-11-28 17:38:22.000000000 +0000 +--- ../work/decompile-8eb82bde/net/minecraft/server/Explosion.java 2015-01-25 10:44:43.764182684 +1100 ++++ src/main/java/net/minecraft/server/Explosion.java 2015-01-25 10:44:43.768182687 +1100 @@ -8,6 +8,12 @@ import java.util.List; import java.util.Map; @@ -49,22 +49,26 @@ hashset.add(blockposition); } -@@ -112,7 +125,14 @@ +@@ -112,7 +125,17 @@ double d12 = (double) this.world.a(vec3d, entity.getBoundingBox()); double d13 = (1.0D - d7) * d12; +- entity.damageEntity(DamageSource.explosion(this), (float) ((int) ((d13 * d13 + d13) / 2.0D * 8.0D * (double) f3 + 1.0D))); + // entity.damageEntity(DamageSource.explosion(this), (float) ((int) ((d13 * d13 + d13) / 2.0D * 8.0D * (double) f3 + 1.0D))); + + // CraftBukkit start + CraftEventFactory.entityDamage = source; - entity.damageEntity(DamageSource.explosion(this), (float) ((int) ((d13 * d13 + d13) / 2.0D * 8.0D * (double) f3 + 1.0D))); ++ boolean wasDamaged = entity.damageEntity(DamageSource.explosion(this), (float) ((int) ((d13 * d13 + d13) / 2.0D * 8.0D * (double) f3 + 1.0D))); + CraftEventFactory.entityDamage = null; ++ if (!wasDamaged) { ++ continue; ++ } + // CraftBukkit end + double d14 = EnchantmentProtection.a(entity, d13); entity.motX += d8 * d14; -@@ -140,6 +160,35 @@ +@@ -140,6 +163,35 @@ BlockPosition blockposition; if (this.b) { @@ -100,7 +104,7 @@ iterator = this.blocks.iterator(); while (iterator.hasNext()) { -@@ -170,7 +219,8 @@ +@@ -170,7 +222,8 @@ if (block.getMaterial() != Material.AIR) { if (block.a(this)) { @@ -110,7 +114,7 @@ } this.world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 3); -@@ -184,8 +234,12 @@ +@@ -184,8 +237,12 @@ while (iterator.hasNext()) { blockposition = (BlockPosition) iterator.next(); -- cgit v1.2.3