Skip to content

Commit

Permalink
Split up GT5u and GT6 checks (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
Caedis authored Jan 3, 2025
1 parent a7bae97 commit c628b1b
Showing 1 changed file with 16 additions and 2 deletions.
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

0 comments on commit c628b1b

Please sign in to comment.