Clean up configs a lot; Fix Config GUIs. This will require people to sort out their configs on their own, as things have moved.

This commit is contained in:
Ben Spiers 2014-07-07 21:17:15 +01:00
parent f67be01658
commit df58560729
10 changed files with 171 additions and 182 deletions

View file

@ -164,13 +164,14 @@ public class ClientProxy extends CommonProxy
{ {
super.loadConfiguration(); super.loadConfiguration();
Mekanism.configuration.load();
MekanismClient.enableSounds = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnableSounds", true).getBoolean(true); MekanismClient.enableSounds = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnableSounds", true).getBoolean(true);
MekanismClient.fancyUniversalCableRender = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "FancyUniversalCableRender", true).getBoolean(true); MekanismClient.fancyUniversalCableRender = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "FancyUniversalCableRender", true).getBoolean(true);
MekanismClient.holidays = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "Holidays", true).getBoolean(true); MekanismClient.holidays = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "Holidays", true).getBoolean(true);
MekanismClient.baseSoundVolume = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "SoundVolume", 1D).getDouble(1D); MekanismClient.baseSoundVolume = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "SoundVolume", 1D).getDouble(1D);
MekanismClient.machineEffects = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "MachineEffects", true).getBoolean(true); MekanismClient.machineEffects = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "MachineEffects", true).getBoolean(true);
Mekanism.configuration.save();
if(Mekanism.configuration.hasChanged())
Mekanism.configuration.save();
} }
@Override @Override

View file

