Fix CJB mod compatibilty for real. Gui container registration can now happen in the constructor. YUK!
This commit is contained in:
parent
2af15b3a95
commit
6de655df47
4 changed files with 24 additions and 13 deletions
|
@ -493,13 +493,19 @@ public class ModLoaderModContainer implements ModContainer
|
|||
Class<? extends BaseModProxy> modClazz = (Class<? extends BaseModProxy>) modClassLoader.loadBaseModClass(modClazzName);
|
||||
configureMod(modClazz, event.getASMHarvestedData());
|
||||
isNetworkMod = FMLNetworkHandler.instance().registerNetworkMod(this, modClazz, event.getASMHarvestedData());
|
||||
Constructor<? extends BaseModProxy> ctor = modClazz.getConstructor();
|
||||
ctor.setAccessible(true);
|
||||
mod = modClazz.newInstance();
|
||||
ModLoaderNetworkHandler dummyHandler = null;
|
||||
if (!isNetworkMod)
|
||||
{
|
||||
FMLLog.fine("Injecting dummy network mod handler for BaseMod %s", getModId());
|
||||
FMLNetworkHandler.instance().registerNetworkMod(new ModLoaderNetworkHandler(this, mod));
|
||||
dummyHandler = new ModLoaderNetworkHandler(this);
|
||||
FMLNetworkHandler.instance().registerNetworkMod(dummyHandler);
|
||||
}
|
||||
Constructor<? extends BaseModProxy> ctor = modClazz.getConstructor();
|
||||
ctor.setAccessible(true);
|
||||
mod = modClazz.newInstance();
|
||||
if (dummyHandler != null)
|
||||
{
|
||||
dummyHandler.setBaseMod(mod);
|
||||
}
|
||||
ProxyInjector.inject(this, event.getASMHarvestedData(), FMLCommonHandler.instance().getSide());
|
||||
}
|
||||
|
|
|
@ -9,10 +9,14 @@ public class ModLoaderNetworkHandler extends NetworkModHandler
|
|||
{
|
||||
|
||||
private BaseModProxy baseMod;
|
||||
public ModLoaderNetworkHandler(ModLoaderModContainer mlmc, BaseModProxy mod)
|
||||
public ModLoaderNetworkHandler(ModLoaderModContainer mlmc)
|
||||
{
|
||||
super(mlmc, null);
|
||||
this.baseMod = mod;
|
||||
}
|
||||
|
||||
public void setBaseMod(BaseModProxy baseMod)
|
||||
{
|
||||
this.baseMod = baseMod;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,13 +24,13 @@ public class ModLoaderNetworkHandler extends NetworkModHandler
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean requiresServerSide()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean acceptVersion(String version)
|
||||
{
|
||||
|
|
|
@ -31,6 +31,7 @@ import com.google.common.collect.Sets;
|
|||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.Side;
|
||||
import cpw.mods.fml.common.network.FMLPacket.Type;
|
||||
|
@ -263,6 +264,11 @@ public class NetworkRegistry
|
|||
public void registerGuiHandler(Object mod, IGuiHandler handler)
|
||||
{
|
||||
ModContainer mc = FMLCommonHandler.instance().findContainerFor(mod);
|
||||
if (mc == null)
|
||||
{
|
||||
mc = Loader.instance().activeModContainer();
|
||||
FMLLog.log(Level.WARNING, "Mod %s attempted to register a gui network handler during a construction phase", mc.getModId());
|
||||
}
|
||||
NetworkModHandler nmh = FMLNetworkHandler.instance().findNetworkModHandler(mc);
|
||||
if (nmh == null)
|
||||
{
|
||||
|
|
|
@ -24,11 +24,6 @@ public class Downloader extends JOptionPane
|
|||
boolean stopIt;
|
||||
Thread pokeThread;
|
||||
|
||||
public Downloader()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
private Box makeProgressPanel()
|
||||
{
|
||||
Box box = Box.createVerticalBox();
|
||||
|
|
Loading…
Reference in a new issue