Max Health Fix

Max Health Fix

22M Downloads

[BUG] Incompatibility with Armor Set Bonuses

jinkhya opened this issue ยท 4 comments

commented

Minecraft Version

1.20.1

Mod Version

12.0.2

Mod Loader

Forge

What environment are you running the mod in?

All

Issue Description

Hello,
I was wondering why MaxHealthFix was not working in Uncharted Expeditions modpack. I figured out it was because the mod adding extra hearts is Armor Set Bonuses and it doesn't seem to work with it. To reproduce the issue, having Architectury, Armor set Bonuses and MaxHealthFix is enough. Now I dunno if you can do anything about it but I thought I'd ask :)
Thanks in advance,
Jin

commented

I reported it to the author but they haven't found a solution to this : SpaceCat97/SpaceCats-Wikis#35
I dunno if you can on your end. If not it's okay, we'll just eat to heal, it's no biggie.

commented

I've released a new update 12.0.3 that should improve compatibility with these other mods. I would appreciate it if you could test it out and let me know.

commented

Hello, sorry for the late answer, I've been busy IRL. I tried 12.0.3 and it does not sadly :'(

commented

The Armor Set Bonuses mod doesn't share their code on GitHub so it took a while for me to have time to properly debug this. After decompiling their code and probing it a bit, this incompatibility is entirely on their end. Unfortunately I won't be able to fix this issue for you.

To give a more in-depth explanation, they are injecting into LivingEntity#tickEffects and only applying their effects after 10 ticks have passed. This means you do not have any bonuses active for the first half of a second after loading into a world. I am not sure why they are doing that, but it is long after my mod and most other mods apply these changes.

    @Inject(at = {@At("HEAD")}, method = {"tickEffects"}, cancellable = true)
    public void tickEffects(CallbackInfo ci) {
        ++this.tickCount;
        if (this.tickCount >= 10) {
            LivingEntity livingEntity = (LivingEntity)this;
            ModUtils.checkAndApplyBonusesTo(livingEntity, livingEntity, "self");
            ModUtils.checkAndApplyImmunitiesTo(livingEntity, livingEntity);
            this.tickCount = 0;
        }
    }