Merge branch 'master' into newtweak

This commit is contained in:
Christian 2013-09-18 14:49:53 -04:00
commit 88f1dce658
16 changed files with 1045 additions and 1138 deletions

View file

@ -203,7 +203,7 @@
<delete file="${basedir}/installer_base.jar" />
<delete file="${basedir}/install_profile.json" />
<get src="http://files.minecraftforge.net/installer/forge-installer-1.1-shrunk.jar" dest="${basedir}/installer_base.jar" />
<get src="http://files.minecraftforge.net/installer/forge-installer-1.3-shrunk.jar" dest="${basedir}/installer_base.jar" />
<copy file="${basedir}/jsons/${version.minecraft}-rel.json" tofile="${basedir}/install_profile.json" />
<copy file="${basedir}/installer_base.jar" tofile="${basedir}/target/${modname}-installer-${version.fullname}.jar" />
<replace file="${basedir}/install_profile.json">

View file

@ -606,4 +606,10 @@ public class FMLClientHandler implements IFMLSidedHandler
{
return resourcePackMap.get(modId);
}
@Override
public String getCurrentLanguage()
{
return client.func_135016_M().func_135041_c().func_135034_a();
}
}

View file

@ -496,4 +496,10 @@ public class FMLCommonHandler
{
sidedDelegate.updateResourcePackList();
}
public String getCurrentLanguage()
{
return sidedDelegate.getCurrentLanguage();
}
}

View file

@ -12,6 +12,7 @@
package cpw.mods.fml.common;
import java.io.File;
import java.security.cert.Certificate;
import java.util.Arrays;
import java.util.Map;
@ -26,6 +27,9 @@ import net.minecraft.world.storage.WorldInfo;
import com.google.common.eventbus.EventBus;
import cpw.mods.fml.client.FMLFileResourcePack;
import cpw.mods.fml.client.FMLFolderResourcePack;
import cpw.mods.fml.common.asm.FMLSanityChecker;
import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.ItemData;
@ -124,9 +128,14 @@ public class FMLDummyContainer extends DummyModContainer implements WorldAccessC
return certificates != null ? certificates[0] : null;
}
@Override
public File getSource()
{
return FMLSanityChecker.fmlLocation;
}
@Override
public Class<?> getCustomResourcePackClass()
{
return super.getCustomResourcePackClass();
return getSource().isDirectory() ? FMLFolderResourcePack.class : FMLFileResourcePack.class;
}
}

View file

@ -66,4 +66,6 @@ public interface IFMLSidedHandler
void addModAsResource(ModContainer container);
void updateResourcePackList();
String getCurrentLanguage();
}

View file

@ -30,7 +30,7 @@ public class InjectedModContainer implements ModContainer
public InjectedModContainer(ModContainer mc, File source)
{
this.source = source;
this.source = source != null ? source : new File("minecraft.jar");
this.wrappedContainer = mc;
}

View file

@ -322,7 +322,6 @@ public class Loader
FMLLog.fine("Building injected Mod Containers %s", injectedContainers);
// Add in the MCP mod container
mods.add(new InjectedModContainer(mcp,new File("minecraft.jar")));
File coremod = new File(minecraftDir,"coremods");
for (String cont : injectedContainers)
{
ModContainer mc;
@ -335,7 +334,7 @@ public class Loader
FMLLog.log(Level.SEVERE, e, "A problem occured instantiating the injected mod container %s", cont);
throw new LoaderException(e);
}
mods.add(new InjectedModContainer(mc,coremod));
mods.add(new InjectedModContainer(mc,mc.getSource()));
}
ModDiscoverer discoverer = new ModDiscoverer();
FMLLog.fine("Attempting to load mods contained in the minecraft jar file and associated classes");

View file

@ -85,6 +85,7 @@ public class FMLSanityChecker implements IFMLCallHook
}
private LaunchClassLoader cl;
public static File fmlLocation;
@Override
public Void call() throws Exception
@ -239,6 +240,7 @@ public class FMLSanityChecker implements IFMLCallHook
{
cl = (LaunchClassLoader) data.get("classLoader");
File mcDir = (File)data.get("mcLocation");
fmlLocation = (File)data.get("coremodLocation");
FMLDeobfuscatingRemapper.INSTANCE.setup(mcDir, cl, (String) data.get("deobfuscationFileName"));
ClassPatchManager.INSTANCE.setup(FMLLaunchHandler.side());
}

View file

@ -23,6 +23,7 @@ import java.util.logging.Level;
import com.google.common.base.Charsets;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
@ -46,7 +47,7 @@ public class LanguageRegistry
public String getStringLocalization(String key)
{
return getStringLocalization(key, Minecraft.func_71410_x().func_135016_M().func_135041_c().func_135034_a());
return getStringLocalization(key, FMLCommonHandler.instance().getCurrentLanguage());
}
public String getStringLocalization(String key, String lang)

