From 219db06f85b4cb81d8ae831760e91919a1a502ae Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sun, 11 Feb 2024 09:58:07 +1100 Subject: [PATCH] Fix accidentally renamed internal damage method By: md_5 --- .../minecraft/world/entity/EntityLiving.patch | 16 ++++++++-------- .../world/entity/player/EntityHuman.patch | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/paper-server/nms-patches/net/minecraft/world/entity/EntityLiving.patch b/paper-server/nms-patches/net/minecraft/world/entity/EntityLiving.patch index 7df5f72e55..b4ab26f8cf 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/EntityLiving.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/EntityLiving.patch @@ -381,7 +381,7 @@ float f2 = 0.0F; - if (f > 0.0F && this.isDamageSourceBlocked(damagesource)) { -+ // CraftBukkit - Moved into damageEntity0(DamageSource, float) ++ // CraftBukkit - Moved into actuallyHurt(DamageSource, float) + if (false && f > 0.0F && this.isDamageSourceBlocked(damagesource)) { this.hurtCurrentlyUsedShield(f); f2 = f; @@ -398,7 +398,7 @@ - this.actuallyHurt(damagesource, f - this.lastHurt); + // CraftBukkit start -+ if (!this.damageEntity0(damagesource, f - this.lastHurt)) { ++ if (!this.actuallyHurt(damagesource, f - this.lastHurt)) { + return false; + } + // CraftBukkit end @@ -406,21 +406,21 @@ flag1 = false; } else { + // CraftBukkit start -+ if (!this.damageEntity0(damagesource, f)) { ++ if (!this.actuallyHurt(damagesource, f)) { + return false; + } this.lastHurt = f; - this.invulnerableTime = 20; - this.actuallyHurt(damagesource, f); + this.invulnerableTime = this.invulnerableDuration; // CraftBukkit - restore use of maxNoDamageTicks -+ // this.damageEntity0(damagesource, f); ++ // this.actuallyHurt(damagesource, f); + // CraftBukkit end this.hurtDuration = 10; this.hurtTime = this.hurtDuration; } - if (damagesource.is(DamageTypeTags.DAMAGES_HELMET) && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) { -+ // CraftBukkit - Moved into damageEntity0(DamageSource, float) ++ // CraftBukkit - Moved into actuallyHurt(DamageSource, float) + if (false && damagesource.is(DamageTypeTags.DAMAGES_HELMET) && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) { this.hurtHelmet(damagesource, f); f *= 0.75F; @@ -650,7 +650,7 @@ protected float getDamageAfterArmorAbsorb(DamageSource damagesource, float f) { if (!damagesource.is(DamageTypeTags.BYPASSES_ARMOR)) { - this.hurtArmor(damagesource, f); -+ // this.hurtArmor(damagesource, f); // CraftBukkit - Moved into damageEntity0(DamageSource, float) ++ // this.hurtArmor(damagesource, f); // CraftBukkit - Moved into actuallyHurt(DamageSource, float) f = CombatMath.getDamageAfterAbsorb(f, (float) this.getArmorValue(), (float) this.getAttributeValue(GenericAttributes.ARMOR_TOUGHNESS)); } @@ -659,7 +659,7 @@ int i; - if (this.hasEffect(MobEffects.DAMAGE_RESISTANCE) && !damagesource.is(DamageTypeTags.BYPASSES_RESISTANCE)) { -+ // CraftBukkit - Moved to damageEntity0(DamageSource, float) ++ // CraftBukkit - Moved to actuallyHurt(DamageSource, float) + if (false && this.hasEffect(MobEffects.DAMAGE_RESISTANCE) && !damagesource.is(DamageTypeTags.BYPASSES_RESISTANCE)) { i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5; int j = 25 - i; @@ -674,7 +674,7 @@ - f = this.getDamageAfterMagicAbsorb(damagesource, f); - float f1 = f; + // CraftBukkit start -+ protected boolean damageEntity0(final DamageSource damagesource, float f) { // void -> boolean, add final ++ protected boolean actuallyHurt(final DamageSource damagesource, float f) { // void -> boolean, add final + if (!this.isInvulnerableTo(damagesource)) { + final boolean human = this instanceof EntityHuman; + float originalDamage = f; diff --git a/paper-server/nms-patches/net/minecraft/world/entity/player/EntityHuman.patch b/paper-server/nms-patches/net/minecraft/world/entity/player/EntityHuman.patch index c5be567df5..014413a3d7 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/player/EntityHuman.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/player/EntityHuman.patch @@ -234,9 +234,9 @@ + // CraftBukkit start @Override - protected void actuallyHurt(DamageSource damagesource, float f) { -+ protected boolean damageEntity0(DamageSource damagesource, float f) { // void -> boolean ++ protected boolean actuallyHurt(DamageSource damagesource, float f) { // void -> boolean + if (true) { -+ return super.damageEntity0(damagesource, f); ++ return super.actuallyHurt(damagesource, f); + } + // CraftBukkit end if (!this.isInvulnerableTo(damagesource)) {