From c8fcb292d44fc13ccf207bce8947ab110a49b5a4 Mon Sep 17 00:00:00 2001 From: mezz Date: Sun, 26 Mar 2017 06:20:08 -0700 Subject: [PATCH] Fix sided config options --- src/main/java/forestry/Forestry.java | 2 +- .../java/forestry/core/config/Config.java | 29 +++++++++---------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/main/java/forestry/Forestry.java b/src/main/java/forestry/Forestry.java index f9c4f7b70..ba3ae1abd 100644 --- a/src/main/java/forestry/Forestry.java +++ b/src/main/java/forestry/Forestry.java @@ -93,7 +93,7 @@ public class Forestry { Proxies.common.registerEventHandlers(); configFolder = new File(event.getModConfigurationDirectory(), Constants.MOD_ID); - Config.load(); + Config.load(event.getSide()); PluginManager.runSetup(event); diff --git a/src/main/java/forestry/core/config/Config.java b/src/main/java/forestry/core/config/Config.java index 03d87ce79..88959fbe2 100755 --- a/src/main/java/forestry/core/config/Config.java +++ b/src/main/java/forestry/core/config/Config.java @@ -30,6 +30,7 @@ import forestry.core.utils.Log; import forestry.core.utils.Translator; import forestry.mail.gui.GuiMailboxInfo; import net.minecraftforge.common.config.Property; +import net.minecraftforge.fml.relauncher.Side; public class Config { @@ -50,8 +51,6 @@ public class Config { public static boolean isDebug = false; - public static boolean enablePermissions = true; - // Graphics public static boolean enableParticleFX = true; @@ -131,9 +130,9 @@ public class Config { return enableMagicalCropsSupport; } - public static void load() { + public static void load(Side side) { File configCommonFile = new File(Forestry.instance.getConfigFolder(), CATEGORY_COMMON + ".cfg"); - loadConfigCommon(configCommonFile); + loadConfigCommon(side, configCommonFile); File configFluidsFile = new File(Forestry.instance.getConfigFolder(), CATEGORY_FLUIDS + ".cfg"); loadConfigFluids(configFluidsFile); @@ -141,7 +140,7 @@ public class Config { loadHints(); } - private static void loadConfigCommon(File configFileCommon) { + private static void loadConfigCommon(Side side, File configFileCommon) { configCommon = new LocalizedConfiguration(configFileCommon, "1.2.0"); @@ -167,8 +166,6 @@ public class Config { CopyFileToFS(hardMode, "/config/forestry/gamemodes/HARD.cfg"); } - enableParticleFX = configCommon.getBooleanLocalized("performance", "particleFX", enableParticleFX); - // RetroGen doRetrogen = configCommon.getBooleanLocalized("world.generate.retrogen", "normal", doRetrogen); @@ -221,16 +218,18 @@ public class Config { //harvesterThrottle = configCommon.getIntLocalized("performance", "performance.harvester", harvesterThrottle, 1, 2000); //propThrottle.Comment = "higher numbers increase working speeds of harvesters but also increase cpu load."; - - mailAlertEnabled = configCommon.getBooleanLocalized("tweaks.gui.mail.alert", "enabled", mailAlertEnabled); - mailAlertXPosition = configCommon.getEnumLocalized("tweaks.gui.mail.alert", "xPosition", mailAlertXPosition, GuiMailboxInfo.XPosition.values()); - mailAlertYPosition = configCommon.getEnumLocalized("tweaks.gui.mail.alert", "yPosition", mailAlertYPosition, GuiMailboxInfo.YPosition.values()); - guiTabSpeed = configCommon.getIntLocalized("tweaks.gui.tabs", "speed", guiTabSpeed, 1, 50); - enableHints = configCommon.getBooleanLocalized("tweaks.gui.tabs", "hints", enableHints); - enableEnergyStat = configCommon.getBooleanLocalized("tweaks.gui.tabs", "energy", enableEnergyStat); + if (side == Side.CLIENT) { + mailAlertEnabled = configCommon.getBooleanLocalized("tweaks.gui.mail.alert", "enabled", mailAlertEnabled); + mailAlertXPosition = configCommon.getEnumLocalized("tweaks.gui.mail.alert", "xPosition", mailAlertXPosition, GuiMailboxInfo.XPosition.values()); + mailAlertYPosition = configCommon.getEnumLocalized("tweaks.gui.mail.alert", "yPosition", mailAlertYPosition, GuiMailboxInfo.YPosition.values()); - enablePermissions = configCommon.getBooleanLocalized("tweaks", "permissions", enablePermissions); + guiTabSpeed = configCommon.getIntLocalized("tweaks.gui.tabs", "speed", guiTabSpeed, 1, 50); + enableHints = configCommon.getBooleanLocalized("tweaks.gui.tabs", "hints", enableHints); + enableEnergyStat = configCommon.getBooleanLocalized("tweaks.gui.tabs", "energy", enableEnergyStat); + + enableParticleFX = configCommon.getBooleanLocalized("performance", "particleFX", enableParticleFX); + } farmSize = configCommon.getIntLocalized("tweaks.farms", "size", farmSize, 1, 3); squareFarms = configCommon.getBooleanLocalized("tweaks.farms", "square", squareFarms);