Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix obsolete mod detection checked by class #363

Merged
merged 1 commit into from
Jan 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -117,29 +117,26 @@ public static List<String> obsoleteModsMessage()
if (Loader.isModLoaded("unloader") && UTConfigTweaks.WORLD.DIMENSION_UNLOAD.utUnloaderToggle) messages.add("Unloader");
if (Loader.isModLoaded("villagermantlefix") && UTConfigBugfixes.ENTITIES.utVillagerMantleToggle) messages.add("Villager Mantle Fix");
if (Loader.isModLoaded("watercontrolextreme") && UTConfigTweaks.BLOCKS.FINITE_WATER.utFiniteWaterToggle) messages.add("Water Control Extreme");
try
{
Class.forName("com.chocohead.biab.BornInABarn");
messages.add("Born in a Barn");
if (UTConfigBugfixes.MISC.utLocaleToggle)
{
Class.forName("io.github.jikuja.LocaleTweaker");
messages.add("LocaleFixer");
}
if (UTConfigTweaks.BLOCKS.utBlockHitDelay != 5)
{
Class.forName("com.cleanroommc.blockdelayremover.BlockDelayRemoverCore");
messages.add("Block Delay Remover");
}
if (UTConfigTweaks.WORLD.CHUNK_GEN_LIMIT.utChunkGenLimitToggle)
{
Class.forName("io.github.barteks2x.chunkgenlimiter.ChunkGenLimitMod");
messages.add("Chunk Generation Limiter");
}
}
catch (ClassNotFoundException ignored) {}
// Mods checked by class
if (isClassLoaded("com.chocohead.biab.BornInABarn")) messages.add("Born in a Barn");
if (isClassLoaded("io.github.jikuja.LocaleTweaker") && UTConfigBugfixes.MISC.utLocaleToggle) messages.add("LocaleFixer");
if (isClassLoaded("com.cleanroommc.blockdelayremover.BlockDelayRemoverCore") && UTConfigTweaks.BLOCKS.utBlockHitDelay != 5) messages.add("Block Delay Remover");
if (isClassLoaded("io.github.barteks2x.chunkgenlimiter.ChunkGenLimitMod") && UTConfigTweaks.WORLD.CHUNK_GEN_LIMIT.utChunkGenLimitToggle) messages.add("Chunk Generation Limiter");
messages.add("");
messages.add(new TextComponentTranslation("msg.universaltweaks.obsoletemods.warning3").getFormattedText());
return messages;
}

private static boolean isClassLoaded(String className)
{
try
{
Class.forName(className);
return true;
}
catch (ClassNotFoundException ignored)
{
return false;
}
}
}