Merge pull request #1 from Fretuks/make-iron-spellbooks-optional

Handle Iron's Spellbooks compat optionally
This commit is contained in:
2026-01-05 17:44:57 +01:00
committed by GitHub
2 changed files with 190 additions and 186 deletions
-1
View File
@@ -139,7 +139,6 @@ dependencies {
// Iron's Spellbooks API only // Iron's Spellbooks API only
compileOnly fg.deobf("io.redspace.ironsspellbooks:irons_spellbooks:${irons_spells_version}:api") compileOnly fg.deobf("io.redspace.ironsspellbooks:irons_spellbooks:${irons_spells_version}:api")
implementation fg.deobf("io.redspace.ironsspellbooks:irons_spellbooks:${irons_spells_version}")
// GECKOLIB — deobfuscated, full mod // GECKOLIB — deobfuscated, full mod
implementation fg.deobf("software.bernie.geckolib:geckolib-forge-${geckolib_version}") implementation fg.deobf("software.bernie.geckolib:geckolib-forge-${geckolib_version}")
@@ -56,14 +56,18 @@ public class IronsSpellbooksCompat {
int magicScaling = stats.getAttributeLevel("magic_scaling"); int magicScaling = stats.getAttributeLevel("magic_scaling");
int willpower = stats.getAttributeLevel("willpower"); int willpower = stats.getAttributeLevel("willpower");
applyIntelligence(player, intelligence); Loaded.applyIntelligence(player, intelligence);
applyCharisma(player, charisma); Loaded.applyCharisma(player, charisma);
applyMagicScaling(player, magicScaling); Loaded.applyMagicScaling(player, magicScaling);
applyWillpowerCastEfficiency(player, willpower); Loaded.applyWillpowerCastEfficiency(player, willpower);
}); });
} }
public static void applyIntelligence(Player player, int intelligence) { private static final class Loaded {
private Loaded() {
}
private static void applyIntelligence(Player player, int intelligence) {
if (intelligence <= 0) { if (intelligence <= 0) {
clearIntelligence(player); clearIntelligence(player);
return; return;
@@ -92,7 +96,7 @@ public class IronsSpellbooksCompat {
removeModifier(player, (Attribute) AttributeRegistry.MANA_REGEN.get(), INT_MANA_REGEN_UUID); removeModifier(player, (Attribute) AttributeRegistry.MANA_REGEN.get(), INT_MANA_REGEN_UUID);
} }
public static void applyWillpowerCastEfficiency(Player player, int willpower) { private static void applyWillpowerCastEfficiency(Player player, int willpower) {
clearWillpower(player); clearWillpower(player);
if (willpower <= 0) { if (willpower <= 0) {
return; return;
@@ -125,7 +129,7 @@ public class IronsSpellbooksCompat {
removeModifier(player, attr, WILL_MANA_COST_UUID); removeModifier(player, attr, WILL_MANA_COST_UUID);
} }
public static void applyCharisma(Player player, int charisma) { private static void applyCharisma(Player player, int charisma) {
clearCharisma(player); clearCharisma(player);
if (charisma <= 0) { if (charisma <= 0) {
return; return;
@@ -194,7 +198,7 @@ public class IronsSpellbooksCompat {
} }
} }
public static void applyMagicScaling(Player player, int magicScaling) { private static void applyMagicScaling(Player player, int magicScaling) {
if (magicScaling <= 0) { if (magicScaling <= 0) {
clearMagicScaling(player); clearMagicScaling(player);
return; return;
@@ -263,4 +267,5 @@ public class IronsSpellbooksCompat {
inst.removeModifier(id); inst.removeModifier(id);
} }
} }
}
} }