aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/bloodasp/galacticgreg/GalacticGreg.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/bloodasp/galacticgreg/GalacticGreg.java')
-rw-r--r--src/main/java/bloodasp/galacticgreg/GalacticGreg.java111
1 files changed, 111 insertions, 0 deletions
diff --git a/src/main/java/bloodasp/galacticgreg/GalacticGreg.java b/src/main/java/bloodasp/galacticgreg/GalacticGreg.java
new file mode 100644
index 0000000000..02f45a1187
--- /dev/null
+++ b/src/main/java/bloodasp/galacticgreg/GalacticGreg.java
@@ -0,0 +1,111 @@
+package bloodasp.galacticgreg;
+
+import gregtech.api.GregTech_API;
+
+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;
+import bloodasp.galacticgreg.command.AEStorageCommand;
+import bloodasp.galacticgreg.command.ProfilingCommand;
+import bloodasp.galacticgreg.registry.GalacticGregRegistry;
+import bloodasp.galacticgreg.schematics.SpaceSchematic;
+import bloodasp.galacticgreg.schematics.SpaceSchematicFactory;
+import bloodasp.galacticgreg.schematics.SpaceSchematicHandler;
+import cpw.mods.fml.common.Loader;
+import cpw.mods.fml.common.Mod;
+import cpw.mods.fml.common.Mod.EventHandler;
+import cpw.mods.fml.common.event.FMLPostInitializationEvent;
+import cpw.mods.fml.common.event.FMLPreInitializationEvent;
+import cpw.mods.fml.common.event.FMLServerStartingEvent;
+
+@Mod(modid = GalacticGreg.MODID, version = GalacticGreg.VERSION, dependencies = "required-after:GalacticraftCore; required-after:gregtech;", acceptableRemoteVersions="*")
+public class GalacticGreg {
+ public static final List<GT_Worldgen_GT_Ore_SmallPieces_Space> smallOreWorldgenList = new ArrayList();
+ public static final List<GT_Worldgen_GT_Ore_Layer_Space> oreVeinWorldgenList = new ArrayList();
+
+ public static final String NICE_MODID = "GalacticGreg";
+ public static final String MODID = "galacticgreg";
+
+ 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..");
+
+ if (GalacticConfig.ProperConfigured)
+ {
+ GalacticRandom = new Random(System.currentTimeMillis());
+
+ if (GalacticConfig.SchematicsEnabled)
+ SchematicHandler = new SpaceSchematicHandler(aEvent.getModConfigurationDirectory());
+ }
+ else
+ GalacticGreg.Logger.error("GalacticGreg will NOT continue to load. Please read the warnings and configure your config file!");
+
+ Logger.trace("Leaving PRELOAD");
+ }
+
+ /**
+ * 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 (GalacticConfig.ProperConfigured)
+ {
+ ModRegisterer atc = new ModRegisterer();
+ if (atc.Init())
+ atc.Register();
+
+ if (!GalacticGregRegistry.InitRegistry())
+ throw new RuntimeException("GalacticGreg registry has been finalized from a 3rd-party mod, this is forbidden!");
+
+ new WorldGenGaGT().run();
+
+ GalacticConfig.serverPostInit();
+ }
+ else
+ GalacticGreg.Logger.error("GalacticGreg will NOT continue to load. Please read the warnings and configure your config file!");
+ 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.ProperConfigured)
+ {
+ if (GalacticConfig.ProfileOreGen)
+ pEvent.registerServerCommand(new ProfilingCommand());
+
+ if (Loader.isModLoaded("appliedenergistics2") && GalacticConfig.EnableAEExportCommand && GalacticConfig.SchematicsEnabled)
+ pEvent.registerServerCommand(new AEStorageCommand());
+ }
+ Logger.trace("Leaving SERVERLOAD");
+ }
+}