diff --git a/build.xml b/build.xml
index cbd0313427..803874f7db 100644
--- a/build.xml
+++ b/build.xml
@@ -23,6 +23,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -30,14 +52,17 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -105,15 +130,6 @@
-
-
-
-
-
-
-
-
-
@@ -135,6 +151,7 @@
+
@@ -163,37 +180,8 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/common/cpw/mods/fml/common/FMLModContainer.java b/common/cpw/mods/fml/common/FMLModContainer.java
index 2c4311745b..c3ae2304c0 100644
--- a/common/cpw/mods/fml/common/FMLModContainer.java
+++ b/common/cpw/mods/fml/common/FMLModContainer.java
@@ -91,6 +91,25 @@ public class FMLModContainer implements ModContainer
return null;
}
+ @Override
+ public ModState getModState()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void nextState()
+ {
+ // TODO Auto-generated method stub
+
+ }
+ @Override
+ public String getSortingRules()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
@Override
public void tickStart(TickType type, Object ... data)
{
diff --git a/common/cpw/mods/fml/common/Loader.java b/common/cpw/mods/fml/common/Loader.java
index bb18b5a1b1..89f222c644 100644
--- a/common/cpw/mods/fml/common/Loader.java
+++ b/common/cpw/mods/fml/common/Loader.java
@@ -16,6 +16,7 @@ package cpw.mods.fml.common;
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
+import java.io.InputStream;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Arrays;
@@ -23,6 +24,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
import java.util.logging.ConsoleHandler;
import java.util.logging.FileHandler;
import java.util.logging.Level;
@@ -85,11 +87,11 @@ public class Loader
/**
* Build information for tracking purposes.
*/
- private static String major = "@MAJOR@";
- private static String minor = "@MINOR@";
- private static String rev = "@REV@";
- private static String build = "@BUILD@";
- private static String mcversion = "@MCVERSION@";
+ private static String major;
+ private static String minor;
+ private static String rev;
+ private static String build;
+ private static String mcversion;
/**
* The {@link State} of the loader
@@ -142,7 +144,8 @@ public class Loader
Loader.log.setLevel(Level.ALL);
try
{
- FileHandler fileHandler = new FileHandler("ForgeModLoader-%g.log", 0, 3);
+ File logPath=new File(FMLCommonHandler.instance().getMinecraftRootDirectory().getCanonicalPath(),"ForgeModLoader-%g.log");
+ FileHandler fileHandler = new FileHandler(logPath.getPath(), 0, 3);
// We're stealing minecraft's log formatter
fileHandler.setFormatter(new FMLLogFormatter());
fileHandler.setLevel(Level.ALL);
@@ -152,6 +155,22 @@ public class Loader
{
// Whatever - give up
}
+ InputStream stream = Loader.class.getClassLoader().getResourceAsStream("fmlversion.properties");
+ Properties properties = new Properties();
+
+ if (stream != null) {
+ try {
+ properties.load(stream);
+ major = properties.getProperty("fmlbuild.major.number");
+ minor = properties.getProperty("fmlbuild.minor.number");
+ rev = properties.getProperty("fmlbuild.revision.number");
+ build = properties.getProperty("fmlbuild.build.number");
+ mcversion = properties.getProperty("fmlbuild.mcversion");
+ } catch (IOException ex) {
+ Loader.log.log(Level.SEVERE,"Could not get FML version information - corrupted installation detected!", ex);
+ throw new LoaderException(ex);
+ }
+ }
log.info(String.format("Forge Mod Loader version %s.%s.%s.%s for Minecraft %s loading", major, minor, rev, build, mcversion));
}
@@ -185,7 +204,7 @@ public class Loader
log.fine("Sorted mod list:");
for (ModContainer mod : mods)
{
- log.fine(String.format(" %s: %s", mod.getName(), mod.getSource().getName()));
+ log.fine(String.format("\t%s: %s (%s)", mod.getName(), mod.getSource().getName(), mod.getSortingRules()));
}
}
catch (IllegalArgumentException iae)
@@ -213,6 +232,7 @@ public class Loader
mod.preInit();
namedMods.put(mod.getName(), mod);
}
+ mod.nextState();
}
log.fine("Mod pre-initialization complete");
@@ -230,6 +250,7 @@ public class Loader
{
log.finer(String.format("Initializing %s", mod.getName()));
mod.init();
+ mod.nextState();
}
log.fine("Mod initialization complete");
@@ -246,6 +267,7 @@ public class Loader
{
log.finer(String.format("Post-initializing %s", mod.getName()));
mod.postInit();
+ mod.nextState();
}
}
@@ -451,22 +473,28 @@ public class Loader
{
Class> clazz = Class.forName(clazzName, false, modClassLoader);
+ ModContainer mod=null;
if (clazz.isAnnotationPresent(Mod.class))
{
// an FML mod
- mods.add(FMLModContainer.buildFor(clazz));
+ log.fine(String.format("FML mod class %s found, loading", clazzName));
+ mod = FMLModContainer.buildFor(clazz);
+ log.fine(String.format("FML mod class %s loaded", clazzName));
}
else if (FMLCommonHandler.instance().isModLoaderMod(clazz))
{
log.fine(String.format("ModLoader BaseMod class %s found, loading", clazzName));
- ModContainer mc = FMLCommonHandler.instance().loadBaseModMod(clazz, classSource.getCanonicalFile());
- mods.add(mc);
+ mod = FMLCommonHandler.instance().loadBaseModMod(clazz, classSource.getCanonicalFile());
log.fine(String.format("ModLoader BaseMod class %s loaded", clazzName));
}
else
{
// Unrecognized
}
+ if (mod!=null) {
+ mods.add(mod);
+ mod.nextState();
+ }
}
catch (Exception e)
{
@@ -550,6 +578,9 @@ public class Loader
{
modInit();
postModInit();
+ for (ModContainer mod : getModList()) {
+ mod.nextState();
+ }
state = State.UP;
log.info(String.format("Forge Mod Loader load complete, %d mods loaded", mods.size()));
}
@@ -575,11 +606,12 @@ public class Loader
public String getCrashInformation()
{
- String ret = String.format("Forge Mod Loader version %s.%s.%s.%s for Minecraft %s\n", major, minor, rev, build, mcversion);
+ StringBuffer ret = new StringBuffer();
+ ret.append(String.format("Forge Mod Loader version %s.%s.%s.%s for Minecraft %s\n", major, minor, rev, build, mcversion));
for (ModContainer mod : mods)
{
- ret += mod.getName() + "\n";
+ ret.append(String.format("\t%s : %s (%s)\n",mod.getName(), mod.getModState(), mod.getSource().getName()));
}
- return ret;
+ return ret.toString();
}
}
diff --git a/common/cpw/mods/fml/common/ModContainer.java b/common/cpw/mods/fml/common/ModContainer.java
index 4cf5903e10..81e9f616c2 100644
--- a/common/cpw/mods/fml/common/ModContainer.java
+++ b/common/cpw/mods/fml/common/ModContainer.java
@@ -28,6 +28,17 @@ import java.util.List;
public interface ModContainer
{
+ public enum ModState {
+ UNLOADED("Unloaded"), LOADED("Loaded"), PREINITIALIZED("Pre-initialized"), INITIALIZED("Initialized"), POSTINITIALIZED("Post-initialized"), AVAILABLE("Available");
+ private String label;
+
+ private ModState(String label) {
+ this.label=label;
+ }
+ public String toString() {
+ return this.label;
+ }
+ }
/**
* The enclosed mod wants to be called during pre-initialization.
* @return
@@ -55,6 +66,15 @@ public interface ModContainer
* @return
*/
String getName();
+ /**
+ * The state of the mod
+ * @return
+ */
+ ModState getModState();
+ /**
+ * Move to the next mod state
+ */
+ void nextState();
/**
* A tick has started
*/
@@ -74,6 +94,11 @@ public interface ModContainer
* @return
*/
File getSource();
+ /**
+ * Returns the sorting rules as a string for printing
+ * @return
+ */
+ String getSortingRules();
/**
* The actual mod object itself
* @return
diff --git a/common/cpw/mods/fml/common/modloader/ModLoaderModContainer.java b/common/cpw/mods/fml/common/modloader/ModLoaderModContainer.java
index bd6ad8302c..a14c42b407 100644
--- a/common/cpw/mods/fml/common/modloader/ModLoaderModContainer.java
+++ b/common/cpw/mods/fml/common/modloader/ModLoaderModContainer.java
@@ -34,7 +34,6 @@ import net.minecraft.src.BaseMod;
import net.minecraft.src.Block;
import net.minecraft.src.IBlockAccess;
import net.minecraft.src.MLProp;
-import net.minecraft.src.RenderBlocks;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.IConsoleHandler;
import cpw.mods.fml.common.ICraftingHandler;
@@ -48,6 +47,7 @@ import cpw.mods.fml.common.IWorldGenerator;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.LoaderException;
import cpw.mods.fml.common.ModContainer;
+import cpw.mods.fml.common.ModContainer.ModState;
import cpw.mods.fml.common.ModContainer.TickType;
public class ModLoaderModContainer implements ModContainer
@@ -61,12 +61,15 @@ public class ModLoaderModContainer implements ModContainer
private ArrayList postDependencies;
private ArrayList blockRenderInfos;
private ArrayList keyHandlers;
+ private ModState state;
public ModLoaderModContainer(Class extends BaseMod > modClazz, File modSource)
{
this.modClazz = modClazz;
this.modSource = modSource;
this.ticks = EnumSet.noneOf(TickType.class);
+ // We are unloaded
+ nextState();
}
/**
@@ -105,6 +108,23 @@ public class ModLoaderModContainer implements ModContainer
}
}
+ @Override
+ public ModState getModState()
+ {
+ return state;
+ }
+
+ @Override
+ public void nextState()
+ {
+ if (state==null) {
+ state=ModState.UNLOADED;
+ return;
+ }
+ if (state.ordinal()+1