Darkhax-Minecraft / Max-Health-Fix

Fixes a max health bug with players in Minecraft.
GNU Lesser General Public License v2.1
4 stars 1 forks source link

Doesn't work with Trinket modifiers #3

Closed SlayeRRROAR closed 1 year ago

SlayeRRROAR commented 1 year ago

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;
    }
Darkhax commented 1 year ago

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.

SlayeRRROAR commented 1 year ago

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

Darkhax commented 1 year ago

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

Devilaux commented 2 weeks ago

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