Merge pull request #981 from GirafiStudios/forge_config

Changed GUI config category strings, Closes #960
This commit is contained in:
Adubbz 2017-04-18 18:18:02 +10:00 committed by GitHub
commit d5f4c73459
7 changed files with 61 additions and 77 deletions

View file

@ -1,4 +1,4 @@
minecraft_version=1.11.2
forge_version=13.20.0.2224
forge_version=13.20.0.2279
mod_version=6.0.2
mappings_version=snapshot_nodoc_20170121

View file

@ -1,44 +0,0 @@
package biomesoplenty.client.gui;
import java.util.ArrayList;
import java.util.List;
import biomesoplenty.common.config.GameplayConfigurationHandler;
import biomesoplenty.common.config.MiscConfigurationHandler;
import biomesoplenty.common.remote.TrailManager;
import biomesoplenty.common.util.entity.PlayerUtil;
import biomesoplenty.core.BiomesOPlenty;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.common.config.ConfigElement;
import net.minecraftforge.fml.client.config.DummyConfigElement;
import net.minecraftforge.fml.client.config.GuiConfig;
import net.minecraftforge.fml.client.config.IConfigElement;
public class GuiBOPConfig extends GuiConfig
{
public GuiBOPConfig(GuiScreen parentScreen)
{
super(parentScreen, GuiBOPConfig.getConfigElements(), BiomesOPlenty.MOD_ID, false, false, "/biomesoplenty");
}
private static List<IConfigElement> getConfigElements()
{
List<IConfigElement> list = new ArrayList<IConfigElement>();
List<IConfigElement> convenienceSettings = new ConfigElement(GameplayConfigurationHandler.config.getCategory(GameplayConfigurationHandler.convenienceSettings.toLowerCase())).getChildElements();
List<IConfigElement> guiSettings = new ConfigElement(MiscConfigurationHandler.config.getCategory(MiscConfigurationHandler.GUI_SETTINGS.toLowerCase())).getChildElements();
List<IConfigElement> textureSettings = new ConfigElement(MiscConfigurationHandler.config.getCategory(MiscConfigurationHandler.VISUAL_SETTINGS.toLowerCase())).getChildElements();
List<IConfigElement> trailSettings = new ConfigElement(MiscConfigurationHandler.config.getCategory(MiscConfigurationHandler.TRAIL_SETTINGS.toLowerCase())).getChildElements();
list.add(new DummyConfigElement.DummyCategoryElement(I18n.translateToLocal("config.category.convenienceSettings.title"), "config.category.convenienceSettings", convenienceSettings));
list.add(new DummyConfigElement.DummyCategoryElement(I18n.translateToLocal("config.category.guiSettings.title"), "config.category.guiSettings", guiSettings));
list.add(new DummyConfigElement.DummyCategoryElement(I18n.translateToLocal("config.category.textureSettings.title"), "config.category.textureSettings", textureSettings));
if (TrailManager.trailsMap.containsKey(PlayerUtil.getClientPlayerUUID()))
{
list.add(new DummyConfigElement.DummyCategoryElement(I18n.translateToLocal("config.category.trailSettings.title"), "config.category.trailSettings", trailSettings));
}
return list;
}
}

View file

