mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Fix crash due to attributes not being removed (tryRemove doesn't try hard enough)
This commit is contained in:
parent
5f545745be
commit
a1f91a591a
4 changed files with 4 additions and 4 deletions
|
@ -143,7 +143,7 @@ public class BubbleSpell extends AbstractSpell implements TimedSpell,
|
|||
if (source.asEntity() instanceof LivingEntity l) {
|
||||
MODIFIERS.forEach((attribute, modifier) -> {
|
||||
if (l.getAttributes().hasAttribute(attribute)) {
|
||||
l.getAttributeInstance(attribute).tryRemoveModifier(modifier.getId());
|
||||
l.getAttributeInstance(attribute).removeModifier(modifier.getId());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -366,7 +366,7 @@ public abstract class Living<T extends LivingEntity> implements Equine<T>, Caste
|
|||
EntityAttributeModifier modifier = instance.getModifier(id);
|
||||
|
||||
if (!MathHelper.approximatelyEquals(desiredValue, modifier == null ? 0 : modifier.getValue())) {
|
||||
instance.tryRemoveModifier(id);
|
||||
instance.removeModifier(id);
|
||||
|
||||
if (desiredValue != 0) {
|
||||
if (permanent) {
|
||||
|
|
|
@ -89,7 +89,7 @@ public class PlayerAttributes implements Tickable {
|
|||
instance.addPersistentModifier(modifier);
|
||||
}
|
||||
} else {
|
||||
instance.tryRemoveModifier(modifier.getId());
|
||||
instance.removeModifier(modifier.getId());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public class AttributedEnchantment extends SimpleEnchantment {
|
|||
modifiers.forEach((attr, modifierSupplier) -> {
|
||||
EntityAttributeInstance instance = user.asEntity().getAttributeInstance(attr);
|
||||
|
||||
instance.tryRemoveModifier(modifierSupplier.get(user, 1).getId());
|
||||
instance.removeModifier(modifierSupplier.get(user, 1).getId());
|
||||
});
|
||||
user.getEnchants().remove(this);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue