Beginning the 1.3.1 update

This commit is contained in:
Christian committed 2012-07-30 22:31:07 -04:00
1 parent e001103ed8
commit 6f8b39ea09
84 files changed
+813 -3761

No files matched your search

@@ -38,8 +38,6 @@ import java.util.zip.ZipException;
import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
import net.minecraft.src.CallableMinecraftVersion;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableList.Builder;
@@ -310,10 +308,6 @@ public class FMLCommonHandler
return sidedDelegate.getMinecraftLogger();
}
public File getMinecraftRootDirectory() {
return sidedDelegate.getMinecraftRootDirectory();
}
/**
* @return
*/
@@ -455,9 +449,8 @@ public class FMLCommonHandler
if (brandings == null)
{
Builder brd = ImmutableList.<String>builder();
brd.add("Minecraft "+CallableMinecraftVersion.func_55337_a());
brd.add(Loader.instance().getMCVersionString());
brd.add(Loader.instance().getFMLVersionString());
brd.add(Strings.nullToEmpty((String)callForgeMethod("getVersionString")));
brd.addAll(sidedDelegate.getAdditionalBrandingInformation());
try {
Properties props=new Properties();
@@ -13,16 +13,26 @@ import cpw.mods.fml.common.modloader.ModProperty;
public interface IFMLSidedHandler
{
Logger getMinecraftLogger();
File getMinecraftRootDirectory();
Object getMinecraftInstance();
String getCurrentLanguage();
Properties getCurrentLanguageTable();
String getObjectName(Object minecraftObject);
void profileStart(String profileLabel);
void profileEnd();
ModProperty getModLoaderPropertyFor(Field f);
List<String> getAdditionalBrandingInformation();
Side getSide();
ProxyInjector findSidedProxyOn(BaseMod mod);
void haltGame(String message, Throwable exception);
}
+20 -29
View File
@@ -132,6 +132,8 @@ public class Loader
private File canonicalModsDir;
private LoadController modController;
private static File minecraftDir;
public static Loader instance()
{
if (instance == null)
@@ -142,33 +144,19 @@ public class Loader
return instance;
}
public static void injectData(Object... data)
{
major = (String) data[0];
minor = (String) data[1];
rev = (String) data[2];
build = (String) data[3];
mccversion = (String) data[4];
mcsversion = (String) data[5];
minecraftDir = (File) data[6];
}
private Loader()
{
InputStream stream = getClass().getClassLoader().getResourceAsStream("fmlversion.properties");
Properties properties = new Properties();
if (stream != null)
{
try
{
properties.load(stream);
}
catch (IOException ex)
{
FMLLog.log(Level.SEVERE, "Could not get FML version information - corrupted installation detected!", ex);
throw new LoaderException(ex);
}
}
major = properties.getProperty("fmlbuild.major.number", "missing");
minor = properties.getProperty("fmlbuild.minor.number", "missing");
rev = properties.getProperty("fmlbuild.revision.number", "missing");
build = properties.getProperty("fmlbuild.build.number", "missing");
mccversion = properties.getProperty("fmlbuild.mcclientversion", "missing");
mcsversion = properties.getProperty("fmlbuild.mcserverversion", "missing");
FMLLog.info("Forge Mod Loader version %s.%s.%s.%s for Minecraft client:%s, server:%s loading", major, minor, rev, build, mccversion, mcsversion);
modClassLoader = new ModClassLoader(getClass().getClassLoader());
}
@@ -279,7 +267,6 @@ public class Loader
*/
private void initializeLoader()
{
File minecraftDir = FMLCommonHandler.instance().getMinecraftRootDirectory();
File modsDir = new File(minecraftDir, "mods");
File configDir = new File(minecraftDir, "config");
String canonicalModsPath;
@@ -295,9 +282,8 @@ public class Loader
}
catch (IOException ioe)
{
FMLLog.log(Level.SEVERE,
String.format("Failed to resolve loader directories: mods : %s ; config %s", canonicalModsDir.getAbsolutePath(),
configDir.getAbsolutePath()), ioe);
FMLLog.log(Level.SEVERE, ioe, "Failed to resolve loader directories: mods : %s ; config %s", canonicalModsDir.getAbsolutePath(),
configDir.getAbsolutePath());
throw new LoaderException(ioe);
}
@@ -572,4 +558,9 @@ public class Loader
{
return modController.getModState(selectedMod);
}
public String getMCVersionString()
{
return "Minecraft " + mccversion;
}
}
@@ -21,9 +21,9 @@ import cpw.mods.fml.relauncher.ReflectionHelper.UnableToFindFieldException;
/**
* Some reflection helper code.
*
*
* @author cpw
*
*
*/
public class ObfuscationReflectionHelper
{
@@ -38,8 +38,7 @@ public class ObfuscationReflectionHelper
}
catch (UnableToAccessFieldException e)
{
FMLCommonHandler.instance().getFMLLogger()
.log(Level.SEVERE, String.format("There was a problem getting field index %d from %s", fieldIndex, classToAccess.getName()), e);
FMLLog.log(Level.SEVERE, e, "There was a problem getting field index %d from %s", fieldIndex, classToAccess.getName());
throw e;
}
}
@@ -53,14 +52,12 @@ public class ObfuscationReflectionHelper
}
catch (UnableToFindFieldException e)
{
FMLCommonHandler.instance().getFMLLogger()
.log(Level.SEVERE, String.format("Unable to locate any field %s on type %s", Arrays.toString(fieldNames), classToAccess.getName()), e);
FMLLog.log(Level.SEVERE,e,"Unable to locate any field %s on type %s", Arrays.toString(fieldNames), classToAccess.getName());
throw e;
}
catch (UnableToAccessFieldException e)
{
FMLCommonHandler.instance().getFMLLogger()
.log(Level.SEVERE, String.format("Unable to access any field %s on type %s", Arrays.toString(fieldNames), classToAccess.getName()), e);
FMLLog.log(Level.SEVERE, e, "Unable to access any field %s on type %s", Arrays.toString(fieldNames), classToAccess.getName());
throw e;
}
}
@@ -79,8 +76,7 @@ public class ObfuscationReflectionHelper
}
catch (UnableToAccessFieldException e)
{
FMLCommonHandler.instance().getFMLLogger()
.log(Level.SEVERE, String.format("There was a problem setting field index %d on type %s", fieldIndex, classToAccess.getName()));
FMLLog.log(Level.SEVERE, e, "There was a problem setting field index %d on type %s", fieldIndex, classToAccess.getName());
throw e;
}
}
@@ -99,14 +95,12 @@ public class ObfuscationReflectionHelper
}
catch (UnableToFindFieldException e)
{
FMLCommonHandler.instance().getFMLLogger()
.log(Level.SEVERE, String.format("Unable to locate any field %s on type %s", Arrays.toString(fieldNames), classToAccess.getName()), e);
FMLLog.log(Level.SEVERE, e, "Unable to locate any field %s on type %s", Arrays.toString(fieldNames), classToAccess.getName());
throw e;
}
catch (UnableToAccessFieldException e)
{
FMLCommonHandler.instance().getFMLLogger()
.log(Level.SEVERE, String.format("Unable to set any field %s on type %s", Arrays.toString(fieldNames), classToAccess.getName()), e);
FMLLog.log(Level.SEVERE, e, "Unable to set any field %s on type %s", Arrays.toString(fieldNames), classToAccess.getName());
throw e;
}
}
@@ -5,12 +5,15 @@ import java.applet.AppletStub;
import java.awt.Dialog.ModalityType;
import java.awt.HeadlessException;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URLClassLoader;
import java.util.Arrays;
import java.util.Properties;
import java.util.logging.Level;
import javax.swing.JDialog;
import javax.swing.JFrame;
@@ -18,8 +21,6 @@ import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.ProgressMonitorInputStream;
import net.minecraft.src.WorldSettings;
public class FMLEmbeddingRelauncher
{
private static FMLEmbeddingRelauncher INSTANCE;
@@ -74,7 +75,7 @@ public class FMLEmbeddingRelauncher
File minecraftHome = setupHome();
client = ReflectionHelper.getClass(clientLoader, "net.minecraft.client.Minecraft");
ReflectionHelper.setPrivateValue(client, null, minecraftHome, "field_6275_Z", "ap", "minecraftDir");
ReflectionHelper.setPrivateValue(client, null, minecraftHome, "field_71463_am", "am", "minecraftDir");
}
finally
{
@@ -100,7 +101,7 @@ public class FMLEmbeddingRelauncher
{
Class<? super Object> mcMaster = ReflectionHelper.getClass(getClass().getClassLoader(), "net.minecraft.client.Minecraft");
// We force minecraft to setup it's homedir very early on so we can inject stuff into it
Method setupHome = ReflectionHelper.findMethod(mcMaster, null, new String[] { "func_6240_b", "getMinecraftDir", "b"} );
Method setupHome = ReflectionHelper.findMethod(mcMaster, null, new String[] { "func_71380_b", "getMinecraftDir", "b"} );
try
{
setupHome.invoke(null);
@@ -109,9 +110,9 @@ public class FMLEmbeddingRelauncher
{
// Hmmm
}
File minecraftHome = ReflectionHelper.getPrivateValue(mcMaster, null, "field_6275_Z", "ap", "minecraftDir");
FMLLog.minecraftHome = minecraftHome;
FMLLog.info("FML relaunch active");
File minecraftHome = ReflectionHelper.getPrivateValue(mcMaster, null, "field_71463_am", "am", "minecraftDir");
FMLVersionData.build(minecraftHome, clientLoader);
FMLLog.info("Forge Mod Loader version %s.%s.%s.%s for Minecraft client:%s, server:%s loading", FMLVersionData.major, FMLVersionData.minor, FMLVersionData.rev, FMLVersionData.build, FMLVersionData.mccversion, FMLVersionData.mcsversion);
try
{
@@ -0,0 +1,51 @@
package cpw.mods.fml.relauncher;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import java.util.logging.Level;
public class FMLVersionData
{
static File minecraftHome;
static String major;
static String minor;
static String rev;
static String build;
static String mccversion;
static String mcsversion;
static void build(File mcHome, RelaunchClassLoader classLoader)
{
minecraftHome = mcHome;
InputStream stream = classLoader.getResourceAsStream("fmlversion.properties");
Properties properties = new Properties();
if (stream != null)
{
try
{
properties.load(stream);
}
catch (IOException ex)
{
FMLLog.log(Level.SEVERE, ex, "Could not get FML version information - corrupted installation detected!");
}
}
major = properties.getProperty("fmlbuild.major.number", "missing");
minor = properties.getProperty("fmlbuild.minor.number", "missing");
rev = properties.getProperty("fmlbuild.revision.number", "missing");
build = properties.getProperty("fmlbuild.build.number", "missing");
mccversion = properties.getProperty("fmlbuild.mcclientversion", "missing");
mcsversion = properties.getProperty("fmlbuild.mcserverversion", "missing");
}
public static Object[] data()
{
return new Object[] { major, minor, rev, build, mccversion, mcsversion, minecraftHome };
}
}
@@ -8,6 +8,7 @@ import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.math.BigInteger;
import java.net.MalformedURLException;
import java.net.URI;
@@ -191,6 +192,8 @@ public class RelaunchLibraryManager
try
{
Class<?> loaderClazz = Class.forName("cpw.mods.fml.common.Loader", true, actualClassLoader);
Method m = loaderClazz.getMethod("injectData", Object[].class);
m.invoke(null, (Object)FMLVersionData.data());
}
catch (Exception e)
{