View file

@ -113,7 +113,7 @@ public class CoreModManager
loadPlugins = new ArrayList<FMLPluginWrapper>();
for (String rootPluginName : rootPlugins)
{
loadCoreMod(classLoader, rootPluginName, null);
loadCoreMod(classLoader, rootPluginName, new File(FMLTweaker.getJarLocation()));
}
if (loadPlugins.isEmpty())

View file

@ -12,7 +12,18 @@
*/
package cpw.mods.fml.server;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import org.apache.commons.io.IOUtils;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.MapDifference;
@ -23,8 +34,10 @@ import net.minecraft.network.packet.NetHandler;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet131MapData;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.StringTranslate;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.IFMLSidedHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
@ -193,11 +206,63 @@ public class FMLServerHandler implements IFMLSidedHandler
@Override
public void addModAsResource(ModContainer container)
{
// NOOP on server
File source = container.getSource();
try
{
if (source.isDirectory())
{
searchDirForENUSLanguage(source,"");
}
else
{
searchZipForENUSLanguage(source);
}
}
catch (IOException ioe)
{
}
}
private static final Pattern assetENUSLang = Pattern.compile("assets/(.*)/lang/en_US.lang");
private void searchZipForENUSLanguage(File source) throws IOException
{
ZipFile zf = new ZipFile(source);
for (ZipEntry ze : Collections.list(zf.entries()))
{
Matcher matcher = assetENUSLang.matcher(ze.getName());
if (matcher.matches())
{
FMLLog.fine("Injecting found translation data in zip file %s at %s into language system", source.getName(), ze.getName());
StringTranslate.inject(zf.getInputStream(ze));
}
}
zf.close();
}
private void searchDirForENUSLanguage(File source, String path) throws IOException
{
for (File file : source.listFiles())
{
String currPath = path+file.getName();
if (file.isDirectory())
{
searchDirForENUSLanguage(file, currPath+'/');
}
Matcher matcher = assetENUSLang.matcher(currPath);
if (matcher.matches())
{
FMLLog.fine("Injecting found translation data at %s into language system", currPath);
StringTranslate.inject(new FileInputStream(file));
}
}
}
@Override
public void updateResourcePackList()
{
// NOOP on server
}
@Override
public String getCurrentLanguage()
{
return "en_US";
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -7,6 +7,7 @@
"filePath":"@universal_jar@",
"welcome":"Welcome to the simple FML installer.",
"minecraft":"@minecraft_version@",
"mirrorList" : "http://files.minecraftforge.net/mirror-brand.list",
"logo":"/big_logo.png"
},
"versionInfo": {
@ -33,6 +34,7 @@
{
"name": "org.scala-lang:scala-library:2.10.2",
"url" : "http://files.minecraftforge.net/maven/",
"checksums" : [ "6ba65d12cd09d441083262d6f73d2257fec7c663", "dffc88e804861c9eaba39283757000b6558ea573" ],
"comment" : "Important for FML, we add this",
"serverreq":true,
"clientreq":true
@ -40,6 +42,7 @@
{
"name": "org.scala-lang:scala-compiler:2.10.2",
"url" : "http://files.minecraftforge.net/maven/",
"checksums" : [ "64c8b1380cc53d6850823d6e4e7ae984aa44ef9c", "40281b3ffc69fb385953522c843363ccaf71ba89" ],
"comment" : "Important for FML, we add this",
"serverreq":true,
"clientreq":true

View file

@ -45,3 +45,11 @@
}
else
{
@@ -131,7 +146,6 @@
}
}
- @SideOnly(Side.CLIENT)
public double func_70318_a(double p_70318_1_, double p_70318_3_, double p_70318_5_)
{
double d3 = (double)this.field_70329_l + 0.5D - p_70318_1_;

View file

@ -9,7 +9,28 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.io.IOException;
@@ -45,7 +47,7 @@
@@ -23,9 +25,19 @@
public StringTranslate()
{
+ InputStream inputstream = StringTranslate.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang");
+ localInject(inputstream);
+ }
+
+ public static void inject(InputStream inputstream)
+ {
+ field_74817_a.localInject(inputstream);
+ }
+
+ private void localInject(InputStream inputstream)
+ {
try
{
- InputStream inputstream = StringTranslate.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang");
Iterator iterator = IOUtils.readLines(inputstream, Charsets.UTF_8).iterator();
while (iterator.hasNext())
@@ -45,7 +57,7 @@
}
}
}