mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-13 08:44:25 +00:00
Config GUIs in the modlist now work.
This commit is contained in:
1 parent
3113138bd1
commit
fbc1f8f6f9
10 files changed
+292
-3
No files matched your search
@@ -36,7 +36,10 @@ import net.minecraft.network.INetHandler;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Maps;
|
||||
@@ -119,6 +122,8 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||
|
||||
private Map<String, IResourcePack> resourcePackMap;
|
||||
|
||||
private BiMap<ModContainer, IModGuiFactory> guiFactories;
|
||||
|
||||
/**
|
||||
* Called to start the whole game off
|
||||
*
|
||||
@@ -239,6 +244,26 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||
// Reload resources
|
||||
// client.func_110436_a();
|
||||
RenderingRegistry.instance().loadEntityRenderers((Map<Class<? extends Entity>, Render>)RenderManager.field_78727_a.field_78729_o);
|
||||
guiFactories = HashBiMap.create();
|
||||
for (ModContainer mc : Loader.instance().getActiveModList())
|
||||
{
|
||||
String className = mc.getGuiClassName();
|
||||
if (Strings.isNullOrEmpty(className))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
try
|
||||
{
|
||||
Class<?> clazz = Class.forName(className, true, Loader.instance().getModClassLoader());
|
||||
Class<? extends IModGuiFactory> guiClassFactory = clazz.asSubclass(IModGuiFactory.class);
|
||||
IModGuiFactory guiFactory = guiClassFactory.newInstance();
|
||||
guiFactory.initialize(client);
|
||||
guiFactories.put(mc, guiFactory);
|
||||
} catch (Exception e)
|
||||
{
|
||||
FMLLog.log(Level.ERROR, e, "A critical error occurred instantiating the gui factory for mod %s", mc.getModId());
|
||||
}
|
||||
}
|
||||
loading = false;
|
||||
}
|
||||
|
||||
@@ -514,4 +539,9 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||
{
|
||||
showGuiScreen(new GuiIngameModOptions(guiIngameMenu));
|
||||
}
|
||||
|
||||
public IModGuiFactory getGuiFactoryFor(ModContainer selectedMod)
|
||||
{
|
||||
return guiFactories.get(selectedMod);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user