From 6247aa00cc50cff563dc17811db1c3f4a9f1487c Mon Sep 17 00:00:00 2001 From: Thinkofname Date: Thu, 31 Mar 2016 12:50:58 +0100 Subject: [PATCH] SPIGOT-2101: Check the result of damageEntity before applying knockback from sweep attacks --- nms-patches/EntityHuman.patch | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/nms-patches/EntityHuman.patch b/nms-patches/EntityHuman.patch index 052ba4009b..a72bb09f77 100644 --- a/nms-patches/EntityHuman.patch +++ b/nms-patches/EntityHuman.patch @@ -278,7 +278,20 @@ } } -@@ -925,11 +1029,28 @@ +@@ -915,8 +1019,11 @@ + EntityLiving entityliving = (EntityLiving) iterator.next(); + + if (entityliving != this && entityliving != entity && !this.r(entityliving) && this.h(entityliving) < 9.0D) { ++ // CraftBukkit start - Only apply knockback if the damage hits ++ if (entityliving.damageEntity(DamageSource.playerAttack(this), 1.0F)) { + entityliving.a(this, 0.4F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F))); +- entityliving.damageEntity(DamageSource.playerAttack(this), 1.0F); ++ } ++ // CraftBukkit end + } + } + +@@ -925,11 +1032,28 @@ } if (entity instanceof EntityPlayer && entity.velocityChanged) { @@ -307,7 +320,7 @@ } if (flag2) { -@@ -991,7 +1112,8 @@ +@@ -991,7 +1115,8 @@ if (itemstack3 != null && object instanceof EntityLiving) { itemstack3.a((EntityLiving) object, this); @@ -317,7 +330,7 @@ this.a(EnumHand.MAIN_HAND, (ItemStack) null); } } -@@ -1001,7 +1123,14 @@ +@@ -1001,7 +1126,14 @@ this.a(StatisticList.y, Math.round(f5 * 10.0F)); if (j > 0) { @@ -333,7 +346,7 @@ } if (this.world instanceof WorldServer && f5 > 2.0F) { -@@ -1090,6 +1219,20 @@ +@@ -1090,6 +1222,20 @@ this.stopRiding(); } @@ -354,7 +367,7 @@ this.setSize(0.2F, 0.2F); if (this.world.isLoaded(blockposition)) { EnumDirection enumdirection = (EnumDirection) this.world.getType(blockposition).get(BlockFacingHorizontal.FACING); -@@ -1172,6 +1315,23 @@ +@@ -1172,6 +1318,23 @@ this.world.everyoneSleeping(); } @@ -378,7 +391,7 @@ this.sleepTicks = flag ? 0 : 100; if (flag2) { this.setRespawnPosition(this.bedPosition, false); -@@ -1222,9 +1382,11 @@ +@@ -1222,9 +1385,11 @@ if (blockposition != null) { this.e = blockposition; this.f = flag;