diff --git a/fml/.classpath b/fml/.classpath index d48aef650..55afa91d8 100644 --- a/fml/.classpath +++ b/fml/.classpath @@ -1,9 +1,9 @@ + - diff --git a/fml/common/fml/Loader.java b/fml/common/fml/Loader.java index 2899a90b0..b6c20fa32 100644 --- a/fml/common/fml/Loader.java +++ b/fml/common/fml/Loader.java @@ -34,39 +34,44 @@ import java.util.zip.ZipFile; import net.minecraft.src.BaseMod; import fml.ml.ModLoaderModContainer; -public enum Loader { - INSTANCE; +public class Loader { private enum State { NOINIT, LOADING, PREINIT, INIT, POSTINIT, UP, ERRORED }; - private static State state; + private static Loader instance; private static Logger LOG = Logger.getLogger("ForgeModLoader.Loader"); - private static List mods; - - private static Map namedMods; - - private static ModClassLoader modClassLoader; - private static Pattern zipJar = Pattern.compile("([^\\s]+).(zip|jar)$"); private static Pattern modClass = Pattern.compile("(.*/)(mod\\_[^\\s]+).class$"); - public static void run() { - LOG.setLevel(Level.ALL); + private static int major=Integer.parseInt("@MAJOR@"); + private static int minor=Integer.parseInt("@MINOR@"); + private static int rev =Integer.parseInt("@REV@"); + private static int build=Integer.parseInt("@BUILD@"); + private static String mcversion="@MCVERSION@"; + + private State state; + private ModClassLoader modClassLoader; + private List mods; + private Map namedMods; + + public static Loader instance() { + return instance; + } + private Loader() { + Loader.LOG.setLevel(Level.ALL); FileHandler fileHandler; try { fileHandler = new FileHandler("ForgeModLoader-%g.log", 0, 3); System.setProperty("java.util.logging.SimpleFormatter.format", "%1$tc %2$s%n%4$s: %5$s%6$s%n"); fileHandler.setFormatter(new SimpleFormatter()); fileHandler.setLevel(Level.ALL); - LOG.addHandler(fileHandler); + Loader.LOG.addHandler(fileHandler); } catch (Exception e) { // Whatever - give up } - } - - private Loader() { + LOG.info(String.format("Forge ModLoader version %d.%d.%d.%d for Minecraft %s loading.",major,minor,rev,build,mcversion)); } private void sortModList() { @@ -228,7 +233,7 @@ public enum Loader { } public static List getModList() { - return mods; + return instance().mods; } public void loadMods() { @@ -245,5 +250,6 @@ public enum Loader { modInit(); postModInit(); state = State.UP; + LOG.info("Forge Mod Loader load complete"); } } diff --git a/fml/server/fml/obf/FMLHandler.java b/fml/server/fml/obf/FMLHandler.java index 53439abb1..492ba3ccf 100644 --- a/fml/server/fml/obf/FMLHandler.java +++ b/fml/server/fml/obf/FMLHandler.java @@ -23,11 +23,11 @@ public enum FMLHandler { public void onPreLoad(MinecraftServer minecraftServer) { INSTANCE.server=minecraftServer; - Loader.INSTANCE.loadMods(); + Loader.instance().loadMods(); } public void onLoadComplete() { - Loader.INSTANCE.initializeMods(); + Loader.instance().initializeMods(); } public void onPreTick() { diff --git a/fml/test/fml/test/LoaderTests.java b/fml/test/fml/test/LoaderTests.java index 3f21cb733..f961ee6d0 100644 --- a/fml/test/fml/test/LoaderTests.java +++ b/fml/test/fml/test/LoaderTests.java @@ -31,6 +31,6 @@ public class LoaderTests { @Test public void testModLoading() { - Loader.run(); + Loader.instance().loadMods(); } }