Ensure gasses are registered in preinit or init (prevent textures not being set)

This commit is contained in:
Xander Victory committed 2017-11-08 11:49:00 +08:00
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