MCPcopy Create free account
hub / github.com/BuildCraft/BuildCraft / BCModules

Enum BCModules

common/buildcraft/api/BCModules.java:10–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8import buildcraft.api.core.BCLog;
9
10public enum BCModules {
11 // Base module for all BC. Includes LIB
12 CORE,
13 // Potentially optional modules for adding more BC functionality
14 BUILDERS,
15 ENERGY,
16 FACTORY,
17 ROBOTICS,
18 SILICON,
19 TRANSPORT,
20 // Optional module for compatibility with other mods
21 COMPAT;
22
23 public static final BCModules[] VALUES = values();
24
25 private static final String MODID_START = "buildcraft";
26 private final String modid, part;
27
28 private BCModules() {
29 part = name().toLowerCase(Locale.ROOT);
30 this.modid = MODID_START + part;
31 }
32
33 public static void fmlPreInit() {}
34
35 public static boolean isBcMod(String modid) {
36 if (!modid.startsWith(MODID_START)) return false;
37 String post = modid.substring(MODID_START.length());
38 for (BCModules module : VALUES) {
39 if (post.equals(module.part)) {
40 return true;
41 }
42 }
43 return false;
44 }
45
46 public boolean isLoaded() {
47 return Loader.isModLoaded(modid);
48 }
49
50 public String getModId() {
51 return modid;
52 }
53
54 static {
55 if (!Loader.instance().hasReachedState(LoaderState.CONSTRUCTING)) {
56 throw new RuntimeException("Accessed BC modules too early! You can only use them from construction onwards!");
57 }
58 for (BCModules module : values()) {
59 if (module.isLoaded()) {
60 BCLog.logger.info("[module-api] Module " + module.name().toLowerCase(Locale.ROOT) + " is loaded!");
61 }
62 }
63 }
64}

Callers

nothing calls this directly

Calls 2

isLoadedMethod · 0.80
nameMethod · 0.80

Tested by

no test coverage detected