@ -182,19 +182,14 @@ public class CommonProxy
*/ */
public void loadConfiguration() public void loadConfiguration()
{ {
Mekanism.configuration.load();
Mekanism.osmiumGenerationEnabled = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "OsmiumGenerationEnabled", true).getBoolean(true); Mekanism.osmiumGenerationEnabled = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "OsmiumGenerationEnabled", true).getBoolean(true);
Mekanism.copperGenerationEnabled = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "CopperGenerationEnabled", true).getBoolean(true); Mekanism.copperGenerationEnabled = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "CopperGenerationEnabled", true).getBoolean(true);
Mekanism.tinGenerationEnabled = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "TinGenerationEnabled", true).getBoolean(true); Mekanism.tinGenerationEnabled = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "TinGenerationEnabled", true).getBoolean(true);
Mekanism.disableBCSteelCrafting = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "DisableBCSteelCrafting", false).getBoolean(false);
Mekanism.disableBCBronzeCrafting = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "DisableBCBronzeCrafting", false).getBoolean(false);
Mekanism.updateNotifications = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "UpdateNotifications", true).getBoolean(true); Mekanism.updateNotifications = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "UpdateNotifications", true).getBoolean(true);
Mekanism.controlCircuitOreDict = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ControlCircuitOreDict", true).getBoolean(true); Mekanism.controlCircuitOreDict = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ControlCircuitOreDict", true).getBoolean(true);
Mekanism.logPackets = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "LogPackets", false).getBoolean(false); Mekanism.logPackets = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "LogPackets", false).getBoolean(false);
Mekanism.dynamicTankEasterEgg = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "DynamicTankEasterEgg", false).getBoolean(true); Mekanism.dynamicTankEasterEgg = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "DynamicTankEasterEgg", false).getBoolean(true);
Mekanism.voiceServerEnabled = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "VoiceServerEnabled", true).getBoolean(true); Mekanism.voiceServerEnabled = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "VoiceServerEnabled", true).getBoolean(true);
Mekanism.forceBuildcraft = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ForceBuildcraftPower", false).getBoolean(false);
Mekanism.cardboardSpawners = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "AllowSpawnerBoxPickup", true).getBoolean(true); Mekanism.cardboardSpawners = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "AllowSpawnerBoxPickup", true).getBoolean(true);
Mekanism.obsidianTNTDelay = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ObsidianTNTDelay", 100).getInt(); Mekanism.obsidianTNTDelay = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ObsidianTNTDelay", 100).getInt();
Mekanism.obsidianTNTBlastRadius = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ObsidianTNTBlastRadius", 12).getInt(); Mekanism.obsidianTNTBlastRadius = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ObsidianTNTBlastRadius", 12).getInt();
@ -208,11 +203,11 @@ public class CommonProxy
Mekanism.TO_BC = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "MJToJoules", .04D).getDouble(.04D); Mekanism.TO_BC = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "MJToJoules", .04D).getDouble(.04D);
Mekanism.FROM_H2 = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "HydrogenEnergyDensity", 2000D).getDouble(2000D); Mekanism.FROM_H2 = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "HydrogenEnergyDensity", 2000D).getDouble(2000D);
Mekanism.ENERGY_PER_REDSTONE = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnergyPerRedstone", 10000D).getDouble(10000D); Mekanism.ENERGY_PER_REDSTONE = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnergyPerRedstone", 10000D).getDouble(10000D);
Mekanism.VOICE_PORT = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "VoicePort", 36123).getInt(); Mekanism.VOICE_PORT = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "VoicePort", 36123, null, 1, 65535).getInt();
//If this is less than 1, upgrades make machines worse. If less than 0, I don't even know. //If this is less than 1, upgrades make machines worse. If less than 0, I don't even know.
Mekanism.maxUpgradeMultiplier = Math.max(1, Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "UpgradeModifier", 10).getInt()); Mekanism.maxUpgradeMultiplier = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "UpgradeModifier", 10, null, 1, Integer.MAX_VALUE).getInt();
String s = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnergyType", "J").getString(); String s = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnergyType", "J", null, new String[]{"J", "RF", "MJ", "EU"}).getString();
if(s != null) if(s != null)
{ {
@ -266,7 +261,9 @@ public class CommonProxy
Mekanism.seismicVibratorUsage = Mekanism.configuration.get("usage", "SeismicVibratorUsage", 50D).getDouble(50D); Mekanism.seismicVibratorUsage = Mekanism.configuration.get("usage", "SeismicVibratorUsage", 50D).getDouble(50D);
Mekanism.pressurizedReactionBaseUsage = Mekanism.configuration.get("usage", "PressurizedReactionBaseUsage", 5D).getDouble(5D); Mekanism.pressurizedReactionBaseUsage = Mekanism.configuration.get("usage", "PressurizedReactionBaseUsage", 5D).getDouble(5D);
Mekanism.fluidicPlenisherUsage = Mekanism.configuration.get("usage", "FluidicPlenisherUsage", 100D).getDouble(100D); Mekanism.fluidicPlenisherUsage = Mekanism.configuration.get("usage", "FluidicPlenisherUsage", 100D).getDouble(100D);
Mekanism.configuration.save();
if(Mekanism.configuration.hasChanged())
Mekanism.configuration.save();
} }
/** /**

View file

@ -287,14 +287,11 @@ public class Mekanism
public static boolean osmiumGenerationEnabled = true; public static boolean osmiumGenerationEnabled = true;
public static boolean copperGenerationEnabled = true; public static boolean copperGenerationEnabled = true;
public static boolean tinGenerationEnabled = true; public static boolean tinGenerationEnabled = true;
public static boolean disableBCBronzeCrafting = true;
public static boolean disableBCSteelCrafting = true;
public static boolean updateNotifications = true; public static boolean updateNotifications = true;
public static boolean controlCircuitOreDict = true; public static boolean controlCircuitOreDict = true;
public static boolean logPackets = false; public static boolean logPackets = false;
public static boolean dynamicTankEasterEgg = false; public static boolean dynamicTankEasterEgg = false;
public static boolean voiceServerEnabled = true; public static boolean voiceServerEnabled = true;
public static boolean forceBuildcraft = false;
public static boolean cardboardSpawners = true; public static boolean cardboardSpawners = true;
public static boolean machineEffects = true; public static boolean machineEffects = true;
public static int obsidianTNTBlastRadius = 12; public static int obsidianTNTBlastRadius = 12;
@ -1310,6 +1307,7 @@ public class Mekanism
new ThreadGetData(); new ThreadGetData();
//Register to receive subscribed events //Register to receive subscribed events
FMLCommonHandler.instance().bus().register(this);
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
//Set up VoiceServerManager //Set up VoiceServerManager
@ -1454,7 +1452,7 @@ public class Mekanism
@SubscribeEvent @SubscribeEvent
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event)
{ {
if(event.modID.equals("Mekanism") || event.modID.equals("MekanismGenerators") || event.modID.equals("MekanismTools")) if(event.modID.equals("Mekanism"))
{ {
proxy.loadConfiguration(); proxy.loadConfiguration();
proxy.onConfigSync(); proxy.onConfigSync();

View file

@ -53,7 +53,6 @@ public final class MekanismHooks
if(ModAPIManager.INSTANCE.hasAPI("CoFHAPI|energy")) RedstoneFluxLoaded = true; if(ModAPIManager.INSTANCE.hasAPI("CoFHAPI|energy")) RedstoneFluxLoaded = true;
if(Loader.isModLoaded("IC2")) IC2Loaded = true; if(Loader.isModLoaded("IC2")) IC2Loaded = true;
if(Loader.isModLoaded("Railcraft")) RailcraftLoaded = true; if(Loader.isModLoaded("Railcraft")) RailcraftLoaded = true;
if(Loader.isModLoaded("BasicComponents")) BasicComponentsLoaded = true;
if(Loader.isModLoaded("ThermalExpansion")) TELoaded = true; if(Loader.isModLoaded("ThermalExpansion")) TELoaded = true;
if(Loader.isModLoaded("ComputerCraft")) CCLoaded = true; if(Loader.isModLoaded("ComputerCraft")) CCLoaded = true;
@ -70,23 +69,6 @@ public final class MekanismHooks
Mekanism.logger.info("Hooked into IC2 successfully."); Mekanism.logger.info("Hooked into IC2 successfully.");
} }
if(BasicComponentsLoaded)
{
if(Mekanism.disableBCSteelCrafting)
{
MekanismUtils.removeRecipes(getBasicComponentsItem("itemSteelDust"));
MekanismUtils.removeRecipes(getBasicComponentsItem("itemSteelIngot"));
}
if(Mekanism.disableBCBronzeCrafting)
{
MekanismUtils.removeRecipes(getBasicComponentsItem("itemBronzeDust"));
MekanismUtils.removeRecipes(getBasicComponentsItem("itemBronzeIngot"));
}
Mekanism.logger.info("Hooked into BasicComponents successfully.");
}
if(BuildCraftPowerLoaded) if(BuildCraftPowerLoaded)
{ {
Mekanism.logger.info("Hooked into BuildCraft successfully."); Mekanism.logger.info("Hooked into BuildCraft successfully.");
@ -197,28 +179,4 @@ public final class MekanismHooks
return null; return null;
} }
} }
public ItemStack getBasicComponentsItem(String name)
{
try {
if(BasicComponents == null) BasicComponents = Class.forName("basiccomponents.common.BasicComponents");
if(BasicComponents == null) BasicComponents = Class.forName("net.minecraft.src.basiccomponents.common.BasicComponents");
Object ret = BasicComponents.getField(name).get(null);
if(ret instanceof Item)
{
return new ItemStack((Item)ret);
}
else if(ret instanceof Block)
{
return new ItemStack((Block)ret);
}
else {
throw new Exception("not instanceof ItemStack");
}
} catch(Exception e) {
Mekanism.logger.error("Unable to retrieve Basic Components item " + name + ".");
return null;
}
}
} }

View file

@ -27,14 +27,11 @@ public class PacketConfigSync implements IMessageHandler<ConfigSyncMessage, IMes
dataStream.writeBoolean(Mekanism.osmiumGenerationEnabled); dataStream.writeBoolean(Mekanism.osmiumGenerationEnabled);
dataStream.writeBoolean(Mekanism.copperGenerationEnabled); dataStream.writeBoolean(Mekanism.copperGenerationEnabled);
dataStream.writeBoolean(Mekanism.tinGenerationEnabled); dataStream.writeBoolean(Mekanism.tinGenerationEnabled);
dataStream.writeBoolean(Mekanism.disableBCSteelCrafting);
dataStream.writeBoolean(Mekanism.disableBCBronzeCrafting);
dataStream.writeBoolean(Mekanism.updateNotifications); dataStream.writeBoolean(Mekanism.updateNotifications);
dataStream.writeBoolean(Mekanism.controlCircuitOreDict); dataStream.writeBoolean(Mekanism.controlCircuitOreDict);
dataStream.writeBoolean(Mekanism.logPackets); dataStream.writeBoolean(Mekanism.logPackets);
dataStream.writeBoolean(Mekanism.dynamicTankEasterEgg); dataStream.writeBoolean(Mekanism.dynamicTankEasterEgg);
dataStream.writeBoolean(Mekanism.voiceServerEnabled); dataStream.writeBoolean(Mekanism.voiceServerEnabled);
dataStream.writeBoolean(Mekanism.forceBuildcraft);
dataStream.writeBoolean(Mekanism.cardboardSpawners); dataStream.writeBoolean(Mekanism.cardboardSpawners);
dataStream.writeInt(Mekanism.obsidianTNTDelay); dataStream.writeInt(Mekanism.obsidianTNTDelay);
dataStream.writeInt(Mekanism.obsidianTNTBlastRadius); dataStream.writeInt(Mekanism.obsidianTNTBlastRadius);
@ -89,14 +86,11 @@ public class PacketConfigSync implements IMessageHandler<ConfigSyncMessage, IMes
Mekanism.osmiumGenerationEnabled = dataStream.readBoolean(); Mekanism.osmiumGenerationEnabled = dataStream.readBoolean();
Mekanism.copperGenerationEnabled = dataStream.readBoolean(); Mekanism.copperGenerationEnabled = dataStream.readBoolean();
Mekanism.tinGenerationEnabled = dataStream.readBoolean(); Mekanism.tinGenerationEnabled = dataStream.readBoolean();
Mekanism.disableBCSteelCrafting = dataStream.readBoolean();
Mekanism.disableBCBronzeCrafting = dataStream.readBoolean();
Mekanism.updateNotifications = dataStream.readBoolean(); Mekanism.updateNotifications = dataStream.readBoolean();
Mekanism.controlCircuitOreDict = dataStream.readBoolean(); Mekanism.controlCircuitOreDict = dataStream.readBoolean();
Mekanism.logPackets = dataStream.readBoolean(); Mekanism.logPackets = dataStream.readBoolean();
Mekanism.dynamicTankEasterEgg = dataStream.readBoolean(); Mekanism.dynamicTankEasterEgg = dataStream.readBoolean();
Mekanism.voiceServerEnabled = dataStream.readBoolean(); Mekanism.voiceServerEnabled = dataStream.readBoolean();
Mekanism.forceBuildcraft = dataStream.readBoolean();
Mekanism.cardboardSpawners = dataStream.readBoolean(); Mekanism.cardboardSpawners = dataStream.readBoolean();
Mekanism.obsidianTNTDelay = dataStream.readInt(); Mekanism.obsidianTNTDelay = dataStream.readInt();
Mekanism.obsidianTNTBlastRadius = dataStream.readInt(); Mekanism.obsidianTNTBlastRadius = dataStream.readInt();

View file

@ -48,13 +48,14 @@ public class GeneratorsCommonProxy
*/ */
public void loadConfiguration() public void loadConfiguration()
{ {
Mekanism.configuration.load();
MekanismGenerators.advancedSolarGeneration = Mekanism.configuration.get("generation", "AdvancedSolarGeneration", 300D).getDouble(300D); MekanismGenerators.advancedSolarGeneration = Mekanism.configuration.get("generation", "AdvancedSolarGeneration", 300D).getDouble(300D);
MekanismGenerators.bioGeneration = Mekanism.configuration.get("generation", "BioGeneration", 350D).getDouble(350D); MekanismGenerators.bioGeneration = Mekanism.configuration.get("generation", "BioGeneration", 350D).getDouble(350D);
MekanismGenerators.heatGeneration = Mekanism.configuration.get("generation", "HeatGeneration", 150D).getDouble(150D); MekanismGenerators.heatGeneration = Mekanism.configuration.get("generation", "HeatGeneration", 150D).getDouble(150D);
MekanismGenerators.solarGeneration = Mekanism.configuration.get("generation", "SolarGeneration", 50D).getDouble(50D); MekanismGenerators.solarGeneration = Mekanism.configuration.get("generation", "SolarGeneration", 50D).getDouble(50D);
MekanismGenerators.windGeneration = Mekanism.configuration.get("generation", "WindGeneration", 60D).getDouble(60D); MekanismGenerators.windGeneration = Mekanism.configuration.get("generation", "WindGeneration", 60D).getDouble(60D);
Mekanism.configuration.save();
if(Mekanism.configuration.hasChanged())
Mekanism.configuration.save();
} }
/** /**

View file

@ -25,6 +25,8 @@ import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidRegistry;
import buildcraft.api.fuels.IronEngineFuel; import buildcraft.api.fuels.IronEngineFuel;
import cpw.mods.fml.client.event.ConfigChangedEvent.OnConfigChangedEvent;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.Instance;
@ -32,6 +34,7 @@ import cpw.mods.fml.common.ModAPIManager;
import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
@ -87,6 +90,7 @@ public class MekanismGenerators implements IModule
//Set up the GUI handler //Set up the GUI handler
NetworkRegistry.INSTANCE.registerGuiHandler(this, new GeneratorsGuiHandler()); NetworkRegistry.INSTANCE.registerGuiHandler(this, new GeneratorsGuiHandler());
FMLCommonHandler.instance().bus().register(this);
//Load the proxy //Load the proxy
proxy.loadConfiguration(); proxy.loadConfiguration();
@ -141,9 +145,7 @@ public class MekanismGenerators implements IModule
public void addItems() public void addItems()
{ {
//Declarations //Declarations
Mekanism.configuration.load();
SolarPanel = new ItemMekanism().setUnlocalizedName("SolarPanel"); SolarPanel = new ItemMekanism().setUnlocalizedName("SolarPanel");
Mekanism.configuration.save();
//Registrations //Registrations
GameRegistry.registerItem(SolarPanel, "SolarPanel"); GameRegistry.registerItem(SolarPanel, "SolarPanel");
@ -180,4 +182,13 @@ public class MekanismGenerators implements IModule
solarGeneration = dataStream.readDouble(); solarGeneration = dataStream.readDouble();
windGeneration = dataStream.readDouble(); windGeneration = dataStream.readDouble();
} }
@SubscribeEvent
public void onConfigChanged(OnConfigChangedEvent event)
{
if(event.modID.equals("MekanismGenerators"))
{
proxy.loadConfiguration();
}
}
} }

View file

@ -28,11 +28,30 @@ public class GuiToolsConfig extends GuiConfig
private static List<IConfigElement> getConfigElements() private static List<IConfigElement> getConfigElements()
{ {
List<IConfigElement> list = new ArrayList<IConfigElement>(); List<IConfigElement> list = new ArrayList<IConfigElement>();
list.add(new DummyCategoryElement("Armor Balance", "mekanism.configgui.ctgy.armor", ArmorEntry.class)); list.add(new DummyCategoryElement("General", "mekanism.configgui.ctgy.tools.general", GeneralEntry.class));
list.add(new DummyCategoryElement("Tools Balance", "mekanism.configgui.ctgy.tools", ToolsEntry.class)); list.add(new DummyCategoryElement("Armor Balance", "mekanism.configgui.ctgy.tools.armor", ArmorEntry.class));
list.add(new DummyCategoryElement("Tools Balance", "mekanism.configgui.ctgy.tools.tools", ToolsEntry.class));
return list; 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("tools.general")).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 ArmorEntry extends CategoryEntry public static class ArmorEntry extends CategoryEntry
{ {
public ArmorEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop) public ArmorEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop)
@ -44,7 +63,7 @@ public class GuiToolsConfig extends GuiConfig
protected GuiScreen buildChildScreen() protected GuiScreen buildChildScreen()
{ {
return new GuiConfig(this.owningScreen, return new GuiConfig(this.owningScreen,
new ConfigElement(Mekanism.configuration.getCategory("armor-balance")).getChildElements(), new ConfigElement(Mekanism.configuration.getCategory("tools.armor-balance")).getChildElements(),
this.owningScreen.modID, Configuration.CATEGORY_GENERAL, this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart, this.owningScreen.modID, Configuration.CATEGORY_GENERAL, this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,
this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart,
GuiConfig.getAbridgedConfigPath(Mekanism.configuration.toString())); GuiConfig.getAbridgedConfigPath(Mekanism.configuration.toString()));
@ -62,7 +81,7 @@ public class GuiToolsConfig extends GuiConfig
protected GuiScreen buildChildScreen() protected GuiScreen buildChildScreen()
{ {
return new GuiConfig(this.owningScreen, return new GuiConfig(this.owningScreen,
new ConfigElement(Mekanism.configuration.getCategory("tool-balance")).getChildElements(), new ConfigElement(Mekanism.configuration.getCategory("tools.tool-balance")).getChildElements(),
this.owningScreen.modID, Configuration.CATEGORY_GENERAL, this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart, this.owningScreen.modID, Configuration.CATEGORY_GENERAL, this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,
this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart,
GuiConfig.getAbridgedConfigPath(Mekanism.configuration.toString())); GuiConfig.getAbridgedConfigPath(Mekanism.configuration.toString()));

View file

@ -26,11 +26,14 @@ import net.minecraft.item.crafting.CraftingManager;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.event.entity.living.LivingSpawnEvent; import net.minecraftforge.event.entity.living.LivingSpawnEvent;
import cpw.mods.fml.client.event.ConfigChangedEvent.OnConfigChangedEvent;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
@Mod(modid = "MekanismTools", name = "MekanismTools", version = "7.0.0", dependencies = "required-after:Mekanism", guiFactory = "mekanism.tools.client.gui.ToolsGuiFactory") @Mod(modid = "MekanismTools", name = "MekanismTools", version = "7.0.0", dependencies = "required-after:Mekanism", guiFactory = "mekanism.tools.client.gui.ToolsGuiFactory")
@ -147,7 +150,7 @@ public class MekanismTools implements IModule
public static Item SteelBoots; public static Item SteelBoots;
//Tools Configuration //Tools Configuration
public static double armourSpawnRate; public static double armorSpawnRate;
@EventHandler @EventHandler
public void init(FMLInitializationEvent event) public void init(FMLInitializationEvent event)
@ -157,6 +160,7 @@ public class MekanismTools implements IModule
//Register this class to the event bus for special mob spawning (mobs with Mekanism armor/tools) //Register this class to the event bus for special mob spawning (mobs with Mekanism armor/tools)
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
FMLCommonHandler.instance().bus().register(this);
//Load the proxy //Load the proxy
proxy.loadConfiguration(); proxy.loadConfiguration();
@ -384,161 +388,158 @@ public class MekanismTools implements IModule
public void addItems() public void addItems()
{ {
//Declarations
Mekanism.configuration.load();
//Tools //Tools
toolOBSIDIAN = EnumHelper.addToolMaterial("OBSIDIAN" toolOBSIDIAN = EnumHelper.addToolMaterial("OBSIDIAN"
, Mekanism.configuration.get("tool-balance", "obsidian-harvestLevel", 3).getInt() , Mekanism.configuration.get("tools.tool-balance.obsidian.regular", "harvestLevel", 3).getInt()
, Mekanism.configuration.get("tool-balance", "obsidian-maxUses", 2500).getInt() , Mekanism.configuration.get("tools.tool-balance.obsidian.regular", "maxUses", 2500).getInt()
, (float)Mekanism.configuration.get("tool-balance", "obsidian-efficiency", 20d).getDouble(0) , (float)Mekanism.configuration.get("tools.tool-balance.obsidian.regular", "efficiency", 20d).getDouble(0)
, Mekanism.configuration.get("tool-balance", "obsidian-damage", 10).getInt() , Mekanism.configuration.get("tools.tool-balance.obsidian.regular", "damage", 10).getInt()
, Mekanism.configuration.get("tool-balance", "obsidian-enchantability", 100).getInt() , Mekanism.configuration.get("tools.tool-balance.obsidian.regular", "enchantability", 100).getInt()
); );
toolOBSIDIAN2 = EnumHelper.addToolMaterial("OBSIDIAN2" toolOBSIDIAN2 = EnumHelper.addToolMaterial("OBSIDIAN2"
, Mekanism.configuration.get("tool-balance", "obsidian-paxel-harvestLevel", 3).getInt() , Mekanism.configuration.get("tools.tool-balance.obsidian.paxel", "harvestLevel", 3).getInt()
, Mekanism.configuration.get("tool-balance", "obsidian-paxel-maxUses", 3000).getInt() , Mekanism.configuration.get("tools.tool-balance.obsidian.paxel", "maxUses", 3000).getInt()
, (float)Mekanism.configuration.get("tool-balance", "obsidian-paxel-efficiency", 25d).getDouble(0) , (float)Mekanism.configuration.get("tools.tool-balance.obsidian.paxel", "efficiency", 25d).getDouble(0)
, Mekanism.configuration.get("tool-balance", "obsidian-paxel-damage", 10).getInt() , Mekanism.configuration.get("tools.tool-balance.obsidian.paxel", "damage", 10).getInt()
, Mekanism.configuration.get("tool-balance", "obsidian-paxel-enchantability", 100).getInt() , Mekanism.configuration.get("tools.tool-balance.obsidian.paxel", "enchantability", 100).getInt()
); );
toolLAZULI = EnumHelper.addToolMaterial("LAZULI" toolLAZULI = EnumHelper.addToolMaterial("LAZULI"
, Mekanism.configuration.get("tool-balance", "lazuli-harvestLevel", 2).getInt() , Mekanism.configuration.get("tools.tool-balance.lapis.regular", "harvestLevel", 2).getInt()
, Mekanism.configuration.get("tool-balance", "lazuli-maxUses", 200).getInt() , Mekanism.configuration.get("tools.tool-balance.lapis.regular", "maxUses", 200).getInt()
, (float)Mekanism.configuration.get("tool-balance", "lazuli-efficiency", 5d).getDouble(0) , (float)Mekanism.configuration.get("tools.tool-balance.lapis.regular", "efficiency", 5d).getDouble(0)
, Mekanism.configuration.get("tool-balance", "lazuli-damage", 2).getInt() , Mekanism.configuration.get("tools.tool-balance.lapis.regular", "damage", 2).getInt()
, Mekanism.configuration.get("tool-balance", "lazuli-enchantability", 22).getInt() , Mekanism.configuration.get("tools.tool-balance.lapis.regular", "enchantability", 22).getInt()
); );
toolLAZULI2 = EnumHelper.addToolMaterial("LAZULI2" toolLAZULI2 = EnumHelper.addToolMaterial("LAZULI2"
, Mekanism.configuration.get("tool-balance", "lazuli-paxel-harvestLevel", 2).getInt() , Mekanism.configuration.get("tools.tool-balance.lapis.paxel", "harvestLevel", 2).getInt()
, Mekanism.configuration.get("tool-balance", "lazuli-paxel-maxUses", 250).getInt() , Mekanism.configuration.get("tools.tool-balance.lapis.paxel", "maxUses", 250).getInt()
, (float)Mekanism.configuration.get("tool-balance", "lazuli-paxel-efficiency", 6d).getDouble(0) , (float)Mekanism.configuration.get("tools.tool-balance.lapis.paxel", "efficiency", 6d).getDouble(0)
, Mekanism.configuration.get("tool-balance", "lazuli-paxel-damage", 4).getInt() , Mekanism.configuration.get("tools.tool-balance.lapis.paxel", "damage", 4).getInt()
, Mekanism.configuration.get("tool-balance", "lazuli-paxel-enchantability", 50).getInt() , Mekanism.configuration.get("tools.tool-balance.lapis.paxel", "enchantability", 50).getInt()
); );
toolOSMIUM = EnumHelper.addToolMaterial("OSMIUM" toolOSMIUM = EnumHelper.addToolMaterial("OSMIUM"
, Mekanism.configuration.get("tool-balance", "osmium-harvestLevel", 2).getInt() , Mekanism.configuration.get("tools.tool-balance.osmium.regular", "harvestLevel", 2).getInt()
, Mekanism.configuration.get("tool-balance", "osmium-maxUses", 500).getInt() , Mekanism.configuration.get("tools.tool-balance.osmium.regular", "maxUses", 500).getInt()
, (float)Mekanism.configuration.get("tool-balance", "osmium-efficiency", 10d).getDouble(0) , (float)Mekanism.configuration.get("tools.tool-balance.osmium.regular", "efficiency", 10d).getDouble(0)
, Mekanism.configuration.get("tool-balance", "osmium-damage", 4).getInt() , Mekanism.configuration.get("tools.tool-balance.osmium.regular", "damage", 4).getInt()
, Mekanism.configuration.get("tool-balance", "osmium-enchantability", 30).getInt() , Mekanism.configuration.get("tools.tool-balance.osmium.regular", "enchantability", 30).getInt()
); );
toolOSMIUM2 = EnumHelper.addToolMaterial("OSMIUM2" toolOSMIUM2 = EnumHelper.addToolMaterial("OSMIUM2"
, Mekanism.configuration.get("tool-balance", "osmium-paxel-harvestLevel", 3).getInt() , Mekanism.configuration.get("tools.tool-balance.osmium.paxel", "harvestLevel", 3).getInt()
, Mekanism.configuration.get("tool-balance", "osmium-paxel-maxUses", 700).getInt() , Mekanism.configuration.get("tools.tool-balance.osmium.paxel", "maxUses", 700).getInt()
, (float)Mekanism.configuration.get("tool-balance", "osmium-paxel-efficiency", 12d).getDouble(0) , (float)Mekanism.configuration.get("tools.tool-balance.osmium.paxel", "efficiency", 12d).getDouble(0)
, Mekanism.configuration.get("tool-balance", "osmium-paxel-damage", 5).getInt() , Mekanism.configuration.get("tools.tool-balance.osmium.paxel", "damage", 5).getInt()
, Mekanism.configuration.get("tool-balance", "osmium-paxel-enchantability", 40).getInt() , Mekanism.configuration.get("tools.tool-balance.osmium.paxel", "enchantability", 40).getInt()
); );
toolBRONZE = EnumHelper.addToolMaterial("BRONZE" toolBRONZE = EnumHelper.addToolMaterial("BRONZE"
, Mekanism.configuration.get("tool-balance", "bronze-harvestLevel", 2).getInt() , Mekanism.configuration.get("tools.tool-balance.bronze.regular", "harvestLevel", 2).getInt()
, Mekanism.configuration.get("tool-balance", "bronze-maxUses", 800).getInt() , Mekanism.configuration.get("tools.tool-balance.bronze.regular", "maxUses", 800).getInt()
, (float)Mekanism.configuration.get("tool-balance", "bronze-efficiency", 14d).getDouble(0) , (float)Mekanism.configuration.get("tools.tool-balance.bronze.regular", "efficiency", 14d).getDouble(0)
, Mekanism.configuration.get("tool-balance", "bronze-damage", 6).getInt() , Mekanism.configuration.get("tools.tool-balance.bronze.regular", "damage", 6).getInt()
, Mekanism.configuration.get("tool-balance", "bronze-enchantability", 100).getInt() , Mekanism.configuration.get("tools.tool-balance.bronze.regular", "enchantability", 100).getInt()
); );
toolBRONZE2 = EnumHelper.addToolMaterial("BRONZE2" toolBRONZE2 = EnumHelper.addToolMaterial("BRONZE2"
, Mekanism.configuration.get("tool-balance", "bronze-paxel-harvestLevel", 3).getInt() , Mekanism.configuration.get("tools.tool-balance.bronze.paxel", "harvestLevel", 3).getInt()
, Mekanism.configuration.get("tool-balance", "bronze-paxel-maxUses", 1100).getInt() , Mekanism.configuration.get("tools.tool-balance.bronze.paxel", "maxUses", 1100).getInt()
, (float)Mekanism.configuration.get("tool-balance", "bronze-paxel-efficiency", 16d).getDouble(0) , (float)Mekanism.configuration.get("tools.tool-balance.bronze.paxel", "efficiency", 16d).getDouble(0)
, Mekanism.configuration.get("tool-balance", "bronze-paxel-damage", 10).getInt() , Mekanism.configuration.get("tools.tool-balance.bronze.paxel", "damage", 10).getInt()
, Mekanism.configuration.get("tool-balance", "bronze-paxel-enchantability", 100).getInt() , Mekanism.configuration.get("tools.tool-balance.bronze.paxel", "enchantability", 100).getInt()
); );
toolGLOWSTONE = EnumHelper.addToolMaterial("GLOWSTONE" toolGLOWSTONE = EnumHelper.addToolMaterial("GLOWSTONE"
, Mekanism.configuration.get("tool-balance", "glowstone-harvestLevel", 2).getInt() , Mekanism.configuration.get("tools.tool-balance.glowstone.regular", "harvestLevel", 2).getInt()
, Mekanism.configuration.get("tool-balance", "glowstone-maxUses", 300).getInt() , Mekanism.configuration.get("tools.tool-balance.glowstone.regular", "maxUses", 300).getInt()
, (float)Mekanism.configuration.get("tool-balance", "glowstone-efficiency", 14d).getDouble(0) , (float)Mekanism.configuration.get("tools.tool-balance.glowstone.regular", "efficiency", 14d).getDouble(0)
, Mekanism.configuration.get("tool-balance", "glowstone-damage", 5).getInt() , Mekanism.configuration.get("tools.tool-balance.glowstone.regular", "damage", 5).getInt()
, Mekanism.configuration.get("tool-balance", "glowstone-enchantability", 80).getInt() , Mekanism.configuration.get("tools.tool-balance.glowstone.regular", "enchantability", 80).getInt()
); );
toolGLOWSTONE2 = EnumHelper.addToolMaterial("GLOWSTONE2" toolGLOWSTONE2 = EnumHelper.addToolMaterial("GLOWSTONE2"
, Mekanism.configuration.get("tool-balance", "glowstone-paxel-harvestLevel", 2).getInt() , Mekanism.configuration.get("tools.tool-balance.glowstone.paxel", "harvestLevel", 2).getInt()
, Mekanism.configuration.get("tool-balance", "glowstone-paxel-maxUses", 450).getInt() , Mekanism.configuration.get("tools.tool-balance.glowstone.paxel", "maxUses", 450).getInt()
, (float)Mekanism.configuration.get("tool-balance", "glowstone-paxel-efficiency", 18d).getDouble(0) , (float)Mekanism.configuration.get("tools.tool-balance.glowstone.paxel", "efficiency", 18d).getDouble(0)
, Mekanism.configuration.get("tool-balance", "glowstone-paxel-damage", 5).getInt() , Mekanism.configuration.get("tools.tool-balance.glowstone.paxel", "damage", 5).getInt()
, Mekanism.configuration.get("tool-balance", "glowstone-paxel-enchantability", 100).getInt() , Mekanism.configuration.get("tools.tool-balance.glowstone.paxel", "enchantability", 100).getInt()
); );
toolSTEEL = EnumHelper.addToolMaterial("STEEL" toolSTEEL = EnumHelper.addToolMaterial("STEEL"
, Mekanism.configuration.get("tool-balance", "steel-harvestLevel", 3).getInt() , Mekanism.configuration.get("tools.tool-balance.steel.regular", "harvestLevel", 3).getInt()
, Mekanism.configuration.get("tool-balance", "steel-maxUses", 850).getInt() , Mekanism.configuration.get("tools.tool-balance.steel.regular", "maxUses", 850).getInt()
, (float)Mekanism.configuration.get("tool-balance", "steel-efficiency", 14d).getDouble(0) , (float)Mekanism.configuration.get("tools.tool-balance.steel.regular", "efficiency", 14d).getDouble(0)
, Mekanism.configuration.get("tool-balance", "steel-damage", 4).getInt() , Mekanism.configuration.get("tools.tool-balance.steel.regular", "damage", 4).getInt()
, Mekanism.configuration.get("tool-balance", "steel-enchantability", 100).getInt() , Mekanism.configuration.get("tools.tool-balance.steel.regular", "enchantability", 100).getInt()
); );
toolSTEEL2 = EnumHelper.addToolMaterial("STEEL2" toolSTEEL2 = EnumHelper.addToolMaterial("STEEL2"
, Mekanism.configuration.get("tool-balance", "steel-paxel-harvestLevel", 3).getInt() , Mekanism.configuration.get("tools.tool-balance.steel.paxel", "harvestLevel", 3).getInt()
, Mekanism.configuration.get("tool-balance", "steel-paxel-maxUses", 1250).getInt() , Mekanism.configuration.get("tools.tool-balance.steel.paxel", "maxUses", 1250).getInt()
, (float)Mekanism.configuration.get("tool-balance", "steel-paxel-efficiency", 18d).getDouble(0) , (float)Mekanism.configuration.get("tools.tool-balance.steel.paxel", "efficiency", 18d).getDouble(0)
, Mekanism.configuration.get("tool-balance", "steel-paxel-damage", 8).getInt() , Mekanism.configuration.get("tools.tool-balance.steel.paxel", "damage", 8).getInt()
, Mekanism.configuration.get("tool-balance", "steel-paxel-enchantability", 100).getInt() , Mekanism.configuration.get("tools.tool-balance.steel.paxel", "enchantability", 100).getInt()
); );
//Armors //Armors
armorOBSIDIAN = EnumHelper.addArmorMaterial("OBSIDIAN" armorOBSIDIAN = EnumHelper.addArmorMaterial("OBSIDIAN"
, Mekanism.configuration.get("armor-balance", "obsidian-durability", 50).getInt() , Mekanism.configuration.get("tools.armor-balance.obsidian", "durability", 50).getInt()
, new int[] , new int[]
{ {
Mekanism.configuration.get("armor-balance", "obsidian-reduction-amount-head", 5).getInt() Mekanism.configuration.get("tools.armor-balance.obsidian.protection", "head", 5).getInt()
, Mekanism.configuration.get("armor-balance", "obsidian-reduction-amount-chest", 12).getInt() , Mekanism.configuration.get("tools.armor-balance.obsidian.protection", "chest", 12).getInt()
, Mekanism.configuration.get("armor-balance", "obsidian-reduction-amount-legs", 8).getInt() , Mekanism.configuration.get("tools.armor-balance.obsidian.protection", "legs", 8).getInt()
, Mekanism.configuration.get("armor-balance", "obsidian-reduction-amount-feet", 5).getInt() , Mekanism.configuration.get("tools.armor-balance.obsidian.protection", "feet", 5).getInt()
} }
, Mekanism.configuration.get("armor-balance", "obsidian-enchantability", 50).getInt() , Mekanism.configuration.get("tools.armor-balance.obsidian", "enchantability", 50).getInt()
); );
armorLAZULI = EnumHelper.addArmorMaterial("LAZULI" armorLAZULI = EnumHelper.addArmorMaterial("LAZULI"
, Mekanism.configuration.get("armor-balance", "lazuli-durability", 13).getInt() , Mekanism.configuration.get("tools.armor-balance.lapis", "durability", 13).getInt()
, new int[] , new int[]
{ {
Mekanism.configuration.get("armor-balance", "lazuli-reduction-amount-head", 2).getInt() Mekanism.configuration.get("tools.armor-balance.lapis.protection", "head", 2).getInt()
, Mekanism.configuration.get("armor-balance", "lazuli-reduction-amount-chest", 5).getInt() , Mekanism.configuration.get("tools.armor-balance.lapis.protection", "chest", 5).getInt()
, Mekanism.configuration.get("armor-balance", "lazuli-reduction-amount-legs", 6).getInt() , Mekanism.configuration.get("tools.armor-balance.lapis.protection", "legs", 6).getInt()
, Mekanism.configuration.get("armor-balance", "lazuli-reduction-amount-feet", 2).getInt() , Mekanism.configuration.get("tools.armor-balance.lapis.protection", "feet", 2).getInt()
} }
, Mekanism.configuration.get("armor-balance", "lazuli-enchantability", 50).getInt() , Mekanism.configuration.get("tools.armor-balance.lapis", "enchantability", 50).getInt()
); );
armorOSMIUM = EnumHelper.addArmorMaterial("OSMIUM" armorOSMIUM = EnumHelper.addArmorMaterial("OSMIUM"
, Mekanism.configuration.get("armor-balance", "osmium-durability", 30).getInt() , Mekanism.configuration.get("tools.armor-balance.osmium", "durability", 30).getInt()
, new int[] , new int[]
{ {
Mekanism.configuration.get("armor-balance", "osmium-reduction-amount-head", 3).getInt() Mekanism.configuration.get("tools.armor-balance.osmium.protection", "head", 3).getInt()
, Mekanism.configuration.get("armor-balance", "osmium-reduction-amount-chest", 5).getInt() , Mekanism.configuration.get("tools.armor-balance.osmium.protection", "chest", 5).getInt()
, Mekanism.configuration.get("armor-balance", "osmium-reduction-amount-legs", 6).getInt() , Mekanism.configuration.get("tools.armor-balance.osmium.protection", "legs", 6).getInt()
, Mekanism.configuration.get("armor-balance", "osmium-reduction-amount-feet", 3).getInt() , Mekanism.configuration.get("tools.armor-balance.osmium.protection", "feet", 3).getInt()
} }
, Mekanism.configuration.get("armor-balance", "osmium-enchantability", 50).getInt() , Mekanism.configuration.get("tools.armor-balance.osmium", "enchantability", 50).getInt()
); );
armorBRONZE = EnumHelper.addArmorMaterial("BRONZE" armorBRONZE = EnumHelper.addArmorMaterial("BRONZE"
, Mekanism.configuration.get("armor-balance", "bronze-durability", 35).getInt() , Mekanism.configuration.get("tools.armor-balance.bronze", "durability", 35).getInt()
, new int[] , new int[]
{ {
Mekanism.configuration.get("armor-balance", "bronze-reduction-amount-head", 3).getInt() Mekanism.configuration.get("tools.armor-balance.bronze.protection", "head", 3).getInt()
, Mekanism.configuration.get("armor-balance", "bronze-reduction-amount-chest", 6).getInt() , Mekanism.configuration.get("tools.armor-balance.bronze.protection", "chest", 6).getInt()
, Mekanism.configuration.get("armor-balance", "bronze-reduction-amount-legs", 5).getInt() , Mekanism.configuration.get("tools.armor-balance.bronze.protection", "legs", 5).getInt()
, Mekanism.configuration.get("armor-balance", "bronze-reduction-amount-feet", 2).getInt() , Mekanism.configuration.get("tools.armor-balance.bronze.protection", "feet", 2).getInt()
} }
, Mekanism.configuration.get("armor-balance", "bronze-enchantability", 50).getInt() , Mekanism.configuration.get("tools.armor-balance.bronze", "enchantability", 50).getInt()
); );
armorGLOWSTONE = EnumHelper.addArmorMaterial("GLOWSTONE" armorGLOWSTONE = EnumHelper.addArmorMaterial("GLOWSTONE"
, Mekanism.configuration.get("armor-balance", "glowstone-durability", 18).getInt() , Mekanism.configuration.get("tools.armor-balance.glowstone", "durability", 18).getInt()
, new int[] , new int[]
{ {
Mekanism.configuration.get("armor-balance", "glowstone-reduction-amount-head", 3).getInt() Mekanism.configuration.get("tools.armor-balance.glowstone.protection", "head", 3).getInt()
, Mekanism.configuration.get("armor-balance", "glowstone-reduction-amount-chest", 7).getInt() , Mekanism.configuration.get("tools.armor-balance.glowstone.protection", "chest", 7).getInt()
, Mekanism.configuration.get("armor-balance", "glowstone-reduction-amount-legs", 6).getInt() , Mekanism.configuration.get("tools.armor-balance.glowstone.protection", "legs", 6).getInt()
, Mekanism.configuration.get("armor-balance", "glowstone-reduction-amount-feet", 3).getInt() , Mekanism.configuration.get("tools.armor-balance.glowstone.protection", "feet", 3).getInt()
} }
, Mekanism.configuration.get("armor-balance", "glowstone-enchantability", 50).getInt() , Mekanism.configuration.get("tools.armor-balance.glowstone", "enchantability", 50).getInt()
); );
armorSTEEL = EnumHelper.addArmorMaterial("STEEL" armorSTEEL = EnumHelper.addArmorMaterial("STEEL"
, Mekanism.configuration.get("armor-balance", "steel-durability", 40).getInt() , Mekanism.configuration.get("tools.armor-balance.steel", "durability", 40).getInt()
, new int[] , new int[]
{ {
Mekanism.configuration.get("armor-balance", "steel-reduction-amount-head", 3).getInt() Mekanism.configuration.get("tools.armor-balance.steel.protection", "head", 3).getInt()
, Mekanism.configuration.get("armor-balance", "steel-reduction-amount-chest", 7).getInt() , Mekanism.configuration.get("tools.armor-balance.steel.protection", "chest", 7).getInt()
, Mekanism.configuration.get("armor-balance", "steel-reduction-amount-legs", 6).getInt() , Mekanism.configuration.get("tools.armor-balance.steel.protection", "legs", 6).getInt()
, Mekanism.configuration.get("armor-balance", "steel-reduction-amount-feet", 3).getInt() , Mekanism.configuration.get("tools.armor-balance.steel.protection", "feet", 3).getInt()
} }
, Mekanism.configuration.get("armor-balance", "steel-enchantability", 50).getInt() , Mekanism.configuration.get("tools.armor-balance.steel", "enchantability", 50).getInt()
); );
//Bronze //Bronze
@ -739,13 +740,13 @@ public class MekanismTools implements IModule
GameRegistry.registerItem(SteelBoots, "SteelBoots"); GameRegistry.registerItem(SteelBoots, "SteelBoots");
} }
@SubscribeEvent
public void onLivingSpecialSpawn(LivingSpawnEvent event) public void onLivingSpecialSpawn(LivingSpawnEvent event)
{ {
double chance = event.world.rand.nextDouble(); double chance = event.world.rand.nextDouble();
int armorType = event.world.rand.nextInt(4); int armorType = event.world.rand.nextInt(4);
if(chance < armourSpawnRate) if(chance < armorSpawnRate)
{ {
if(event.entityLiving instanceof EntityZombie || event.entityLiving instanceof EntitySkeleton) if(event.entityLiving instanceof EntityZombie || event.entityLiving instanceof EntitySkeleton)
{ {
@ -814,12 +815,21 @@ public class MekanismTools implements IModule
@Override @Override
public void writeConfig(ByteBuf dataStream) throws IOException public void writeConfig(ByteBuf dataStream) throws IOException
{ {
dataStream.writeDouble(armourSpawnRate); dataStream.writeDouble(armorSpawnRate);
} }
@Override @Override
public void readConfig(ByteBuf dataStream) throws IOException public void readConfig(ByteBuf dataStream) throws IOException
{ {
armourSpawnRate = dataStream.readDouble(); armorSpawnRate = dataStream.readDouble();
}
@SubscribeEvent
public void onConfigChanged(OnConfigChangedEvent event)
{
if(event.modID.equals("MekanismTools"))
{
proxy.loadConfiguration();
}
} }
} }

View file

@ -1,7 +1,6 @@
package mekanism.tools.common; package mekanism.tools.common;
import mekanism.common.Mekanism; import mekanism.common.Mekanism;
import net.minecraftforge.common.config.Configuration;
public class ToolsCommonProxy public class ToolsCommonProxy
{ {
@ -10,8 +9,9 @@ public class ToolsCommonProxy
*/ */
public void loadConfiguration() public void loadConfiguration()
{ {
Mekanism.configuration.load(); MekanismTools.armorSpawnRate = Mekanism.configuration.get("tools.general", "MobArmorSpawnRate", 0.03, null, 0.00, 1.00).getDouble(0.03);
MekanismTools.armourSpawnRate = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "mob-armor-spawn-rate", 0.03).getDouble(0.03);
Mekanism.configuration.save(); if(Mekanism.configuration.hasChanged())
Mekanism.configuration.save();
} }
} }