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

Split up GT5u and GT6 checks #24

Merged
merged 1 commit into from
Jan 3, 2025
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
18 changes: 16 additions & 2 deletions src/main/java/com/cleanroommc/bogosorter/compat/loader/Mods.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import cpw.mods.fml.common.Loader;

import java.util.function.Supplier;

public enum Mods {

EnderStorage("EnderStorage"),
Expand All @@ -10,23 +12,35 @@ public enum Mods {
CookingForBlockheads("cookingforblockheads"),
Ae2("appliedenergistics2"),
Forestry("Forestry"),
GT5u("gregtech"),
GT5u(() -> Loader.isModLoaded("gregtech") && !Loader.isModLoaded("gregapi")),
GT6(() -> Loader.isModLoaded("gregtech") && Loader.isModLoaded("gregapi")),
Backpack("Backpack"),
GalacticraftCore("galacticraftcore"),
AdventureBackpack2("adventurebackpack"),
ProjectE("ProjectE"),
Tconstruct("TConstruct"),;

public final String modid;
private final Supplier<Boolean> supplier;
private Boolean loaded;

Mods(String modid) {
this.modid = modid;
this.supplier = null;
}
Mods(Supplier<Boolean> supplier) {
this.supplier = supplier;
this.modid = null;

}

public boolean isLoaded() {
if (loaded == null) {
loaded = Loader.isModLoaded(modid);
if (supplier != null){
loaded = supplier.get();
}else if (modid != null) {
loaded = Loader.isModLoaded(modid);
} else loaded = false;
}
return loaded;
}
Expand Down