diff options
Diffstat (limited to 'src/main/java/bloodasp/galacticgreg/GalacticGreg.java')
-rw-r--r-- | src/main/java/bloodasp/galacticgreg/GalacticGreg.java | 228 |
1 files changed, 124 insertions, 104 deletions
diff --git a/src/main/java/bloodasp/galacticgreg/GalacticGreg.java b/src/main/java/bloodasp/galacticgreg/GalacticGreg.java index 555f7e7eba..570fbadbee 100644 --- a/src/main/java/bloodasp/galacticgreg/GalacticGreg.java +++ b/src/main/java/bloodasp/galacticgreg/GalacticGreg.java @@ -1,5 +1,9 @@ package bloodasp.galacticgreg; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + import bloodasp.galacticgreg.auxiliary.GalacticGregConfig; import bloodasp.galacticgreg.auxiliary.LogHelper; import bloodasp.galacticgreg.auxiliary.ProfilingStorage; @@ -18,109 +22,125 @@ import cpw.mods.fml.common.event.FMLServerStartingEvent; import gregtech.api.GregTech_API; import gregtech.api.world.GT_Worldgen; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -@Mod(modid = GalacticGreg.MODID, name = GalacticGreg.MODNAME, version = GalacticGreg.VERSION, dependencies = "required-after:GalacticraftCore; required-after:gregtech@5.09.32.30;", acceptableRemoteVersions="*") +@Mod( + modid = GalacticGreg.MODID, + name = GalacticGreg.MODNAME, + version = GalacticGreg.VERSION, + dependencies = "required-after:GalacticraftCore; required-after:gregtech@5.09.32.30;", + acceptableRemoteVersions = "*") public class GalacticGreg { - public static final List<GT_Worldgen> smallOreWorldgenList = new ArrayList<>(); - public static final List<GT_Worldgen> oreVeinWorldgenList = new ArrayList<>(); - - public static final String NICE_MODID = "GalacticGreg"; - public static final String MODID = "galacticgreg"; - public static final String MODNAME= "Galactic Greg"; - - public static final String VERSION = "GRADLETOKEN_VERSION"; - - public static final LogHelper Logger = new LogHelper(NICE_MODID); - public static ProfilingStorage Profiler = new ProfilingStorage(); - public static SpaceSchematicHandler SchematicHandler; - - public static Random GalacticRandom = null; - - public static GalacticGregConfig GalacticConfig = null; - - /** - * Preload phase. Read config values and set various features.. n stuff... - * @param aEvent - */ - @EventHandler - public void onPreLoad(FMLPreInitializationEvent aEvent) { - GalacticConfig = new GalacticGregConfig(aEvent.getModConfigurationDirectory(), NICE_MODID, NICE_MODID); - if (!GalacticConfig.LoadConfig()) - GalacticGreg.Logger.warn("Something went wrong while reading GalacticGregs config file. Things will be wonky.."); - - GalacticRandom = new Random(System.currentTimeMillis()); - - if (GalacticConfig.SchematicsEnabled) - SchematicHandler = new SpaceSchematicHandler(aEvent.getModConfigurationDirectory()); - - Logger.trace("Leaving PRELOAD"); - } - -// @EventHandler -// public void onLoad(FMLInitializationEvent event){ -// GalacticGregRegistry.registerModContainer(ModRegisterer.Setup_GalactiCraftCore()); -// } - - public static final ArrayList<Runnable> ADDITIONALVEINREGISTER = new ArrayList<>(); - - /** - * Postload phase. Mods can add their custom definition to our api in their own PreLoad or Init-phase - * Once GalacticGregRegistry.InitRegistry() is called, no changes are accepted. - * (Well you can with reflection, but on a "normal" way it's not possible) - * @param aEvent - */ - @EventHandler - public void onPostLoad(FMLPostInitializationEvent aEvent) { - Logger.trace("Entering POSTLOAD"); - - if (!GalacticGregRegistry.InitRegistry()) - throw new RuntimeException("GalacticGreg registry has been finalized from a 3rd-party mod, this is forbidden!"); - - //new WorldGenGaGT().run(); DO NOT UNCOMMENT, was moved to gregtech.loaders.postload.GT_Worldgenloader - - if (Loader.isModLoaded("bartworks")) { - for (int f = 0, j = GregTech_API.sWorldgenFile.get("worldgen.GaGregBartworks", "AmountOfCustomLargeVeinSlots", 0); f < j; f++) { - new BW_Worldgen_Ore_Layer_Space("mix.custom." + (f < 10 ? "0" : "") + f, GregTech_API.sWorldgenFile.get("worldgen.GaGregBartworks." + "mix.custom." + (f < 10 ? "0" : "") + f, "Enabled", false)); - } - - for (int f = 0, j = GregTech_API.sWorldgenFile.get("worldgen.GaGregBartworks", "AmountOfCustomSmallSlots", 0); f < j; f++) { - new BW_Worldgen_Ore_SmallOre_Space("small.custom." + (f < 10 ? "0" : "") + f, GregTech_API.sWorldgenFile.get("worldgen.GaGregBartworks." + "small.custom." + (f < 10 ? "0" : "") + f, "Enabled", false)); - } - } - - for (Runnable r : ADDITIONALVEINREGISTER){ - try{ - r.run(); - }catch (Exception e){ - e.printStackTrace(); - } - } - - GalacticConfig.serverPostInit(); - - - - Logger.trace("Leaving POSTLOAD"); - } - - /** - * If oregen profiling is enabled, then register the command - * @param pEvent - */ - @EventHandler - public void serverLoad(FMLServerStartingEvent pEvent) - { - Logger.trace("Entering SERVERLOAD"); - - if (GalacticConfig.ProfileOreGen) - pEvent.registerServerCommand(new ProfilingCommand()); - - if (Loader.isModLoaded("appliedenergistics2") && GalacticConfig.EnableAEExportCommand && GalacticConfig.SchematicsEnabled) - pEvent.registerServerCommand(new AEStorageCommand()); - - Logger.trace("Leaving SERVERLOAD"); - } + + public static final List<GT_Worldgen> smallOreWorldgenList = new ArrayList<>(); + public static final List<GT_Worldgen> oreVeinWorldgenList = new ArrayList<>(); + + public static final String NICE_MODID = "GalacticGreg"; + public static final String MODID = "galacticgreg"; + public static final String MODNAME = "Galactic Greg"; + + public static final String VERSION = "GRADLETOKEN_VERSION"; + + public static final LogHelper Logger = new LogHelper(NICE_MODID); + public static ProfilingStorage Profiler = new ProfilingStorage(); + public static SpaceSchematicHandler SchematicHandler; + + public static Random GalacticRandom = null; + + public static GalacticGregConfig GalacticConfig = null; + + /** + * Preload phase. Read config values and set various features.. n stuff... + * + * @param aEvent + */ + @EventHandler + public void onPreLoad(FMLPreInitializationEvent aEvent) { + GalacticConfig = new GalacticGregConfig(aEvent.getModConfigurationDirectory(), NICE_MODID, NICE_MODID); + if (!GalacticConfig.LoadConfig()) GalacticGreg.Logger + .warn("Something went wrong while reading GalacticGregs config file. Things will be wonky.."); + + GalacticRandom = new Random(System.currentTimeMillis()); + + if (GalacticConfig.SchematicsEnabled) + SchematicHandler = new SpaceSchematicHandler(aEvent.getModConfigurationDirectory()); + + Logger.trace("Leaving PRELOAD"); + } + + // @EventHandler + // public void onLoad(FMLInitializationEvent event){ + // GalacticGregRegistry.registerModContainer(ModRegisterer.Setup_GalactiCraftCore()); + // } + + public static final ArrayList<Runnable> ADDITIONALVEINREGISTER = new ArrayList<>(); + + /** + * Postload phase. Mods can add their custom definition to our api in their own PreLoad or Init-phase Once + * GalacticGregRegistry.InitRegistry() is called, no changes are accepted. (Well you can with reflection, but on a + * "normal" way it's not possible) + * + * @param aEvent + */ + @EventHandler + public void onPostLoad(FMLPostInitializationEvent aEvent) { + Logger.trace("Entering POSTLOAD"); + + if (!GalacticGregRegistry.InitRegistry()) throw new RuntimeException( + "GalacticGreg registry has been finalized from a 3rd-party mod, this is forbidden!"); + + // new WorldGenGaGT().run(); DO NOT UNCOMMENT, was moved to gregtech.loaders.postload.GT_Worldgenloader + + if (Loader.isModLoaded("bartworks")) { + for (int f = 0, + j = GregTech_API.sWorldgenFile.get("worldgen.GaGregBartworks", "AmountOfCustomLargeVeinSlots", 0); f + < j; f++) { + new BW_Worldgen_Ore_Layer_Space( + "mix.custom." + (f < 10 ? "0" : "") + f, + GregTech_API.sWorldgenFile.get( + "worldgen.GaGregBartworks." + "mix.custom." + (f < 10 ? "0" : "") + f, + "Enabled", + false)); + } + + for (int f = 0, + j = GregTech_API.sWorldgenFile.get("worldgen.GaGregBartworks", "AmountOfCustomSmallSlots", 0); f + < j; f++) { + new BW_Worldgen_Ore_SmallOre_Space( + "small.custom." + (f < 10 ? "0" : "") + f, + GregTech_API.sWorldgenFile.get( + "worldgen.GaGregBartworks." + "small.custom." + (f < 10 ? "0" : "") + f, + "Enabled", + false)); + } + } + + for (Runnable r : ADDITIONALVEINREGISTER) { + try { + r.run(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + GalacticConfig.serverPostInit(); + + Logger.trace("Leaving POSTLOAD"); + } + + /** + * If oregen profiling is enabled, then register the command + * + * @param pEvent + */ + @EventHandler + public void serverLoad(FMLServerStartingEvent pEvent) { + Logger.trace("Entering SERVERLOAD"); + + if (GalacticConfig.ProfileOreGen) pEvent.registerServerCommand(new ProfilingCommand()); + + if (Loader.isModLoaded("appliedenergistics2") && GalacticConfig.EnableAEExportCommand + && GalacticConfig.SchematicsEnabled) + pEvent.registerServerCommand(new AEStorageCommand()); + + Logger.trace("Leaving SERVERLOAD"); + } } |