From 54fa8c2f8101b4c7834bc42f79767fca603ab8e7 Mon Sep 17 00:00:00 2001 From: Teriuihi Date: Sat, 19 Oct 2024 00:06:34 +0200 Subject: [PATCH] Fix incorrect attribute modification calculation Correct the calculation of the value to be added to an attribute. Adjusted the logging statement to reflect the new calculation method, ensuring accurate debug information. --- .../abilities/modifiers/EntityAttributeModifier.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/alttd/custommobs/abilities/modifiers/EntityAttributeModifier.java b/src/main/java/com/alttd/custommobs/abilities/modifiers/EntityAttributeModifier.java index f6a0256..e090221 100644 --- a/src/main/java/com/alttd/custommobs/abilities/modifiers/EntityAttributeModifier.java +++ b/src/main/java/com/alttd/custommobs/abilities/modifiers/EntityAttributeModifier.java @@ -29,14 +29,15 @@ public class EntityAttributeModifier implements EntityModifier { log.warn("Entity {} has no {} attribute", entity.getName(), attribute.name()); return; } - log.info("DEBUG: Adding {} to attribute {}", attributeInstance.getValue() - value, attribute.name()); + double add = attributeInstance.getBaseValue() - attributeInstance.getValue() - value; + log.info("DEBUG: Adding {} to attribute {}", add, attribute.name()); NamespacedKey namespacedKey = NamespacedKey.fromString("cm", main); if (namespacedKey == null) { log.error("Namespaced key was null when applying attribute modifier"); return; } AttributeModifier attributeModifier = new AttributeModifier(namespacedKey, - attributeInstance.getValue() - value, + add, AttributeModifier.Operation.ADD_NUMBER); attributeInstance.addModifier(attributeModifier); }