@ -0,0 +1,53 @@
package biomesoplenty.client.gui;
import biomesoplenty.common.config.GameplayConfigurationHandler;
import biomesoplenty.common.remote.TrailManager;
import biomesoplenty.common.util.entity.PlayerUtil;
import biomesoplenty.core.BiomesOPlenty;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.common.config.ConfigElement;
import net.minecraftforge.fml.client.DefaultGuiFactory;
import net.minecraftforge.fml.client.config.DummyConfigElement.DummyCategoryElement;
import net.minecraftforge.fml.client.config.GuiConfig;
import net.minecraftforge.fml.client.config.IConfigElement;
import java.util.ArrayList;
import java.util.List;
import static biomesoplenty.common.config.GameplayConfigurationHandler.CONVENIENCE_SETTINGS;
import static biomesoplenty.common.config.MiscConfigurationHandler.*;
public class GuiBOPFactory extends DefaultGuiFactory
{
public GuiBOPFactory()
{
super(BiomesOPlenty.MOD_ID, BiomesOPlenty.MOD_NAME);
}
@Override
public GuiScreen createConfigGui(GuiScreen parentScreen)
{
return new GuiConfig(parentScreen, getConfigElements(), modid, false, false, title);
}
private static List<IConfigElement> getConfigElements()
{
List<IConfigElement> list = new ArrayList<IConfigElement>();
List<IConfigElement> convenience_settings = new ConfigElement(GameplayConfigurationHandler.config.getCategory(CONVENIENCE_SETTINGS.toLowerCase())).getChildElements();
List<IConfigElement> gui_settings = new ConfigElement(config.getCategory(GUI_SETTINGS.toLowerCase())).getChildElements();
List<IConfigElement> texture_settings = new ConfigElement(config.getCategory(VISUAL_SETTINGS.toLowerCase())).getChildElements();
List<IConfigElement> trail_settings = new ConfigElement(config.getCategory(TRAIL_SETTINGS.toLowerCase())).getChildElements();
list.add(new DummyCategoryElement(I18n.translateToLocal("config.category.convenienceSettings.title"), "config.category.convenienceSettings", convenience_settings));
list.add(new DummyCategoryElement(I18n.translateToLocal("config.category.guiSettings.title"), "config.category.guiSettings", gui_settings));
list.add(new DummyCategoryElement(I18n.translateToLocal("config.category.textureSettings.title"), "config.category.textureSettings", texture_settings));
if (TrailManager.trailsMap.containsKey(PlayerUtil.getClientPlayerUUID()))
{
list.add(new DummyCategoryElement(I18n.translateToLocal("config.category.trailSettings.title"), "config.category.trailSettings", trail_settings));
}
return list;
}
}

View file

@ -1,25 +0,0 @@
package biomesoplenty.client.gui;
import java.util.Set;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.fml.client.IModGuiFactory;
public class GuiFactory implements IModGuiFactory {
@Override
public void initialize(Minecraft minecraftInstance) { }
@Override
public Class<? extends GuiScreen> mainConfigGuiClass()
{
return GuiBOPConfig.class;
}
@Override
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() { return null; }
@Override
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) { return null; }
}

View file

@ -18,7 +18,7 @@ public class GameplayConfigurationHandler
{
public static Configuration config;
public static String convenienceSettings = "Convenience Settings";
public static final String CONVENIENCE_SETTINGS = "Convenience Settings";
public static boolean flowerDropsNeedShears;
@ -35,7 +35,7 @@ public class GameplayConfigurationHandler
{
try
{
flowerDropsNeedShears = config.getBoolean("Flower Drops Need Shears", convenienceSettings, false, "Require shears to be used to collect flower drops.");
flowerDropsNeedShears = config.getBoolean("Flower Drops Need Shears", CONVENIENCE_SETTINGS, false, "Require shears to be used to collect flower drops.");
}
catch (Exception e)
{

View file

@ -50,7 +50,7 @@ public class BiomesOPlenty
public static final String MOD_NAME = "Biomes O' Plenty";
public static final String MOD_ID = "biomesoplenty";
public static final String MOD_VERSION = "@MOD_VERSION@";
public static final String GUI_FACTORY = "biomesoplenty.client.gui.GuiFactory";
public static final String GUI_FACTORY = "biomesoplenty.client.gui.GuiBOPFactory";
@Instance(MOD_ID)
public static BiomesOPlenty instance;

View file

@ -49,10 +49,10 @@ config.category.convenienceSettings.title=Convenience Settings
config.category.guiSettings.title=GUI Settings
config.category.textureSettings.title=Texture Settings
config.category.trailSettings.title=Trail Settings
config.category.convenienceSettings.tooltip=Require shears to be used to collect flower drops.
config.category.guiSettings.tooltip=Use the Biomes O' Plenty World Type by default when selecting a world.
config.category.textureSettings.tooltip=Override the Forge bucket texture and use ours instead (It's nicer!)
config.category.trailSettings.tooltip=Modify Trail Visibility
config.category.convenienceSettings.tooltip=Settings for convenience.
config.category.guiSettings.tooltip=GUI related settings.
config.category.textureSettings.tooltip=Texture related settings.
config.category.trailSettings.tooltip=Settings to modify trail visibility.
commands.biomesoplenty.usage=/biomesoplenty <tpbiome|biomename|stripchunk> [args]
commands.biomesoplenty.biomename.usage=/biomesoplenty biomename [biomeId]