mirror of
https://github.com/GTNewHorizons/MagicBees.git
synced 2026-11-12 08:17:29 +00:00
Refactoring Configs to exploit the runtime config changing options in Forge.
This commit is contained in:
1 parent
b1a3223fbe
commit
0a28b3fe63
6 files changed
+83
-74
No files matched your search
@@ -1,21 +1,38 @@
|
||||
package magicbees.client.gui;
|
||||
|
||||
import cpw.mods.fml.client.config.GuiConfig;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.utils.VersionInfo;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraftforge.common.config.ConfigElement;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import cpw.mods.fml.client.config.DummyConfigElement;
|
||||
import cpw.mods.fml.client.config.GuiConfig;
|
||||
import cpw.mods.fml.client.config.IConfigElement;
|
||||
|
||||
public class ModGuiConfig extends GuiConfig
|
||||
{
|
||||
public ModGuiConfig(GuiScreen guiScreen)
|
||||
{
|
||||
super(guiScreen,
|
||||
new ConfigElement(Config.configuration.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(),
|
||||
VersionInfo.ModName,
|
||||
false,
|
||||
false,
|
||||
super(guiScreen, configElements(), VersionInfo.ModName, false, false,
|
||||
GuiConfig.getAbridgedConfigPath(Config.configuration.toString()));
|
||||
}
|
||||
|
||||
private static List<IConfigElement> configElements() {
|
||||
List<IConfigElement> list = new ArrayList<IConfigElement>();
|
||||
|
||||
list.add(categoryElement(Config.CATEGORY_GENERAL, "General", "magicbees.config.category.general"));
|
||||
list.add(categoryElement(Config.CATEGORY_DEBUG, "Debug", "magicbees.config.category.debug"));
|
||||
list.add(categoryElement(Config.CATEGORY_MODULES, "Modules", "magicbees.config.category.modules"));
|
||||
list.add(categoryElement(Config.CATEGORY_BOTANIA, "Botania Plugin", "magicbees.config.category.botania"));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private static IConfigElement categoryElement(String category, String name, String tooltip_key) {
|
||||
return new DummyConfigElement.DummyCategoryElement(name, tooltip_key,
|
||||
new ConfigElement(Config.configuration.getCategory(category)).getChildElements());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user