Only use GTNH CT APIs when GTNH CraftTweaker is present (#46)

* Update buildscript&dependencies

* Only use GTNH CT APIs when GTNH CraftTweaker is present

* Clean up post-rfg migration

* Add warning to the log
This commit is contained in:
Raven Szewczyk authored and GitHub committed 2023-07-04 22:11:37 +01:00
1 parent 480e168dc8
commit 581d497c9b
7 files changed
+85 -56

No files matched your search

@@ -300,7 +300,7 @@ import thaumcraft.api.aspects.AspectList;
@Mod(
modid = "AWWayofTime",
name = "AlchemicalWizardry",
version = "GRADLETOKEN_VERSION",
version = Tags.VERSION,
dependencies = "after:CodeChickenLib@[1.1.5.7,);" + "after:NotEnoughItems@[2.3.20-GTNH,)",
guiFactory = "WayofTime.alchemicalWizardry.client.gui.ConfigGuiFactory")
public class AlchemicalWizardry {
@@ -1,7 +1,13 @@
package WayofTime.alchemicalWizardry.common.tweaker;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.versioning.ArtifactVersion;
import cpw.mods.fml.common.versioning.InvalidVersionSpecificationException;
import cpw.mods.fml.common.versioning.VersionRange;
import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI;
import minetweaker.mc1710.MineTweakerMod;
import minetweaker.util.IEventHandler;
/**
@@ -17,8 +23,27 @@ public class MineTweakerIntegration {
MineTweakerAPI.registerClass(FallingTower.class);
MineTweakerAPI.registerClass(HarvestMoon.class);
MineTweakerImplementationAPI.onRollbackEvent(new HandleLateAdditionsAndRemovals());
MineTweakerImplementationAPI.onPostReload(new HandleLateAdditionsAndRemovals());
// GTNH-Only features (post 3.1.0)
final ArtifactVersion mtVersion = Loader.instance().getIndexedModList().get(MineTweakerMod.MODID)
.getProcessedVersion();
try {
if (VersionRange.createFromVersionSpec("[3.2.4,)").containsVersion(mtVersion)) {
GTNHIntegration.register();
} else {
AlchemicalWizardry.logger.warn(
"Non-GTNH MineTweaker (CraftTweaker) version detected, late recipe additions and removals won't work correctly");
}
} catch (InvalidVersionSpecificationException e) {
throw new RuntimeException(e);
}
}
public static class GTNHIntegration {
public static void register() {
MineTweakerImplementationAPI.onRollbackEvent(new HandleLateAdditionsAndRemovals());
}
}
public static class HandleLateAdditionsAndRemovals