diff --git a/src/main/java/mekanism/client/ClientProxy.java b/src/main/java/mekanism/client/ClientProxy.java index 52fac665b..7f8098ea9 100644 --- a/src/main/java/mekanism/client/ClientProxy.java +++ b/src/main/java/mekanism/client/ClientProxy.java @@ -156,9 +156,7 @@ import cpw.mods.fml.relauncher.SideOnly; public class ClientProxy extends CommonProxy { public static int MACHINE_RENDER_ID = RenderingRegistry.getNextAvailableRenderId(); - public static int TRANSMITTER_RENDER_ID = RenderingRegistry.getNextAvailableRenderId(); public static int BASIC_RENDER_ID = RenderingRegistry.getNextAvailableRenderId(); - public static int PLASTIC_RENDER_ID = RenderingRegistry.getNextAvailableRenderId(); @Override public void loadConfiguration() diff --git a/src/main/java/mekanism/client/gui/ConfigGuiFactory.java b/src/main/java/mekanism/client/gui/ConfigGuiFactory.java new file mode 100644 index 000000000..48138f6bd --- /dev/null +++ b/src/main/java/mekanism/client/gui/ConfigGuiFactory.java @@ -0,0 +1,34 @@ +package mekanism.client.gui; + +import java.util.Set; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import cpw.mods.fml.client.IModGuiFactory; + +public class ConfigGuiFactory implements IModGuiFactory +{ + @Override + public void initialize(Minecraft minecraftInstance) + { + + } + + @Override + public Class mainConfigGuiClass() + { + return GuiMekanismConfig.class; + } + + @Override + public Set runtimeGuiCategories() + { + return null; + } + + @Override + public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) + { + return null; + } +} diff --git a/src/main/java/mekanism/client/gui/GuiMekanismConfig.java b/src/main/java/mekanism/client/gui/GuiMekanismConfig.java new file mode 100644 index 000000000..b90e823ce --- /dev/null +++ b/src/main/java/mekanism/client/gui/GuiMekanismConfig.java @@ -0,0 +1,66 @@ +package mekanism.client.gui; + +import java.util.ArrayList; +import java.util.List; + +import mekanism.common.Mekanism; + +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.DummyCategoryElement; +import cpw.mods.fml.client.config.GuiConfig; +import cpw.mods.fml.client.config.GuiConfigEntries; +import cpw.mods.fml.client.config.GuiConfigEntries.CategoryEntry; +import cpw.mods.fml.client.config.IConfigElement; + +public class GuiMekanismConfig extends GuiConfig +{ + public GuiMekanismConfig(GuiScreen parent) + { + super(parent, getConfigElements(), + "Mekanism", false, false, GuiConfig.getAbridgedConfigPath(Mekanism.configuration.toString())); + } + + private static List getConfigElements() + { + List list = new ArrayList(); + list.add(new DummyCategoryElement("Mekanism General Settings", "mekanism.configgui.ctgy.general", GeneralEntry.class)); + list.add(new DummyCategoryElement("Usage Settings", "mekanism.configgui.ctgy.usage", UsageEntry.class)); + return list; + } + + public static class GeneralEntry extends CategoryEntry + { + public GeneralEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop) + { + super(owningScreen, owningEntryList, prop); + } + + @Override + protected GuiScreen buildChildScreen() + { + return new GuiConfig(this.owningScreen, + new ConfigElement(Mekanism.configuration.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), + this.owningScreen.modID, Configuration.CATEGORY_GENERAL, false, false, + GuiConfig.getAbridgedConfigPath(Mekanism.configuration.toString())); + } + } + + public static class UsageEntry extends CategoryEntry + { + public UsageEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop) + { + super(owningScreen, owningEntryList, prop); + } + + @Override + protected GuiScreen buildChildScreen() + { + return new GuiConfig(this.owningScreen, + new ConfigElement(Mekanism.configuration.getCategory("usage")).getChildElements(), + this.owningScreen.modID, Configuration.CATEGORY_GENERAL, false, false, + GuiConfig.getAbridgedConfigPath(Mekanism.configuration.toString())); + } + } +} diff --git a/src/main/java/mekanism/common/Mekanism.java b/src/main/java/mekanism/common/Mekanism.java index 0b5cb5867..b0caec5cb 100644 --- a/src/main/java/mekanism/common/Mekanism.java +++ b/src/main/java/mekanism/common/Mekanism.java @@ -133,6 +133,8 @@ import org.apache.logging.log4j.Logger; import rebelkeithy.mods.metallurgy.api.IOreInfo; import rebelkeithy.mods.metallurgy.api.MetallurgyAPI; import codechicken.multipart.handler.MultipartProxy; + +import cpw.mods.fml.client.event.ConfigChangedEvent; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.IFuelHandler; import cpw.mods.fml.common.Mod; @@ -154,7 +156,7 @@ import cpw.mods.fml.common.registry.GameRegistry; * @author AidanBrady * */ -@Mod(modid = "Mekanism", name = "Mekanism", version = "7.0.0") +@Mod(modid = "Mekanism", name = "Mekanism", version = "7.0.0", guiFactory = "mekanism.client.gui.ConfigGuiFactory") public class Mekanism { /** Mekanism Packet Pipeline */ @@ -892,7 +894,6 @@ public class Mekanism public void addItems() { //Declarations - configuration.load(); PartTransmitter = new ItemPartTransmitter().setUnlocalizedName("MultipartTransmitter"); EnrichedAlloy = new ItemMekanism().setUnlocalizedName("EnrichedAlloy"); EnrichedIron = new ItemMekanism().setUnlocalizedName("EnrichedIron"); @@ -936,8 +937,6 @@ public class Mekanism BioFuel = new ItemMekanism().setUnlocalizedName("BioFuel"); GlowPanel = new ItemGlowPanel().setUnlocalizedName("GlowPanel"); - configuration.save(); - //Fluid Container stuff FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluid("brine"), new ItemStack(BrineBucket), FluidContainerRegistry.EMPTY_BUCKET); @@ -1442,4 +1441,14 @@ public class Mekanism } } } + + @SubscribeEvent + public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) + { + if(event.modID.equals("Mekanism") || event.modID.equals("MekanismGenerators") || event.modID.equals("MekanismTools")) + { + proxy.loadConfiguration(); + proxy.onConfigSync(); + } + } } diff --git a/src/main/java/mekanism/common/tile/TileEntityBasicMachine.java b/src/main/java/mekanism/common/tile/TileEntityBasicMachine.java index cc6921d65..5bbfc1036 100644 --- a/src/main/java/mekanism/common/tile/TileEntityBasicMachine.java +++ b/src/main/java/mekanism/common/tile/TileEntityBasicMachine.java @@ -22,7 +22,6 @@ import mekanism.common.util.MekanismUtils; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ResourceLocation; import cpw.mods.fml.common.Optional.Interface; -import cpw.mods.fml.common.Optional.InterfaceList; import cpw.mods.fml.common.Optional.Method; import dan200.computercraft.api.peripheral.IComputerAccess; diff --git a/src/main/java/mekanism/generators/client/gui/GeneratorsGuiFactory.java b/src/main/java/mekanism/generators/client/gui/GeneratorsGuiFactory.java new file mode 100644 index 000000000..0544b5ebc --- /dev/null +++ b/src/main/java/mekanism/generators/client/gui/GeneratorsGuiFactory.java @@ -0,0 +1,36 @@ +package mekanism.generators.client.gui; + +import java.util.Set; + +import mekanism.client.gui.GuiMekanismConfig; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import cpw.mods.fml.client.IModGuiFactory; + +public class GeneratorsGuiFactory implements IModGuiFactory +{ + @Override + public void initialize(Minecraft minecraftInstance) + { + + } + + @Override + public Class mainConfigGuiClass() + { + return GuiGeneratorsConfig.class; + } + + @Override + public Set runtimeGuiCategories() + { + return null; + } + + @Override + public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) + { + return null; + } +} diff --git a/src/main/java/mekanism/generators/client/gui/GuiGeneratorsConfig.java b/src/main/java/mekanism/generators/client/gui/GuiGeneratorsConfig.java new file mode 100644 index 000000000..4cc8732ac --- /dev/null +++ b/src/main/java/mekanism/generators/client/gui/GuiGeneratorsConfig.java @@ -0,0 +1,21 @@ +package mekanism.generators.client.gui; + +import mekanism.common.Mekanism; + +import net.minecraft.client.gui.GuiScreen; +import net.minecraftforge.common.config.ConfigElement; +import net.minecraftforge.common.config.Configuration; +import cpw.mods.fml.client.config.GuiConfig; + +/** + * Created by ben on 27/06/14. + */ +public class GuiGeneratorsConfig extends GuiConfig +{ + public GuiGeneratorsConfig(GuiScreen parent) + { + super(parent, new ConfigElement(Mekanism.configuration.getCategory("generation")).getChildElements(), + "MekanismGenerators", false, false, GuiConfig.getAbridgedConfigPath(Mekanism.configuration.toString())); + } + +} diff --git a/src/main/java/mekanism/generators/common/MekanismGenerators.java b/src/main/java/mekanism/generators/common/MekanismGenerators.java index d419cc2d9..157278459 100644 --- a/src/main/java/mekanism/generators/common/MekanismGenerators.java +++ b/src/main/java/mekanism/generators/common/MekanismGenerators.java @@ -35,7 +35,7 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.GameRegistry; -@Mod(modid = "MekanismGenerators", name = "MekanismGenerators", version = "7.0.0", dependencies = "required-after:Mekanism") +@Mod(modid = "MekanismGenerators", name = "MekanismGenerators", version = "7.0.0", dependencies = "required-after:Mekanism", guiFactory = "mekanism.generators.client.gui.GeneratorsGuiFactory") public class MekanismGenerators implements IModule { @SidedProxy(clientSide = "mekanism.generators.client.GeneratorsClientProxy", serverSide = "mekanism.generators.common.GeneratorsCommonProxy") diff --git a/src/main/java/mekanism/tools/client/gui/GuiToolsConfig.java b/src/main/java/mekanism/tools/client/gui/GuiToolsConfig.java new file mode 100644 index 000000000..ce7c84e61 --- /dev/null +++ b/src/main/java/mekanism/tools/client/gui/GuiToolsConfig.java @@ -0,0 +1,71 @@ +package mekanism.tools.client.gui; + +import java.util.ArrayList; +import java.util.List; + +import mekanism.common.Mekanism; + +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.DummyCategoryElement; +import cpw.mods.fml.client.config.GuiConfig; +import cpw.mods.fml.client.config.GuiConfigEntries; +import cpw.mods.fml.client.config.GuiConfigEntries.CategoryEntry; +import cpw.mods.fml.client.config.IConfigElement; + +/** + * Created by ben on 27/06/14. + */ +public class GuiToolsConfig extends GuiConfig +{ + public GuiToolsConfig(GuiScreen parent) + { + super(parent, getConfigElements(), + "Mekanism", false, false, GuiConfig.getAbridgedConfigPath(Mekanism.configuration.toString())); + } + + private static List getConfigElements() + { + List list = new ArrayList(); + list.add(new DummyCategoryElement("Armor Balance", "mekanism.configgui.ctgy.armor", ArmorEntry.class)); + list.add(new DummyCategoryElement("Tools Balance", "mekanism.configgui.ctgy.tools", ToolsEntry.class)); + return list; + } + + public static class ArmorEntry extends CategoryEntry + { + public ArmorEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop) + { + super(owningScreen, owningEntryList, prop); + } + + @Override + protected GuiScreen buildChildScreen() + { + return new GuiConfig(this.owningScreen, + new ConfigElement(Mekanism.configuration.getCategory("armor-balance")).getChildElements(), + this.owningScreen.modID, Configuration.CATEGORY_GENERAL, this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart, + this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, + GuiConfig.getAbridgedConfigPath(Mekanism.configuration.toString())); + } + } + + public static class ToolsEntry extends CategoryEntry + { + public ToolsEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop) + { + super(owningScreen, owningEntryList, prop); + } + + @Override + protected GuiScreen buildChildScreen() + { + return new GuiConfig(this.owningScreen, + new ConfigElement(Mekanism.configuration.getCategory("tool-balance")).getChildElements(), + this.owningScreen.modID, Configuration.CATEGORY_GENERAL, this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart, + this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, + GuiConfig.getAbridgedConfigPath(Mekanism.configuration.toString())); + } + } +} diff --git a/src/main/java/mekanism/tools/client/gui/ToolsGuiFactory.java b/src/main/java/mekanism/tools/client/gui/ToolsGuiFactory.java new file mode 100644 index 000000000..80da391be --- /dev/null +++ b/src/main/java/mekanism/tools/client/gui/ToolsGuiFactory.java @@ -0,0 +1,36 @@ +package mekanism.tools.client.gui; + +import java.util.Set; + + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import cpw.mods.fml.client.IModGuiFactory; + +public class ToolsGuiFactory implements IModGuiFactory +{ + @Override + public void initialize(Minecraft minecraftInstance) + { + + } + + @Override + public Class mainConfigGuiClass() + { + return GuiToolsConfig.class; + } + + @Override + public Set runtimeGuiCategories() + { + return null; + } + + @Override + public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) + { + return null; + } +} + diff --git a/src/main/java/mekanism/tools/common/MekanismTools.java b/src/main/java/mekanism/tools/common/MekanismTools.java index 076a1fc8b..474e91529 100644 --- a/src/main/java/mekanism/tools/common/MekanismTools.java +++ b/src/main/java/mekanism/tools/common/MekanismTools.java @@ -33,7 +33,7 @@ import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; -@Mod(modid = "MekanismTools", name = "MekanismTools", version = "7.0.0", dependencies = "required-after:Mekanism") +@Mod(modid = "MekanismTools", name = "MekanismTools", version = "7.0.0", dependencies = "required-after:Mekanism", guiFactory = "mekanism.tools.client.gui.ToolsGuiFactory") public class MekanismTools implements IModule { @SidedProxy(clientSide = "mekanism.tools.client.ToolsClientProxy", serverSide = "mekanism.tools.common.ToolsCommonProxy")