From 333dc0c9d22d5d59b18b39fd5214a5605653e11a Mon Sep 17 00:00:00 2001 From: granny Date: Tue, 30 Apr 2024 19:04:10 -0700 Subject: [PATCH] fix one punch not working correctly on hostile & passive mobs --- patches/server/0128-One-Punch-Man.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/patches/server/0128-One-Punch-Man.patch b/patches/server/0128-One-Punch-Man.patch index 8c548bd62..51461e170 100644 --- a/patches/server/0128-One-Punch-Man.patch +++ b/patches/server/0128-One-Punch-Man.patch @@ -5,7 +5,7 @@ Subject: [PATCH] One Punch Man! diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index dc1c7c55fd13cc1a8ade803bfb1b7c385cf29132..0b4384b6898ad591b8b9256b2427359474dd9c57 100644 +index dc1c7c55fd13cc1a8ade803bfb1b7c385cf29132..523052af43aa86982d2ded0cc0882d34bac24da7 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -2382,6 +2382,21 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -18,9 +18,9 @@ index dc1c7c55fd13cc1a8ade803bfb1b7c385cf29132..0b4384b6898ad591b8b9256b24273594 + double attackDamage; + net.minecraft.world.item.component.ItemAttributeModifiers itemattributemodifiers = player.getMainHandItem().getOrDefault(DataComponents.ATTRIBUTE_MODIFIERS, net.minecraft.world.item.component.ItemAttributeModifiers.EMPTY); + -+ attackDamage = itemattributemodifiers.compute(this.getAttributeBaseValue(Attributes.ATTACK_DAMAGE), EquipmentSlot.MAINHAND); ++ attackDamage = itemattributemodifiers.compute(player.getAttributeBaseValue(Attributes.ATTACK_DAMAGE), EquipmentSlot.MAINHAND); + -+ if (attackDamage == 0) { ++ if (attackDamage == 1.0D) { + this.setHealth(0); + } + }