mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-22 04:52:25 +00:00
Ensure gasses are registered in preinit or init (prevent textures not being set)
This commit is contained in:
1 parent
64b2e421f7
commit
f4bbb5b35c
2 files changed
+15
-1
No files matched your search
@@ -9,13 +9,18 @@ public class GasRegistry
|
||||
{
|
||||
private static ArrayList<Gas> registeredGasses = new ArrayList<>();
|
||||
|
||||
private static boolean initFinished = false;
|
||||
|
||||
/**
|
||||
* Register a new gas into GasRegistry.
|
||||
* Register a new gas into GasRegistry. Call this BEFORE post-init.
|
||||
* @param gas - Gas to register
|
||||
* @return the gas that has been registered, pulled right out of GasRegistry
|
||||
*/
|
||||
public static Gas register(Gas gas)
|
||||
{
|
||||
if (initFinished){
|
||||
throw new IllegalStateException("Gasses must be registered before postInit.");
|
||||
}
|
||||
if(gas == null)
|
||||
{
|
||||
return null;
|
||||
@@ -110,4 +115,11 @@ public class GasRegistry
|
||||
|
||||
return registeredGasses.indexOf(gas);
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal use only, don't call this.
|
||||
*/
|
||||
public static void postInit(){
|
||||
initFinished = true;
|
||||
}
|
||||
}
|
||||
@@ -834,6 +834,8 @@ public class Mekanism
|
||||
MinecraftForge.EVENT_BUS.post(new BoxBlacklistEvent());
|
||||
|
||||
logger.info("Hooking complete.");
|
||||
|
||||
GasRegistry.postInit();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
Reference in new issue
Block a user