Lots of tweaks to mod output pretty printing. new versioning scheme.
This commit is contained in:
parent
ef6bb505b9
commit
5a93998097
6 changed files with 159 additions and 59 deletions
|
@ -23,6 +23,28 @@
|
|||
</condition>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
<target name="revision">
|
||||
<propertyfile file="fmlversion.properties">
|
||||
<entry key="fmlbuild.revision.number" type="int" operation="+" value="1" pattern="0" />
|
||||
<entry key="fmlbuild.build.number" type="int" value="${version.build}"/>
|
||||
</propertyfile>
|
||||
</target>
|
||||
|
||||
<target name="minor">
|
||||
<propertyfile file="fmlversion.properties">
|
||||
<entry key="fmlbuild.minor.number" type="int" operation="+" value="1" pattern="0" />
|
||||
<entry key="fmlbuild.revision.number" type="int" value="0" pattern="0" />
|
||||
</propertyfile>
|
||||
</target>
|
||||
|
||||
<target name="major">
|
||||
<propertyfile file="fmlversion.properties">
|
||||
<entry key="fmlbuild.major.number" type="int" operation="+" value="1" pattern="0" />
|
||||
<entry key="fmlbuild.minor.number" type="int" value="0" pattern="0" />
|
||||
<entry key="fmlbuild.revision.number" type="int" value="0" pattern="0" />
|
||||
</propertyfile>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="init">
|
||||
<tstamp>
|
||||
|
@ -30,14 +52,17 @@
|
|||
</tstamp>
|
||||
<property environment="env" />
|
||||
<property file="fmlbuild.properties" />
|
||||
<property name="modname" value="fml" />
|
||||
<property name="version.minecraft" value="1.2.5" />
|
||||
<property name="version.major" value="1" />
|
||||
<property name="version.minor" value="0" />
|
||||
<property name="version.rev" value="0" />
|
||||
<property file="fmlversion.properties" />
|
||||
<property name="build.number" value="${fmlbuild.major.number}.${fmlbuild.minor.number}.${fmlbuild.revision.number}" />
|
||||
<condition property="version.build" value="${env.BUILD_NUMBER}" else="1">
|
||||
<isset property="env.BUILD_NUMBER" />
|
||||
</condition>
|
||||
<antcall target="revision" />
|
||||
<property name="modname" value="fml" />
|
||||
<property name="version.minecraft" value="${fmlbuild.mcversion}" />
|
||||
<property name="version.major" value="${fmlbuild.major.number}" />
|
||||
<property name="version.minor" value="${fmlbuild.minor.number}" />
|
||||
<property name="version.rev" value="${fmlbuild.revision.number}" />
|
||||
<property name="version" value="${version.major}.${version.minor}.${version.rev}.${version.build}" />
|
||||
<condition property="dev.home" value="${env.WORKSPACE}" else="${default.dev.home}">
|
||||
<isset property="env.WORKSPACE" />
|
||||
|
@ -105,15 +130,6 @@
|
|||
<copy todir="${merge-to}" overwrite="true" verbose="true">
|
||||
<fileset dir="${side-from}" includes="**/*.java" />
|
||||
<fileset dir="${common.src.dir}" includes="**/*.java" />
|
||||
<filterchain>
|
||||
<replacetokens>
|
||||
<token key="MAJOR" value="${version.major}" />
|
||||
<token key="MINOR" value="${version.minor}" />
|
||||
<token key="REV" value="${version.rev}" />
|
||||
<token key="BUILD" value="${version.build}" />
|
||||
<token key="MCVERSION" value="${version.minecraft}" />
|
||||
</replacetokens>
|
||||
</filterchain>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
|
@ -135,6 +151,7 @@
|
|||
<mkdir dir="${basedir}/target" />
|
||||
<zip destfile="${basedir}/target/${jarname}.zip">
|
||||
<fileset dir="${output}" includes="**/*.class" />
|
||||
<zipfileset dir="${basedir}" includes="fmlversion.properties"/>
|
||||
<zipfileset dir="${basedir}" includes="LICENSE-fml.txt" />
|
||||
<zipfileset dir="${basedir}" includes="install/CREDITS-fml.txt" fullpath="CREDITS-fml.txt"/>
|
||||
<mappedresources>
|
||||
|
@ -163,37 +180,8 @@
|
|||
<zipfileset dir="${common.src.dir}" includes="**/*.java" excludes="**/Loader.java" prefix="fml/src/minecraft" />
|
||||
<zipfileset dir="${client.src.dir}" includes="**/*.java" prefix="fml/src/minecraft" />
|
||||
<zipfileset dir="${server.src.dir}" includes="**/*.java" prefix="fml/src/minecraft_server" />
|
||||
<zipfileset dir="${basedir}" includes="fmlversion.properties" prefix="fml" />
|
||||
<zipfileset dir="${patch.src.dir}" includes="**/*.patch" prefix="fml/patches" />
|
||||
<mappedresources>
|
||||
<concat>
|
||||
<fileset dir="${common.src.dir}" includes="cpw/mods/fml/common/Loader.java" />
|
||||
<filterchain>
|
||||
<replacetokens>
|
||||
<token key="MAJOR" value="${version.major}" />
|
||||
<token key="MINOR" value="${version.minor}" />
|
||||
<token key="REV" value="${version.rev}" />
|
||||
<token key="BUILD" value="${version.build}" />
|
||||
<token key="MCVERSION" value="${version.minecraft}" />
|
||||
</replacetokens>
|
||||
</filterchain>
|
||||
</concat>
|
||||
<mergemapper to="fml/src/minecraft_server/cpw/mods/fml/common/Loader.java" />
|
||||
</mappedresources>
|
||||
<mappedresources>
|
||||
<concat>
|
||||
<fileset dir="${common.src.dir}" includes="cpw/mods/fml/common/Loader.java" />
|
||||
<filterchain>
|
||||
<replacetokens>
|
||||
<token key="MAJOR" value="${version.major}" />
|
||||
<token key="MINOR" value="${version.minor}" />
|
||||
<token key="REV" value="${version.rev}" />
|
||||
<token key="BUILD" value="${version.build}" />
|
||||
<token key="MCVERSION" value="${version.minecraft}" />
|
||||
</replacetokens>
|
||||
</filterchain>
|
||||
</concat>
|
||||
<mergemapper to="fml/src/minecraft/cpw/mods/fml/common/Loader.java" />
|
||||
</mappedresources>
|
||||
<mappedresources>
|
||||
<concat>
|
||||
<fileset dir="${basedir}/install" includes="README.txt" />
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<String> postDependencies;
|
||||
private ArrayList<IBlockRenderInfo> blockRenderInfos;
|
||||
private ArrayList<IKeyHandler> 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<ModState.values().length) {
|
||||
state=ModState.values()[state.ordinal()+1];
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -322,7 +342,7 @@ public class ModLoaderModContainer implements ModContainer
|
|||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return mod != null ? mod.getName() : null;
|
||||
return mod != null ? mod.getName() : getSource().getName();
|
||||
}
|
||||
|
||||
public static ModContainer findContainerFor(BaseMod mod)
|
||||
|
@ -338,6 +358,15 @@ public class ModLoaderModContainer implements ModContainer
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSortingRules()
|
||||
{
|
||||
if (mod!=null) {
|
||||
return mod.getPriorities();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean matches(Object mod)
|
||||
{
|
||||
|
|
7
fml/fmlversion.properties
Normal file
7
fml/fmlversion.properties
Normal file
|
@ -0,0 +1,7 @@
|
|||
#Thu, 10 May 2012 09:42:10 -0400
|
||||
|
||||
fmlbuild.major.number=2
|
||||
fmlbuild.minor.number=0
|
||||
fmlbuild.revision.number=0
|
||||
fmlbuild.build.number=1
|
||||
fmlbuild.mcversion=1.2.5
|
Loading…
Reference in a new issue