Max Health Fix

Max Health Fix

22M Downloads

Doesn't work with Trinket modifiers

SlayeRRROAR opened this issue ยท 4 comments

commented

Fix does work correctly with the test provided in the curseforge page.
However it doesn't work with trinkets that modify the max health attribute

Here's the code that used for the trinket in question:

public Multimap<EntityAttribute, EntityAttributeModifier> getModifiers(ItemStack stack, SlotReference slot, LivingEntity entity, UUID uuid) {
        var modifiers = super.getModifiers(stack, slot, entity, uuid);
        modifiers.put(EntityAttributes.GENERIC_MAX_HEALTH, new EntityAttributeModifier(uuid, "generic.max_health", 0.5, EntityAttributeModifier.Operation.MULTIPLY_TOTAL));
        return modifiers;
    }
commented

This issue is caused by the trinket data loading too late, so the game doesn't know you're wearing any trinkets. It may be possible for me to fix it, but will require more investigation.

commented

Yeah I noticed that the issue was the way the trinket itself works, I """fixed""" it on my own by healing the player on equipping the trinket if the health is >= 20, this way even on logout and login, if a player was previously over 20hp, it gets healed to the new max heath. Has some side effects, but its more manageable than having to heal on every login.
Thank you for looking into this anyway

commented

I am glad you were able to find a workaround. Ultimately this type of fix should be implemented by the Curios/Trinkets API directly.

commented

Hi!

I'm creating a custom modpack, and run into something similar. My hearts always need to regenerate to full after logging in. I'm using curios and several other mods that modify the amount of health you can have (Allthemodium, Nameless Trinkets, etc.). Any idea where to start looking for a fix? Tried looking into the configs for curios, but nothing stands out. Since it might be the same issue, I didn't want to start a new issue.

Btw, running 1.20.1 and forge 47.3.0, with "MaxHealthFix-Forge-1.20.1-12.0.3".

Kind regards,

Devilaux