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.
This commit is contained in:
parent
7704d75960
commit
54fa8c2f81
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user