Stores all of BuildCraft's blocks, from all of its modules. If any of them have been disabled by the user (or it the module is not installed) then they will be null. This is the equivalent of Blocks
| 13 | /** Stores all of BuildCraft's blocks, from all of its modules. If any of them have been disabled by the user (or it the |
| 14 | * module is not installed) then they will be null. This is the equivalent of {@link Blocks} */ |
| 15 | public class BCBlocks { |
| 16 | private static final boolean DEBUG = BCDebugging.shouldDebugLog("api.blocks"); |
| 17 | |
| 18 | // BC Core |
| 19 | public static final Block coreDecorated; |
| 20 | public static final Block coreEngineRedstone; |
| 21 | public static final Block CORE_MARKER_VOLUME; |
| 22 | public static final Block CORE_MARKER_PATH; |
| 23 | |
| 24 | // BC Builders |
| 25 | |
| 26 | // BC Energy |
| 27 | public static final Block energyEngineStirling; |
| 28 | public static final Block energyEngineCombustion; |
| 29 | public static final Block energyEngineCreative; |
| 30 | |
| 31 | // BC Factory |
| 32 | |
| 33 | // BC Robotics |
| 34 | |
| 35 | // BC Silicon |
| 36 | |
| 37 | // BC Transport |
| 38 | |
| 39 | static { |
| 40 | if (!Loader.instance().hasReachedState(LoaderState.INITIALIZATION)) { |
| 41 | throw new RuntimeException("Accessed BC blocks too early! You can only use them from init onwards!"); |
| 42 | } |
| 43 | String core = "core"; |
| 44 | coreDecorated = getRegisteredBlock(core, "decorated"); |
| 45 | coreEngineRedstone = getRegisteredBlock(core, "engine_redstone"); |
| 46 | CORE_MARKER_VOLUME = getRegisteredBlock(core, "marker_volume"); |
| 47 | CORE_MARKER_PATH = getRegisteredBlock(core, "marker_path"); |
| 48 | |
| 49 | String energy = "energy"; |
| 50 | energyEngineStirling = getRegisteredBlock(energy, "engine_stirling"); |
| 51 | energyEngineCombustion = getRegisteredBlock(energy, "engine_combustion"); |
| 52 | energyEngineCreative = getRegisteredBlock(energy, "engine_creative"); |
| 53 | } |
| 54 | |
| 55 | private static Block getRegisteredBlock(String module, String regName) { |
| 56 | String modid = "buildcraft" + module; |
| 57 | Block block = Block.REGISTRY.getObject(new ResourceLocation(modid, regName)); |
| 58 | |
| 59 | if (block != Blocks.AIR) { |
| 60 | if (DEBUG) { |
| 61 | BCLog.logger.info("[api.blocks] Found the block " + regName + " from the module " + module); |
| 62 | } |
| 63 | return block; |
| 64 | } |
| 65 | if (DEBUG) { |
| 66 | if (Loader.isModLoaded(modid)) { |
| 67 | BCLog.logger.info("[api.blocks] Did not find the block " + regName + " dispite the appropriate mod being loaded (" + modid + ")"); |
| 68 | } else { |
| 69 | BCLog.logger.info("[api.blocks] Did not find the block " + regName + " probably because the mod is not loaded (" + modid + ")"); |
| 70 | } |
| 71 | } |
| 72 | return null; |
nothing calls this directly
no test coverage detected