Allow coremods to properly inject asset readers.

This commit is contained in:
Christian 2013-08-27 12:31:37 -04:00
parent 3b4f1983ce
commit 5925fa7c79
5 changed files with 15 additions and 5 deletions

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

@ -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

@ -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())