Implement Ascend Compat, Irons spellbooks compat, And rehauled most things.

This commit is contained in:
2025-11-17 11:15:17 +01:00
parent 0f79150c19
commit ccfecb4317
11 changed files with 242 additions and 147 deletions
@@ -0,0 +1,49 @@
package net.fretux.mindmotion.client.effects;
import io.redspace.ironsspellbooks.api.registry.AttributeRegistry;
import net.fretux.mindmotion.player.PlayerCapabilityProvider;
import net.minecraft.world.entity.ai.attributes.Attribute;
import net.minecraft.world.entity.ai.attributes.AttributeInstance;
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.fml.ModList;
import java.util.UUID;
public final class IronsSpellbooksCompatMM {
public static final double TEMPO_PER_PERCENT = 3;
private static final UUID TEMPO_MANA_REGEN_UUID =
UUID.fromString("de4f16ad-73b3-4b99-bf77-44c9878222aa");
private IronsSpellbooksCompatMM() {}
public static boolean isLoaded() {
return ModList.get().isLoaded("irons_spellbooks");
}
public static void applyTempo(Player player) {
if (!isLoaded()) return;
player.getCapability(PlayerCapabilityProvider.TEMPO).ifPresent(tempoCap -> {
int tempo = tempoCap.getTempo();
applyTempoToManaRegen(player, tempo);
});
}
public static void applyTempoToManaRegen(Player player, int tempo) {
Attribute manaRegenAttr = (Attribute) AttributeRegistry.MANA_REGEN.get();
if (manaRegenAttr == null) return;
AttributeInstance inst = player.getAttribute(manaRegenAttr);
if (inst == null) return;
inst.removeModifier(TEMPO_MANA_REGEN_UUID);
if (tempo <= 0) {
return;
}
double bonusPercent = (double) tempo / TEMPO_PER_PERCENT;
double multiplier = bonusPercent / 100.0;
inst.addTransientModifier(new AttributeModifier(
TEMPO_MANA_REGEN_UUID,
"MindMotion Tempo mana regen",
multiplier,
AttributeModifier.Operation.MULTIPLY_BASE
));
}
}