From 3fed09cc4262956bbb419841b1469dafc1139b9e Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 23 Mar 2018 19:40:16 +1100 Subject: SPIGOT-3869: Error when forcing EntityResurrectEvent --- nms-patches/EntityLiving.patch | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'nms-patches/EntityLiving.patch') diff --git a/nms-patches/EntityLiving.patch b/nms-patches/EntityLiving.patch index 1521d5c8..f39e620f 100644 --- a/nms-patches/EntityLiving.patch +++ b/nms-patches/EntityLiving.patch @@ -326,7 +326,7 @@ this.aA = 0.0F; Entity entity1 = damagesource.getEntity(); -@@ -833,18 +981,26 @@ +@@ -833,18 +981,28 @@ EnumHand[] aenumhand = EnumHand.values(); int i = aenumhand.length; @@ -351,12 +351,14 @@ + this.world.getServer().getPluginManager().callEvent(event); + + if (!event.isCancelled()) { -+ itemstack1.subtract(1); ++ if (!itemstack1.isEmpty()) { ++ itemstack1.subtract(1); ++ } + // CraftBukkit end if (this instanceof EntityPlayer) { EntityPlayer entityplayer = (EntityPlayer) this; -@@ -859,7 +1015,7 @@ +@@ -859,7 +1017,7 @@ this.world.broadcastEntityEffect(this, (byte) 35); } @@ -365,7 +367,7 @@ } } -@@ -944,6 +1100,12 @@ +@@ -944,6 +1102,12 @@ boolean flag = this.lastDamageByPlayerTime > 0; this.a(flag, i, damagesource); @@ -378,7 +380,7 @@ } } -@@ -1033,8 +1195,13 @@ +@@ -1033,8 +1197,13 @@ int i = MathHelper.f((f - 3.0F - f2) * f1); if (i > 0) { @@ -393,7 +395,7 @@ int j = MathHelper.floor(this.locX); int k = MathHelper.floor(this.locY - 0.20000000298023224D); int l = MathHelper.floor(this.locZ); -@@ -1061,7 +1228,7 @@ +@@ -1061,7 +1230,7 @@ protected float applyArmorModifier(DamageSource damagesource, float f) { if (!damagesource.ignoresArmor()) { @@ -402,7 +404,7 @@ f = CombatMath.a(f, (float) this.getArmorStrength(), (float) this.getAttributeInstance(GenericAttributes.i).getValue()); } -@@ -1074,7 +1241,8 @@ +@@ -1074,7 +1243,8 @@ } else { int i; @@ -412,7 +414,7 @@ i = (this.getEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5; int j = 25 - i; float f1 = f * (float) j; -@@ -1095,22 +1263,142 @@ +@@ -1095,22 +1265,142 @@ } } @@ -565,7 +567,7 @@ } public CombatTracker getCombatTracker() { -@@ -1177,6 +1465,7 @@ +@@ -1177,6 +1467,7 @@ public AttributeMapBase getAttributeMap() { if (this.attributeMap == null) { this.attributeMap = new AttributeMapServer(); @@ -573,7 +575,7 @@ } return this.attributeMap; -@@ -1469,6 +1758,7 @@ +@@ -1469,6 +1760,7 @@ } if (this.onGround && !this.world.isClientSide) { @@ -581,7 +583,7 @@ this.setFlag(7, false); } } else { -@@ -1838,6 +2128,7 @@ +@@ -1838,6 +2130,7 @@ } if (!this.world.isClientSide) { @@ -589,7 +591,7 @@ this.setFlag(7, flag); } -@@ -1931,11 +2222,11 @@ +@@ -1931,11 +2224,11 @@ } public boolean isInteractable() { @@ -603,7 +605,7 @@ } protected void ax() { -@@ -2072,7 +2363,27 @@ +@@ -2072,7 +2365,27 @@ protected void v() { if (!this.activeItem.isEmpty() && this.isHandRaised()) { this.b(this.activeItem, 16); @@ -632,7 +634,7 @@ this.cN(); } -@@ -2151,10 +2462,18 @@ +@@ -2151,10 +2464,18 @@ } if (flag1) { -- cgit v1.2.3