From fbbd0855e3aed27fee07ac19ac3ec9d1376dc64f Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Wed, 30 Jul 2014 19:20:36 +0200 Subject: [PATCH] Revamp Configuration --- .../IguanaTweaksTConstruct.java | 11 +- .../old/IguanaEventHandler.java | 28 +- .../old/IguanaItems.java | 2 +- .../old/IguanaToolBuildRecipe.java | 14 +- .../old/IguanaTweaksTConstructOld.java | 2 +- .../old/items/IguanaToolPart.java | 5 +- .../old/modifiers/IguanaModRepair.java | 9 +- .../old/modifiers/IguanaModUpgrade.java | 3 +- .../old/tweaks/HarvestLevelTweaks.java | 20 +- .../old/tweaks/ModifierTweaks.java | 20 +- .../old/tweaks/RemoveVanillaTools.java | 20 +- .../old/tweaks/VariousTweaks.java | 36 +- .../reference/Config.java | 597 +++++------------- 13 files changed, 234 insertions(+), 533 deletions(-) diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/IguanaTweaksTConstruct.java b/src/main/java/iguanaman/iguanatweakstconstruct/IguanaTweaksTConstruct.java index c935ec4..bcafdf2 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/IguanaTweaksTConstruct.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/IguanaTweaksTConstruct.java @@ -1,5 +1,6 @@ package iguanaman.iguanatweakstconstruct; +import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; @@ -30,6 +31,10 @@ import java.util.List; // todo: find a solution to stone-head-tools not having xp even when head is replaced (maybe like old iguana, disallow stone tools?) // todo: add randomly generated weapons with random bonuses(!!!!) to dungeon loot :D:D:D +// todo: Unknown blocks get incorrect mining level. (just check if they're higher than the places where i added additional harvest levels and add the proper ammount to match up with the old mining level) +// todo: can't mine TE tin with tin level? +// todo: tartarite pick mines manyullum. tartarite tinker head mines ardite. + @Mod(modid= Reference.MOD_ID, name= Reference.MOD_NAME, version="1.7.X-1p", dependencies = "required-after:" + Reference.TCON_MOD_ID + ";after:*") public class IguanaTweaksTConstruct { @@ -54,7 +59,11 @@ public class IguanaTweaksTConstruct { @EventHandler public void preInit(FMLPreInitializationEvent event) { - Config.init(event.getSuggestedConfigurationFile()); + Config config = new Config(); + config.init(event.getSuggestedConfigurationFile()); + // register config as eventhandler to get config changed updates + FMLCommonHandler.instance().bus().register(config); + // workaround to know which modules are active.. :I PulseMeta meta = new PulseMeta(Reference.PULSE_LEVELING, "", false, false); isToolLevelingActive = pulseCFG.isModuleEnabled(meta); diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/old/IguanaEventHandler.java b/src/main/java/iguanaman/iguanatweakstconstruct/old/IguanaEventHandler.java index 13431da..251643b 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/old/IguanaEventHandler.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/old/IguanaEventHandler.java @@ -221,17 +221,17 @@ public class IguanaEventHandler { int accessory = toolTag.getInteger("Accessory"); int extra = toolTag.hasKey("Extra") ? toolTag.getInteger("Extra") : -1; - if (!Config.allowStoneTools && (head == 1 || handle == 1 || event.tool != TinkerTools.arrow && accessory == 1) || extra == 1) + if (!IguanaConfig.allowStoneTools && (head == 1 || handle == 1 || event.tool != TinkerTools.arrow && accessory == 1) || extra == 1) { event.setResult(Event.Result.DENY); return; } - else if (Config.allowStoneTools) + else if (IguanaConfig.allowStoneTools) { if (head == 1) { int partIndex = IguanaTweaksTConstruct.toolParts.indexOf(event.tool.getHeadItem()); - if (Config.restrictedFlintParts.contains(partIndex+1)) + if (IguanaConfig.restrictedFlintParts.contains(partIndex+1)) { event.setResult(Event.Result.DENY); return; @@ -241,7 +241,7 @@ public class IguanaEventHandler { if (handle == 1) { int partIndex = IguanaTweaksTConstruct.toolParts.indexOf(event.tool.getHandleItem()); - if (Config.restrictedFlintParts.contains(partIndex+1)) + if (IguanaConfig.restrictedFlintParts.contains(partIndex+1)) { event.setResult(Event.Result.DENY); return; @@ -251,7 +251,7 @@ public class IguanaEventHandler { if (event.tool != TinkerTools.arrow && accessory == 1) { int partIndex = IguanaTweaksTConstruct.toolParts.indexOf(event.tool.getAccessoryItem()); - if (Config.restrictedFlintParts.contains(partIndex+1)) + if (IguanaConfig.restrictedFlintParts.contains(partIndex+1)) { event.setResult(Event.Result.DENY); return; @@ -261,7 +261,7 @@ public class IguanaEventHandler { if (extra == 1) { int partIndex = IguanaTweaksTConstruct.toolParts.indexOf(event.tool.getExtraItem()); - if (Config.restrictedFlintParts.contains(partIndex+1)) + if (IguanaConfig.restrictedFlintParts.contains(partIndex+1)) { event.setResult(Event.Result.DENY); return; @@ -371,14 +371,14 @@ public class IguanaEventHandler { MaterialSet mat = (MaterialSet) PatternBuilder.instance.materialSets.get(key.key); if (mat != null) if ( - mat.materialID == 0 && Config.restrictedWoodParts.contains(event.pattern.getItemDamage()) || - mat.materialID == 1 && Config.restrictedStoneParts.contains(event.pattern.getItemDamage()) || - mat.materialID == 3 && Config.restrictedFlintParts.contains(event.pattern.getItemDamage()) || - mat.materialID == 4 && Config.restrictedCactusParts.contains(event.pattern.getItemDamage()) || - mat.materialID == 5 && Config.restrictedBoneParts.contains(event.pattern.getItemDamage()) || - mat.materialID == 8 && Config.restrictedSlimeParts.contains(event.pattern.getItemDamage()) || - mat.materialID == 9 && Config.restrictedPaperParts.contains(event.pattern.getItemDamage()) || - mat.materialID == 17 && Config.restrictedSlimeParts.contains(event.pattern.getItemDamage()) + mat.materialID == 0 && IguanaConfig.restrictedWoodParts.contains(event.pattern.getItemDamage()) || + mat.materialID == 1 && IguanaConfig.restrictedStoneParts.contains(event.pattern.getItemDamage()) || + mat.materialID == 3 && IguanaConfig.restrictedFlintParts.contains(event.pattern.getItemDamage()) || + mat.materialID == 4 && IguanaConfig.restrictedCactusParts.contains(event.pattern.getItemDamage()) || + mat.materialID == 5 && IguanaConfig.restrictedBoneParts.contains(event.pattern.getItemDamage()) || + mat.materialID == 8 && IguanaConfig.restrictedSlimeParts.contains(event.pattern.getItemDamage()) || + mat.materialID == 9 && IguanaConfig.restrictedPaperParts.contains(event.pattern.getItemDamage()) || + mat.materialID == 17 && IguanaConfig.restrictedSlimeParts.contains(event.pattern.getItemDamage()) ) { event.setResult(Event.Result.DENY); diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/old/IguanaItems.java b/src/main/java/iguanaman/iguanatweakstconstruct/old/IguanaItems.java index f710d29..1dbd59c 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/old/IguanaItems.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/old/IguanaItems.java @@ -125,7 +125,7 @@ public class IguanaItems { //COBALT ARMOR - if (Config.cobaltArmor) + if (IguanaConfig.cobaltArmor) { Log.info("Changing diamond armor to cobalt armor"); diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/old/IguanaToolBuildRecipe.java b/src/main/java/iguanaman/iguanatweakstconstruct/old/IguanaToolBuildRecipe.java index 783644b..b135376 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/old/IguanaToolBuildRecipe.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/old/IguanaToolBuildRecipe.java @@ -1,7 +1,5 @@ package iguanaman.iguanatweakstconstruct.old; -import iguanaman.iguanatweakstconstruct.reference.Config; - import java.util.ArrayList; import net.minecraft.init.Blocks; @@ -33,10 +31,10 @@ public class IguanaToolBuildRecipe implements IRecipe { if (slot != null) { //Too many items - if (!Config.easyToolCreation && inputs.size() == 3 || inputs.size() == 4) return false; + if (!IguanaConfig.easyToolCreation && inputs.size() == 3 || inputs.size() == 4) return false; // if a tool is found, make sure easy modifications are allowed first - if (!Config.easyToolModification && slot.getItem() instanceof ToolCore) return false; + if (!IguanaConfig.easyToolModification && slot.getItem() instanceof ToolCore) return false; if (slot.getItem() instanceof ToolCore) toolFound = true; @@ -48,7 +46,7 @@ public class IguanaToolBuildRecipe implements IRecipe { if (inputs.size() < 2) return false; // Only modification allowed and no tool found - if (!Config.easyToolCreation && !toolFound) return false; + if (!IguanaConfig.easyToolCreation && !toolFound) return false; // Make sure size is 4 "itemstacks" while (inputs.size() < 4) inputs.add(null); @@ -57,7 +55,7 @@ public class IguanaToolBuildRecipe implements IRecipe { for (int i1 = 0; i1 < 4; ++i1) { ItemStack input1 = inputs.get(i1); - if (input1 == null || !Config.easyToolCreation && !(input1.getItem() instanceof ToolCore)) continue; + if (input1 == null || !IguanaConfig.easyToolCreation && !(input1.getItem() instanceof ToolCore)) continue; for (int i2 = 0; i2 < 4; ++i2) { @@ -78,7 +76,7 @@ public class IguanaToolBuildRecipe implements IRecipe { if (i3 == i4) continue; // try to build / modify something - if (Config.easyToolCreation && !toolFound) + if (IguanaConfig.easyToolCreation && !toolFound) output = ToolBuilder.instance.buildTool(input1, input2, input3, input4, ""); else if (input1.getItem() instanceof ToolCore && input1.hasTagCompound() && input1.getTagCompound().getCompoundTag("InfiTool") != null) output = ModifyBuilder.instance.modifyItem(input1, new ItemStack[] {input2, input3, input4}); @@ -87,7 +85,7 @@ public class IguanaToolBuildRecipe implements IRecipe { if (output != null) return true; // Only tool modification allowed so input4 will always be null - if (!Config.easyToolCreation) break; + if (!IguanaConfig.easyToolCreation) break; } } } diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/old/IguanaTweaksTConstructOld.java b/src/main/java/iguanaman/iguanatweakstconstruct/old/IguanaTweaksTConstructOld.java index 0eaef9b..f748844 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/old/IguanaTweaksTConstructOld.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/old/IguanaTweaksTConstructOld.java @@ -49,7 +49,7 @@ public class IguanaTweaksTConstructOld { //proxy.registerSounds(); //NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy); - Config.init(event.getSuggestedConfigurationFile()); + IguanaConfig.init(event.getSuggestedConfigurationFile()); toolParts = Arrays.asList ( TinkerTools.toolRod, TinkerTools.pickaxeHead, TinkerTools.shovelHead, TinkerTools.hatchetHead, diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/old/items/IguanaToolPart.java b/src/main/java/iguanaman/iguanatweakstconstruct/old/items/IguanaToolPart.java index c1828d7..63d4f03 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/old/items/IguanaToolPart.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/old/items/IguanaToolPart.java @@ -1,5 +1,6 @@ package iguanaman.iguanatweakstconstruct.old.items; +import iguanaman.iguanatweakstconstruct.old.IguanaConfig; import iguanaman.iguanatweakstconstruct.reference.Config; import java.util.List; @@ -24,7 +25,7 @@ public class IguanaToolPart extends ToolPart { public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { tconstruct.library.tools.ToolMaterial material = TConstructRegistry.getMaterial(par1ItemStack.getItemDamage()); - if (!Config.allowStoneTools && material.materialName.equals("Stone")) + if (!IguanaConfig.allowStoneTools && material.materialName.equals("Stone")) { par3List.add("\u00a74Can only be used to make casts,"); par3List.add("\u00a74cannot be used to make a tool"); @@ -54,7 +55,7 @@ public class IguanaToolPart extends ToolPart { par3List.add("Durability: " + material.durability); } - if (Config.partReplacement) + if (IguanaConfig.partReplacement) if (material.ability.equals("Writable") || material.ability.equals("Thaumic")) { par3List.add("\u00a74Cannot be replaced once added,"); diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/old/modifiers/IguanaModRepair.java b/src/main/java/iguanaman/iguanatweakstconstruct/old/modifiers/IguanaModRepair.java index 9381909..2872bc1 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/old/modifiers/IguanaModRepair.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/old/modifiers/IguanaModRepair.java @@ -1,5 +1,6 @@ package iguanaman.iguanatweakstconstruct.old.modifiers; +import iguanaman.iguanatweakstconstruct.old.IguanaConfig; import iguanaman.iguanatweakstconstruct.reference.Config; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -106,14 +107,14 @@ public class IguanaModRepair extends ItemModifier { float repairCount = (float)repair / (float)durtotal; - if (Config.repairLimitActive && repairCount >= Config.repairLimit) + if (IguanaConfig.repairLimitActive && repairCount >= IguanaConfig.repairLimit) return 0; - increase = Math.round(increase / (Config.repairCostPercentage / 100f)); + increase = Math.round(increase / (IguanaConfig.repairCostPercentage / 100f)); - if (Config.repairCostScaling) + if (IguanaConfig.repairCostScaling) { - repairCount /= Config.repairScalingModifier; + repairCount /= IguanaConfig.repairScalingModifier; repairCount += 1F; increase = Math.round(increase / repairCount); } diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/old/modifiers/IguanaModUpgrade.java b/src/main/java/iguanaman/iguanatweakstconstruct/old/modifiers/IguanaModUpgrade.java index 565a765..d510cbe 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/old/modifiers/IguanaModUpgrade.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/old/modifiers/IguanaModUpgrade.java @@ -2,6 +2,7 @@ package iguanaman.iguanatweakstconstruct.old.modifiers; import iguanaman.iguanatweakstconstruct.leveling.LevelingLogic; import iguanaman.iguanatweakstconstruct.leveling.LevelingTooltips; +import iguanaman.iguanatweakstconstruct.old.IguanaConfig; import iguanaman.iguanatweakstconstruct.reference.Config; import iguanaman.iguanatweakstconstruct.IguanaTweaksTConstruct; @@ -155,7 +156,7 @@ public class IguanaModUpgrade extends ItemModifier { // Check for stone parts if (inputStack.getItemDamage() == 1) - if (!Config.allowStoneTools || Config.restrictedFlintParts.contains(partIndex+1)) return false; + if (!IguanaConfig.allowStoneTools || IguanaConfig.restrictedFlintParts.contains(partIndex+1)) return false; } // Check if have enough free modifiers to replace written/thaumic parts diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/old/tweaks/HarvestLevelTweaks.java b/src/main/java/iguanaman/iguanatweakstconstruct/old/tweaks/HarvestLevelTweaks.java index 3376fa0..0453d46 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/old/tweaks/HarvestLevelTweaks.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/old/tweaks/HarvestLevelTweaks.java @@ -7,7 +7,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import iguanaman.iguanatweakstconstruct.reference.Config; +import iguanaman.iguanatweakstconstruct.old.IguanaConfig; import iguanaman.iguanatweakstconstruct.util.Log; import net.minecraft.block.Block; import net.minecraft.init.Blocks; @@ -80,8 +80,8 @@ public class HarvestLevelTweaks { // TODO: Find a better way to implement pickaxe overrides /* - if (IguanaConfig.pickaxeOverrides.containsKey(item.getUnlocalizedName())) - harvestLevel = IguanaConfig.pickaxeOverrides.get(item.itemID);*/ + if (IguanaIguanaConfig.pickaxeOverrides.containsKey(item.getUnlocalizedName())) + harvestLevel = IguanaIguanaConfig.pickaxeOverrides.get(item.itemID);*/ switch (harvestLevel) { @@ -97,7 +97,7 @@ public class HarvestLevelTweaks { if (harvestLevel != newHarvestLevel) { - if (Config.logMiningLevelChanges) Log.info("Changing mining level of " + entry.getKey().getUnlocalizedName() + " from " + harvestLevel + " to " + newHarvestLevel); + if (IguanaConfig.logMiningLevelChanges) Log.info("Changing mining level of " + entry.getKey().getUnlocalizedName() + " from " + harvestLevel + " to " + newHarvestLevel); entry.setValue(Arrays.asList(toolClass, newHarvestLevel)); } @@ -106,7 +106,7 @@ public class HarvestLevelTweaks { //BLOCKS - if (Config.pickaxeBoostRequired) boostMod = 1; + if (IguanaConfig.pickaxeBoostRequired) boostMod = 1; int harvestLevelCopper = TConstructRegistry.getMaterial("Copper").harvestLevel() + boostMod; harvestLevelIron += boostMod; @@ -164,7 +164,7 @@ public class HarvestLevelTweaks { if (requiredHarvestLevel != newRequiredHarvestLevel) { - if (Config.logHarvestLevelChanges) Log.info("Changing required harvest level of " + block.getUnlocalizedName() + ":" + metadata + " from " + requiredHarvestLevel + " to " + newRequiredHarvestLevel); + if (IguanaConfig.logHarvestLevelChanges) Log.info("Changing required harvest level of " + block.getUnlocalizedName() + ":" + metadata + " from " + requiredHarvestLevel + " to " + newRequiredHarvestLevel); entry.setValue(newRequiredHarvestLevel); } @@ -203,9 +203,9 @@ public class HarvestLevelTweaks { TinkerWorld.oreGravel.setHarvestLevel("shovel", harvestLevelArdite, 5); List[] harvestLevelIds = { - Config.harvestLevel0Ids, Config.harvestLevel1Ids, Config.harvestLevel2Ids, - Config.harvestLevel3Ids, Config.harvestLevel4Ids, Config.harvestLevel5Ids, - Config.harvestLevel6Ids, Config.harvestLevel7Ids + IguanaConfig.harvestLevel0Ids, IguanaConfig.harvestLevel1Ids, IguanaConfig.harvestLevel2Ids, + IguanaConfig.harvestLevel3Ids, IguanaConfig.harvestLevel4Ids, IguanaConfig.harvestLevel5Ids, + IguanaConfig.harvestLevel6Ids, IguanaConfig.harvestLevel7Ids }; for (int i = 0; i < oreDictLevels.length; ++i) @@ -227,7 +227,7 @@ public class HarvestLevelTweaks { } else blockId = Integer.parseInt(idline); } catch (Exception e) { - throw new RuntimeException("Config setting harvestLevel" + i + "Ids contains an invalid line (" + idline + "). Each id must be on a separate line and in this format: id or id:meta"); + throw new RuntimeException("IguanaConfig setting harvestLevel" + i + "Ids contains an invalid line (" + idline + "). Each id must be on a separate line and in this format: id or id:meta"); } // TODO: find a way to implement block harvest override diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/old/tweaks/ModifierTweaks.java b/src/main/java/iguanaman/iguanatweakstconstruct/old/tweaks/ModifierTweaks.java index 38c6e72..896e1d7 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/old/tweaks/ModifierTweaks.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/old/tweaks/ModifierTweaks.java @@ -1,6 +1,6 @@ package iguanaman.iguanatweakstconstruct.old.tweaks; -import iguanaman.iguanatweakstconstruct.reference.Config; +import iguanaman.iguanatweakstconstruct.old.IguanaConfig; import iguanaman.iguanatweakstconstruct.util.Log; import iguanaman.iguanatweakstconstruct.old.modifiers.IguanaModAttack; import iguanaman.iguanatweakstconstruct.old.modifiers.IguanaModClean; @@ -37,21 +37,21 @@ public class ModifierTweaks while (i.hasNext()) { ItemModifier mod = i.next(); - if (mod.key == "Emerald" || mod.key == "Diamond" || mod.key == "Tier1Free" && Config.toolLeveling || mod.key == "Tier2Free" || mod.key == "Moss" || mod.key == "Lapis" + if (mod.key == "Emerald" || mod.key == "Diamond" || mod.key == "Tier1Free" && IguanaConfig.toolLeveling || mod.key == "Tier2Free" || mod.key == "Moss" || mod.key == "Lapis" || mod.key == "ModAttack" || mod.key == "Redstone" || mod.key == "") //IguanaLog.log("Removing old " + mod.key + " modifier"); i.remove(); } // Change recipes - if (Config.moreExpensiveSilkyCloth) + if (IguanaConfig.moreExpensiveSilkyCloth) { RecipeRemover.removeAnyRecipe(new ItemStack(TinkerTools.materials, 1, 25)); GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 1, 25), "sss", "sns", "sss", 'n', new ItemStack(TinkerTools.materials, 1, 14), 's', new ItemStack(Items.string)); //Silky Cloth GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 1, 25), "sss", "sns", "sss", 'n', new ItemStack(Items.gold_ingot), 's', new ItemStack(Items.string)); //Silky Cloth } - if (Config.moreExpensiveSilkyJewel) + if (IguanaConfig.moreExpensiveSilkyJewel) { RecipeRemover.removeAnyRecipe(new ItemStack(TinkerTools.materials, 1, 26)); GameRegistry.addRecipe(new ItemStack(TinkerTools.materials, 1, 26), " c ", "cec", " c ", 'c', new ItemStack(TinkerTools.materials, 1, 25), 'e', new ItemStack(Blocks.emerald_block)); //Silky Jewel @@ -60,13 +60,13 @@ public class ModifierTweaks // REPLACE OLD MODIFIERS Log.info("Replacing old modifiers"); - if (Config.partReplacement) + if (IguanaConfig.partReplacement) ModifyBuilder.registerModifier(new IguanaModUpgrade()); ModifyBuilder.registerModifier(new IguanaModRepair()); // TODO: Find a way to replace vanilla skull - /*if (!IguanaConfig.toolLevelingRandomBonuses) + /*if (!IguanaIguanaConfig.toolLevelingRandomBonuses) ModifyBuilder.registerModifier(new ModExtraModifier(new ItemStack[] { new ItemStack(Items.sk, 1, 6), new ItemStack(Item.skull, 1, 7) }, "Tier2Free"));*/ - ModifyBuilder.registerModifier(new ModInteger(new ItemStack[] { new ItemStack(TinkerTools.materials, 1, 6) }, 4, "Moss", Config.mossRepairSpeed, "\u00a72", "Auto-Repair")); + ModifyBuilder.registerModifier(new ModInteger(new ItemStack[] { new ItemStack(TinkerTools.materials, 1, 6) }, 4, "Moss", IguanaConfig.mossRepairSpeed, "\u00a72", "Auto-Repair")); ModifyBuilder.registerModifier(new ModDurability(new ItemStack[] { new ItemStack(Items.emerald) }, 1, 0, 0.5f, TConstructRegistry.getMaterial("Bronze").harvestLevel(), "Emerald", "\u00a72Durability +50%", "\u00a72")); ModifyBuilder.registerModifier(new ModDurability(new ItemStack[] { new ItemStack(Items.diamond) }, 0, 500, 0f, 0, "Diamond", "\u00a7bDurability +500", "\u00a7b")); @@ -92,11 +92,11 @@ public class ModifierTweaks ModifyBuilder.registerModifier(new IguanaModRedstone(new ItemStack[] { redstoneBlock, redstoneBlock }, 2, 18)); // CLEAN MODIFIER - if (Config.addCleanModifier) + if (IguanaConfig.addCleanModifier) ModifyBuilder.registerModifier(new IguanaModClean()); // MINING BOOST MODIFIERS - if (Config.mobHeadPickaxeBoost) + if (IguanaConfig.mobHeadPickaxeBoost) { Log.info("Adding mob head modifiers"); @@ -125,7 +125,7 @@ public class ModifierTweaks } // LEVELING MODIFIER - if (Config.toolLeveling) + if (IguanaConfig.toolLeveling) { Log.info("Adding leveling active modifier"); //TConstructRegistry.activeModifiers.add(0, new IguanaActiveToolMod()); diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/old/tweaks/RemoveVanillaTools.java b/src/main/java/iguanaman/iguanatweakstconstruct/old/tweaks/RemoveVanillaTools.java index 4dbcbc9..7fc6e7f 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/old/tweaks/RemoveVanillaTools.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/old/tweaks/RemoveVanillaTools.java @@ -1,6 +1,6 @@ package iguanaman.iguanatweakstconstruct.old.tweaks; -import iguanaman.iguanatweakstconstruct.reference.Config; +import iguanaman.iguanatweakstconstruct.old.IguanaConfig; import iguanaman.iguanatweakstconstruct.util.Log; import net.minecraft.init.Items; import net.minecraft.item.Item; @@ -15,30 +15,30 @@ public class RemoveVanillaTools { Log.info("Removing vanilla tool recipes"); //Wood - if (Config.restrictedWoodParts.contains(1) || Config.restrictedWoodParts.contains(2) || Config.restrictedWoodParts.contains(9)) + if (IguanaConfig.restrictedWoodParts.contains(1) || IguanaConfig.restrictedWoodParts.contains(2) || IguanaConfig.restrictedWoodParts.contains(9)) RemoveVanillaTool(Items.wooden_pickaxe); - if (Config.restrictedWoodParts.contains(1) || Config.restrictedWoodParts.contains(3)) + if (IguanaConfig.restrictedWoodParts.contains(1) || IguanaConfig.restrictedWoodParts.contains(3)) RemoveVanillaTool(Items.wooden_shovel); - if (Config.restrictedWoodParts.contains(1) || Config.restrictedWoodParts.contains(4)) + if (IguanaConfig.restrictedWoodParts.contains(1) || IguanaConfig.restrictedWoodParts.contains(4)) RemoveVanillaTool(Items.wooden_axe); - if (Config.restrictedWoodParts.contains(1) || Config.restrictedWoodParts.contains(5) || Config.restrictedWoodParts.contains(6)) + if (IguanaConfig.restrictedWoodParts.contains(1) || IguanaConfig.restrictedWoodParts.contains(5) || IguanaConfig.restrictedWoodParts.contains(6)) RemoveVanillaTool(Items.wooden_sword); //Stone - if (!Config.allowStoneTools || Config.restrictedWoodParts.contains(1) - || Config.restrictedFlintParts.contains(2) || Config.restrictedWoodParts.contains(9)) + if (!IguanaConfig.allowStoneTools || IguanaConfig.restrictedWoodParts.contains(1) + || IguanaConfig.restrictedFlintParts.contains(2) || IguanaConfig.restrictedWoodParts.contains(9)) RemoveVanillaTool(Items.stone_pickaxe); - if (!Config.allowStoneTools || Config.restrictedWoodParts.contains(1) || Config.restrictedFlintParts.contains(3)) + if (!IguanaConfig.allowStoneTools || IguanaConfig.restrictedWoodParts.contains(1) || IguanaConfig.restrictedFlintParts.contains(3)) RemoveVanillaTool(Items.stone_shovel); - if (!Config.allowStoneTools || Config.restrictedWoodParts.contains(1) || Config.restrictedFlintParts.contains(4)) + if (!IguanaConfig.allowStoneTools || IguanaConfig.restrictedWoodParts.contains(1) || IguanaConfig.restrictedFlintParts.contains(4)) RemoveVanillaTool(Items.stone_axe); - if (!Config.allowStoneTools || Config.restrictedWoodParts.contains(1) || Config.restrictedFlintParts.contains(5) || Config.restrictedWoodParts.contains(6)) + if (!IguanaConfig.allowStoneTools || IguanaConfig.restrictedWoodParts.contains(1) || IguanaConfig.restrictedFlintParts.contains(5) || IguanaConfig.restrictedWoodParts.contains(6)) RemoveVanillaTool(Items.stone_sword); } diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/old/tweaks/VariousTweaks.java b/src/main/java/iguanaman/iguanatweakstconstruct/old/tweaks/VariousTweaks.java index db5c6c6..009f472 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/old/tweaks/VariousTweaks.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/old/tweaks/VariousTweaks.java @@ -1,6 +1,6 @@ package iguanaman.iguanatweakstconstruct.old.tweaks; -import iguanaman.iguanatweakstconstruct.reference.Config; +import iguanaman.iguanatweakstconstruct.old.IguanaConfig; import iguanaman.iguanatweakstconstruct.util.Log; import iguanaman.iguanatweakstconstruct.IguanaTweaksTConstruct; import iguanaman.iguanatweakstconstruct.old.IguanaPartBuildRecipe; @@ -42,7 +42,7 @@ public class VariousTweaks { } //REMOVE STONE TORCH - if (Config.removeStoneTorchRecipe) + if (IguanaConfig.removeStoneTorchRecipe) { Log.info("Removing stone torch recipe"); RecipeRemover.removeAnyRecipe(new ItemStack(TinkerWorld.stoneTorch, 4)); @@ -50,7 +50,7 @@ public class VariousTweaks { // GRAVEL TO FLINT RECIPE - if (Config.addFlintRecipe) { + if (IguanaConfig.addFlintRecipe) { Log.info("Adding gravel to flint recipe"); GameRegistry.addShapelessRecipe(new ItemStack(Items.flint), new Object[] {Blocks.gravel, Blocks.gravel, Blocks.gravel, Blocks.gravel}); } @@ -91,19 +91,19 @@ public class VariousTweaks { { Item part = IguanaTweaksTConstruct.toolParts.get(i); - if (Config.restrictedWoodParts.contains(i+1)) + if (IguanaConfig.restrictedWoodParts.contains(i+1)) TinkerWorld.tinkerHouseChest.removeItem(new ItemStack(part, 1, 0)); - if (!Config.allowStoneTools || Config.restrictedStoneParts.contains(i+1)) + if (!IguanaConfig.allowStoneTools || IguanaConfig.restrictedStoneParts.contains(i+1)) TinkerWorld.tinkerHouseChest.removeItem(new ItemStack(part, 1, 1)); - if (Config.restrictedFlintParts.contains(i+1)) + if (IguanaConfig.restrictedFlintParts.contains(i+1)) TinkerWorld.tinkerHouseChest.removeItem(new ItemStack(part, 1, 3)); - if (Config.restrictedCactusParts.contains(i+1)) + if (IguanaConfig.restrictedCactusParts.contains(i+1)) TinkerWorld.tinkerHouseChest.removeItem(new ItemStack(part, 1, 4)); - if (Config.restrictedBoneParts.contains(i+1)) + if (IguanaConfig.restrictedBoneParts.contains(i+1)) TinkerWorld.tinkerHouseChest.removeItem(new ItemStack(part, 1, 5)); - if (Config.restrictedPaperParts.contains(i+1)) + if (IguanaConfig.restrictedPaperParts.contains(i+1)) TinkerWorld.tinkerHouseChest.removeItem(new ItemStack(part, 1, 9)); - if (Config.restrictedSlimeParts.contains(i+1)) + if (IguanaConfig.restrictedSlimeParts.contains(i+1)) { TinkerWorld.tinkerHouseChest.removeItem(new ItemStack(part, 1, 8)); TinkerWorld.tinkerHouseChest.removeItem(new ItemStack(part, 1, 17)); @@ -120,7 +120,7 @@ public class VariousTweaks { // SIMPLE WOOD PATTERN CRAFTING RECIPE - if (Config.easyBlankPatternRecipe) + if (IguanaConfig.easyBlankPatternRecipe) { Log.info("Adding easy blank pattern recipe"); GameRegistry.addShapedRecipe(new ItemStack(TinkerTools.blankPattern), "ss", "ss", 's', new ItemStack(Items.stick)); @@ -128,7 +128,7 @@ public class VariousTweaks { //ROTATING PATTERN CRAFTING - if (Config.easyPatternCrafting) + if (IguanaConfig.easyPatternCrafting) { Log.info("Adding rotating pattern crafting recipes"); @@ -144,10 +144,10 @@ public class VariousTweaks { List patternIds = new ArrayList(); for (int x = 1; x < patternName.length; x++) - if (!Config.restrictedBoneParts.contains(x) || !Config.restrictedCactusParts.contains(x) - || !Config.restrictedFlintParts.contains(x) || !Config.restrictedPaperParts.contains(x) - || !Config.restrictedSlimeParts.contains(x) || !Config.restrictedWoodParts.contains(x) - || Config.allowStoneTools && !Config.restrictedFlintParts.contains(x) + if (!IguanaConfig.restrictedBoneParts.contains(x) || !IguanaConfig.restrictedCactusParts.contains(x) + || !IguanaConfig.restrictedFlintParts.contains(x) || !IguanaConfig.restrictedPaperParts.contains(x) + || !IguanaConfig.restrictedSlimeParts.contains(x) || !IguanaConfig.restrictedWoodParts.contains(x) + || IguanaConfig.allowStoneTools && !IguanaConfig.restrictedFlintParts.contains(x) || x >= 23) patternIds.add(x); @@ -165,7 +165,7 @@ public class VariousTweaks { // ALTERNATIVE PART CRAFTING - if (Config.easyPartCrafting) + if (IguanaConfig.easyPartCrafting) { Log.info("Adding easy part crafting"); GameRegistry.addRecipe(new IguanaPartBuildRecipe()); @@ -175,7 +175,7 @@ public class VariousTweaks { // ALTERNATIVE TOOL CRAFTING - if (Config.easyToolCreation || Config.easyToolModification) + if (IguanaConfig.easyToolCreation || IguanaConfig.easyToolModification) { Log.info("Adding easy tool crafting"); GameRegistry.addRecipe(new IguanaToolBuildRecipe()); diff --git a/src/main/java/iguanaman/iguanatweakstconstruct/reference/Config.java b/src/main/java/iguanaman/iguanatweakstconstruct/reference/Config.java index 0bd5017..b3fe8f7 100644 --- a/src/main/java/iguanaman/iguanatweakstconstruct/reference/Config.java +++ b/src/main/java/iguanaman/iguanatweakstconstruct/reference/Config.java @@ -1,5 +1,8 @@ package iguanaman.iguanatweakstconstruct.reference; +import cpw.mods.fml.client.event.ConfigChangedEvent; +import cpw.mods.fml.common.Mod; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; @@ -9,32 +12,22 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; - - public class Config { - - // Item Ids - /* - public static int clayBucketLavaId; - public static int clayBucketMilkId; - public static int clayBucketWaterId; - public static int clayBucketFiredId; - public static int clayBucketUnfiredId; - public static int clayBucketsId; - */ + private Configuration configfile; // leveling + public static int xpRequiredToolsPercentage; + public static int xpRequiredWeaponsPercentage; + public static float xpPerLevelMultiplier; + public static boolean showTooltipXP; + public static boolean showMinimalTooltipXP; public static boolean detailedXpTooltip; public static boolean toolLeveling; public static boolean toolLevelingExtraModifiers; public static int[] toolModifiersAtLevels; public static boolean toolLevelingRandomBonuses; - public static boolean showTooltipXP; - public static boolean showMinimalTooltipXP; - public static boolean showDebugXP; - public static int xpRequiredToolsPercentage; - public static int xpRequiredWeaponsPercentage; - public static double xpPerLevelMultiplier; + public static boolean randomBonusesAreUseful; + public static boolean randomBonusesAreRandom; // pick boost public static boolean pickaxeBoostRequired; @@ -42,549 +35,247 @@ public class Config { public static boolean levelingPickaxeBoost; public static int levelingPickaxeBoostXpPercentage; - // repairs - public static boolean repairCostScaling; - public static boolean repairLimitActive; - public static int repairScalingModifier; - public static int repairLimit; - public static int repairCostPercentage; - // heads public static int baseHeadDropChance; public static int beheadingHeadDropChance; - //crafting - public static boolean easyBlankPatternRecipe; - public static boolean easyPartCrafting; - public static boolean easyPatternCrafting; - public static boolean easyToolModification; - public static boolean easyToolCreation; + // tweaks + public static boolean removeFlintDrop; + public static boolean addFlintRecipe; + public static int recipeGravelPerFlint; + public static int durabilityPercentage; + public static int miningSpeedPercentage; + public static boolean removeStoneTorchRecipe; + public static boolean toolsNeverDespawn; - //patterns - /* - public static int patternCostToolRod; - public static int patternCostPickaxeHead; - public static int patternCostShovelHead; - public static int patternCostHatchetHead; - public static int patternCostSwordBlade; - public static int patternCostWideGuard; - public static int patternCostHandGuard; - public static int patternCostCrossbar; - public static int patternCostBinding; - public static int patternCostFrypanHead; - public static int patternCostSignHead; - public static int patternCostKnifeBlade; - public static int patternCostChiselHead; - public static int patternCostToughRod; - public static int patternCostToughBinding; - public static int patternCostHeavyPlate; - public static int patternCostBroadAxeHead; - public static int patternCostScytheBlade; - public static int patternCostExcavatorHead; - public static int patternCostLargeSwordBlade; - public static int patternCostHammerHead; - public static int patternCostFullGuard; - public static int patternCostBowstring; - public static int patternCostFletching; - public static int patternCostArrowHead; - */ - - // modifiers - public static boolean addCleanModifier; - public static boolean moreExpensiveSilkyCloth; - public static boolean moreExpensiveSilkyJewel; - public static int mossRepairSpeed; - public static int redstoneEffect; - - //debug + // debug + public static boolean showDebugXP; public static boolean logHarvestLevelChanges; public static boolean logMiningLevelChanges; - - //other - public static boolean toolsNeverDespawn; - public static boolean partTooltips; - public static boolean partReplacement; - public static boolean cobaltArmor; - public static boolean removeStoneTorchRecipe; - public static boolean removeFlintDrop; - public static boolean addFlintRecipe; - public static int durabilityPercentage; - public static int miningSpeedPercentage; - - // Harvest Levels - public static List harvestLevel0Ids = new ArrayList(); - public static List harvestLevel1Ids = new ArrayList(); - public static List harvestLevel2Ids = new ArrayList(); - public static List harvestLevel3Ids = new ArrayList(); - public static List harvestLevel4Ids = new ArrayList(); - public static List harvestLevel5Ids = new ArrayList(); - public static List harvestLevel6Ids = new ArrayList(); - public static List harvestLevel7Ids = new ArrayList(); - - // Pickaxe mining level overrides - public static HashMap pickaxeOverrides = new HashMap(); - - //Restrictions - public static boolean allowStoneTools; - public static List restrictedWoodParts = new ArrayList(); - public static List restrictedStoneParts = new ArrayList(); - public static List restrictedFlintParts = new ArrayList(); - public static List restrictedBoneParts = new ArrayList(); - public static List restrictedPaperParts = new ArrayList(); - public static List restrictedSlimeParts = new ArrayList(); - public static List restrictedCactusParts = new ArrayList(); - - public static void init(File file) - { - Configuration config = new Configuration(file); - config.load(); - - // leveling - ConfigCategory levelingCategory = config.getCategory("leveling"); - levelingCategory.setComment("Setup the leveling system how you like it"); - - Property detailedXpTooltipProperty = config.get("leveling", "detailedXpTooltip", false); - detailedXpTooltipProperty.comment = "XP tooltip shows numbers, in addition to percentage"; - detailedXpTooltip = detailedXpTooltipProperty.getBoolean(false); - - Property toolLevelingProperty = config.get("leveling", "toolLeveling", true); - toolLevelingProperty.comment = "Can your skill with tools 'level up' as you use them?"; - toolLeveling = toolLevelingProperty.getBoolean(true); - - Property toolLevelingExtraModifiersProperty = config.get("leveling", "toolLevelingExtraModifiers", true); - toolLevelingExtraModifiersProperty.comment = "Removes modifiers on new tools and gives them through leveling (requires 'toolLeveling=true')"; - toolLevelingExtraModifiers = toolLevelingExtraModifiersProperty.getBoolean(true); - - Property toolModifiersAtLevelsProperty = config.get("leveling", "toolModifiersAtLevels", new int[]{2,4,6}); - toolModifiersAtLevelsProperty.comment = "Adds an extra modifier on these levleups if 'toolLevelingExtraModifiers' is enabled"; - toolModifiersAtLevels = toolModifiersAtLevelsProperty.getIntList(); - - Property toolLevelingRandomBonusesProperty = config.get("leveling", "toolLevelingRandomBonuses", true); - toolLevelingRandomBonusesProperty.comment = "Gives a random bonus every level, if false and levelling is on modifiers are given at levels 2 and 4 (requires 'toolLeveling=true')"; - toolLevelingRandomBonuses = toolLevelingRandomBonusesProperty.getBoolean(true); - - Property showTooltipXPProperty = config.get("leveling", "showTooltipXP", true); - showTooltipXPProperty.comment = "Current XP is shown when hovering over a tool (requires 'toolLeveling=true')"; - showTooltipXP = showTooltipXPProperty.getBoolean(true); - - Property showMinimalTooltipXPProperty = config.get("leveling", "showMinimalTooltipXP", false); - showMinimalTooltipXPProperty.comment = "Current XP% is shown after the level (requires 'toolLeveling=true')"; - showMinimalTooltipXP = showMinimalTooltipXPProperty.getBoolean(true); - - Property showDebugXPProperty = config.get("leveling", "showDebugXP", false); - showDebugXPProperty.comment = "Current XP is shown as debug (F3) text (requires 'toolLeveling=true')"; - showDebugXP = showDebugXPProperty.getBoolean(false); - - Property xpRequiredToolsPercentageProperty = config.get("leveling", "xpRequiredToolsPercentage", 100); - xpRequiredToolsPercentageProperty.comment = "Change the XP required to level up tools (higher=more) (requires 'toolLeveling' to be true)"; - xpRequiredToolsPercentage = Math.max(xpRequiredToolsPercentageProperty.getInt(100), 1); - xpRequiredToolsPercentageProperty.set(xpRequiredToolsPercentage); - - Property xpRequiredWeaponsPercentageProperty = config.get("leveling", "xpRequiredWeaponsPercentage", 100); - xpRequiredWeaponsPercentageProperty.comment = "Change the XP required to level up weapons (higher=more) (requires 'toolLeveling' to be true)"; - xpRequiredWeaponsPercentage = Math.max(xpRequiredWeaponsPercentageProperty.getInt(100), 1); - xpRequiredWeaponsPercentageProperty.set(xpRequiredWeaponsPercentage); - - Property xpPerLevelMultiplierProperty = config.get("leveling", "xpPerLevelMultiplier", 1.35d); - xpPerLevelMultiplierProperty.comment = "Exponential multiplier on required XP per level"; - xpPerLevelMultiplier = Math.max(xpPerLevelMultiplierProperty.getDouble(1.35d), 1d); - xpPerLevelMultiplierProperty.set(xpPerLevelMultiplier); + public static boolean logToolMaterialChanges; - // pick leveling - ConfigCategory pickboostingCategory = config.getCategory("pickboosting"); - pickboostingCategory.setComment("Options to configure to pickaxe mining level boost mechanics"); - Property pickaxeBoostRequiredProperty = config.get("pickboosting", "pickaxeBoostRequired", true); - pickaxeBoostRequiredProperty.comment = "Pickaxes only mine upto their head material level and need a mob head modifier OR leveling boost to advance"; - pickaxeBoostRequired = pickaxeBoostRequiredProperty.getBoolean(true); - Property mobHeadPickaxeBoostProperty = config.get("pickboosting", "mobHeadPickaxeBoost", true); - mobHeadPickaxeBoostProperty.comment = "Mob heads can be used to boost a pickaxe's mining level"; - mobHeadPickaxeBoost = mobHeadPickaxeBoostProperty.getBoolean(true); + public void init(File file) { + configfile = new Configuration(file); + configfile.load(); - Property levelingPickaxeBoostProperty = config.get("pickboosting", "levelingPickaxeBoost", true); - levelingPickaxeBoostProperty.comment = "A pickaxes mining level can be boosted through gaining XP"; - levelingPickaxeBoost = levelingPickaxeBoostProperty.getBoolean(true); + sync(); + } - Property levelingPickaxeBoostXpPercentageProperty = config.get("pickboosting", "levelingPickaxeBoostXpPercentage", 100); - levelingPickaxeBoostXpPercentageProperty.comment = "Change the percentage of XP required to boost a pick (i.e. 200 means 2x normal boost xp required)"; - levelingPickaxeBoostXpPercentage = Math.max(levelingPickaxeBoostXpPercentageProperty.getInt(100), 1); - levelingPickaxeBoostXpPercentageProperty.set(levelingPickaxeBoostXpPercentage); + public void sync() + { + final String CATEGORY_Leveling = "ToolLeveling"; + final String CATEGORY_PickLeveling = "Pickleveling"; + final String CATEGORY_Heads = "MobHeads"; + final String CATEGORY_Tweaks = "Tweaks"; + final String CATEGORY_Debug = "Debug"; + /** Leveling **/ + configfile.setCategoryComment(CATEGORY_Leveling, "Leveling Module: Setup the leveling system how you like it"); + + // modifying leveling behaviour + xpRequiredToolsPercentage = configfile.getInt("xpRequiredToolsPercentage", CATEGORY_Leveling, 100, 1, 999, "Change the XP required to level up tools in % (higher = more xp needed)"); + xpRequiredWeaponsPercentage = configfile.getInt("xpRequiredWeaponsPercentage", CATEGORY_Leveling, 100, 1, 999, "Change the XP required to level up weapons in % (higher = more xp needed)"); + xpPerLevelMultiplier = configfile.getFloat("xpPerLevelMultiplier", CATEGORY_Leveling, 1.15f, 0.01f, 9.99f, "Exponential multiplier for required xp per level"); + + // tooltip things + showTooltipXP = configfile.getBoolean("showTooltipXP", CATEGORY_Leveling, true, "Current XP is shown when hovering over a tool"); + detailedXpTooltip = configfile.getBoolean("detailedXpTooltip", CATEGORY_Leveling, true, "XP tooltip shows numbers, in addition to percentage"); + showMinimalTooltipXP = configfile.getBoolean("showMinimalTooltipXP", CATEGORY_Leveling, false, "Current XP% is shown after the level"); + + // levelup behaviour + toolLeveling = configfile.getBoolean("toolLeveling", CATEGORY_Leveling, true, "Can your skill with tools 'level up' as you use them?"); + toolLevelingExtraModifiers = configfile.getBoolean("ExtraModifiers", CATEGORY_Leveling, true, "Removes modifiers on new tools and gives them through leveling (requires 'toolLeveling=true')"); + toolLevelingRandomBonuses = configfile.getBoolean("RandomBonuses", CATEGORY_Leveling, true, "Gives a random bonus every level, if false and levelling is on modifiers are given at levels 2 and 4 (requires 'toolLeveling=true')"); + toolModifiersAtLevels = configfile.get(CATEGORY_Leveling, "ModifiersAtLevels", new int[]{2,4,6}, "Adds an extra modifier on these levleups if 'toolLevelingExtraModifiers' is enabled").getIntList(); + randomBonusesAreUseful = configfile.getBoolean("UsefulBonuses", CATEGORY_Leveling, true, "Increases chance of getting a useful modifier for the tool drastically (compared to completely random)"); + randomBonusesAreRandom = configfile.getBoolean("CompletelyRandomBonuses", CATEGORY_Leveling, false, "Each modifier is equally likely on levelup. Disables useful bonuses."); + + + /** Pickaxe Boosting **/ + configfile.setCategoryComment(CATEGORY_PickLeveling, "Leveling Module: Allows pickaxes to gain a mining level with enough XP. Should be used with the HarvestLevel Module."); + + // pick boosting behaviour + pickaxeBoostRequired = configfile.getBoolean("pickaxeBoostRequired", CATEGORY_PickLeveling, false, "Every Pickaxes Mining Level is reduced by 1 and need a mob head modifier OR mining levelup (separate from tool level) to advance"); + mobHeadPickaxeBoost = configfile.getBoolean("allowMobHeadBoost", CATEGORY_PickLeveling, true, "Mob heads can be used to boost a pickaxe's mining level"); + levelingPickaxeBoost = configfile.getBoolean("allowLevelingBoost", CATEGORY_PickLeveling, true, "A pickaxes mining level can be boosted through gaining XP"); + + levelingPickaxeBoostXpPercentage = configfile.getInt("xpRequiredPickBoostPercentage", CATEGORY_PickLeveling, 100, 1, 999, "Change the percentage of XP required to boost a pick (i.e. 200 means 2x normal boost xp required)"); + + + /** MobHeads **/ + // todo: implement + configfile.setCategoryComment(CATEGORY_Heads, "Mob Head Module: Adds additional Mob heads and drops"); + + // drop behaviour + baseHeadDropChance = configfile.getInt("baseDropChange", CATEGORY_Heads, 5, 1, 100, "Base percentage for a head to drop"); + beheadingHeadDropChance = configfile.getInt("beheadingDropChange", CATEGORY_Heads, 2, 1, 100, "Percentage added to base percentage per level of Beheading modifier"); + + + /** Vanilla/TConstruct Tweaks **/ + // todo: implement + configfile.setCategoryComment(CATEGORY_Tweaks, "Tweak Module: Tweaks to vanilla Minecraft and Tinker's Construct"); + + // gravel/flint tweaks + removeFlintDrop = configfile.getBoolean("removeFlintDrop", CATEGORY_Tweaks, true, "Removes the random chance of getting flint from gravel"); + addFlintRecipe = configfile.getBoolean("addFlintRecipe", CATEGORY_Tweaks, true, "Adds a shapeless recipe to get flint from gravel"); + recipeGravelPerFlint = configfile.getInt("gravelPerFlint", CATEGORY_Tweaks, 4, 1, 9, "How many gravel are required to craft one Flint"); + + // Tool durability/speed changes + durabilityPercentage = configfile.getInt("durabilityPercentage", CATEGORY_Tweaks, 80, 1, 999, "Change durability of all tool materials (in percent)"); + durabilityPercentage = configfile.getInt("miningSpeedPercentage", CATEGORY_Tweaks, 100, 1, 999, "Change mining speed of all tool materials (in percent)"); + + + // stuff + // todo: implement + removeStoneTorchRecipe = configfile.getBoolean("removeStoneTorchRecipe", CATEGORY_Tweaks, false, "Removes the recipe for Tinker's Construct's stone torch"); + toolsNeverDespawn = configfile.getBoolean("toolsNeverDespawn", CATEGORY_Tweaks, true, "Causes Tinker's tools to never despawn"); + + + /** Debug **/ + configfile.setCategoryComment(CATEGORY_Debug, "Stuff to give you/me more information"); + + showDebugXP = configfile.getBoolean("showDebugXP", CATEGORY_Debug, false, "Current Tool/Pick XP is shown as debug (F3) text"); + + logHarvestLevelChanges = configfile.getBoolean("logBlockHarvestLevelChange", CATEGORY_Debug, false, "Logs when the harvest level of a block is changed"); + logMiningLevelChanges = configfile.getBoolean("logToolMiningLevelChange", CATEGORY_Debug, false, "Logs when the mining level of a (non-tinker) tool is changed"); + logToolMaterialChanges = configfile.getBoolean("logTinkerMaterialChange", CATEGORY_Debug, false, "Logs when the mining level of a tinkers tool material is changed"); + + + /** not implemented anymore **/ +/* // repairs - ConfigCategory repairsCategory = config.getCategory("repairs"); + ConfigCategory repairsCategory = configfile.getCategory("repairs"); repairsCategory.setComment("Changes to tool repairing"); - Property repairCostScalingProperty = config.get("repairs", "repairCostScaling", false); + Property repairCostScalingProperty = configfile.get("repairs", "repairCostScaling", false); repairCostScalingProperty.comment = "Repairs are less effective the more a tool is repaired"; repairCostScaling = repairCostScalingProperty.getBoolean(false); - Property repairLimitActiveProperty = config.get("repairs", "repairLimitActive", false); + Property repairLimitActiveProperty = configfile.get("repairs", "repairLimitActive", false); repairLimitActiveProperty.comment = "Number of times TC tools can be repaired is limited"; repairLimitActive = repairLimitActiveProperty.getBoolean(false); - Property repairLimitProperty = config.get("repairs", "repairLimit", 25); + Property repairLimitProperty = configfile.get("repairs", "repairLimit", 25); repairLimitProperty.comment = "Number of times TC tools can be repaired (only if 'repairLimitActive' is true) (set to 0 to disable repairs)"; repairLimit = Math.max(repairLimitProperty.getInt(25), 0); repairLimitProperty.set(repairLimit); - Property repairScalingModifierProperty = config.get("repairs", "repairScalingModifier", 5); + Property repairScalingModifierProperty = configfile.get("repairs", "repairScalingModifier", 5); repairScalingModifierProperty.comment = "Repair cost doubles after this many repairs (only if 'repairCostScaling' is true)"; repairScalingModifier = Math.max(repairScalingModifierProperty.getInt(5), 1); repairScalingModifierProperty.set(repairScalingModifier); - Property repairCostPercentageProperty = config.get("repairs", "repairCostPercentage", 100); + Property repairCostPercentageProperty = configfile.get("repairs", "repairCostPercentage", 100); repairCostPercentageProperty.comment = "Increase or decrease repair costs (higher = more expensive)"; repairCostPercentage = Math.max(repairCostPercentageProperty.getInt(100), 1); repairCostPercentageProperty.set(repairCostPercentage); - // heads - ConfigCategory headsCategory = config.getCategory("heads"); - headsCategory.setComment("Configure the mob head modifiers and drops here"); - - Property baseHeadDropChanceProperty = config.get("heads", "baseHeadDropChance", 5); - baseHeadDropChanceProperty.comment = "Base percentage chance for a head to drop (only if 'pickaxeHeads' is true)"; - baseHeadDropChance = Math.max(baseHeadDropChanceProperty.getInt(5), 0); - baseHeadDropChanceProperty.set(baseHeadDropChance); - - Property beheadingHeadDropChanceProperty = config.get("heads", "beheadingHeadDropChance", 2); - beheadingHeadDropChanceProperty.comment = "Percentage chance for a head to drop for each level of beheading (only if 'pickaxeHeads' is true)"; - beheadingHeadDropChance = Math.max(beheadingHeadDropChanceProperty.getInt(2), 0); - beheadingHeadDropChanceProperty.set(beheadingHeadDropChance); // crafting - ConfigCategory craftingCategory = config.getCategory("crafting"); + ConfigCategory craftingCategory = configfile.getCategory("crafting"); craftingCategory.setComment("Allow Tinkers crafting to be done in a normal crafting window"); - Property easyBlankPatternRecipeProperty = config.get("crafting", "easyBlankPatternRecipe", true); + Property easyBlankPatternRecipeProperty = configfile.get("crafting", "easyBlankPatternRecipe", true); easyBlankPatternRecipeProperty.comment = "Allows blank patterns to be crafted with 4 sticks in a square"; easyBlankPatternRecipe = easyBlankPatternRecipeProperty.getBoolean(true); - Property easyPartCraftingProperty = config.get("crafting", "easyPartCrafting", true); + Property easyPartCraftingProperty = configfile.get("crafting", "easyPartCrafting", true); easyPartCraftingProperty.comment = "Allows you to make tool parts in a normal crafting window"; easyPartCrafting = easyPartCraftingProperty.getBoolean(true); - Property easyPatternCraftingProperty = config.get("crafting", "easyPatternCrafting", true); + Property easyPatternCraftingProperty = configfile.get("crafting", "easyPatternCrafting", true); easyPatternCraftingProperty.comment = "Allows you to rotate the the tier 1 patterns in a normal crafting window"; easyPatternCrafting = easyPatternCraftingProperty.getBoolean(true); - Property easyToolCreationProperty = config.get("crafting", "easyToolCreation", true); + Property easyToolCreationProperty = configfile.get("crafting", "easyToolCreation", true); easyToolCreationProperty.comment = "Allows you create tinkers tools in a normal crafting window"; easyToolCreation = easyToolCreationProperty.getBoolean(true); - Property easyToolModificationProperty = config.get("crafting", "easyToolModification", true); + Property easyToolModificationProperty = configfile.get("crafting", "easyToolModification", true); easyToolModificationProperty.comment = "Allows you add modifications to tools in a normal crafting window"; easyToolModification = easyToolModificationProperty.getBoolean(true); - // patterns - /* - ConfigCategory patternsCategory = config.getCategory("patterns"); - patternsCategory.setComment("Set the material cost (in half ingots) required for each pattern type"); - - Property patternCostToolRodProperty = config.get("patterns", "patternCostToolRod", 1); - patternCostToolRodProperty.comment = "TCon default is 1"; - patternCostToolRod = Math.max(patternCostToolRodProperty.getInt(1), 1); - patternCostToolRodProperty.set(patternCostToolRod); - - Property patternCostPickaxeHeadProperty = config.get("patterns", "patternCostPickaxeHead", 6); - patternCostPickaxeHeadProperty.comment = "TCon default is 2"; - patternCostPickaxeHead = Math.max(patternCostPickaxeHeadProperty.getInt(6), 1); - patternCostPickaxeHeadProperty.set(patternCostPickaxeHead); - - Property patternCostShovelHeadProperty = config.get("patterns", "patternCostShovelHead", 2); - patternCostShovelHeadProperty.comment = "TCon default is 2"; - patternCostShovelHead = Math.max(patternCostShovelHeadProperty.getInt(2), 1); - patternCostShovelHeadProperty.set(patternCostShovelHead); - - Property patternCostHatchetHeadProperty = config.get("patterns", "patternCostHatchetHead", 4); - patternCostHatchetHeadProperty.comment = "TCon default is 2"; - patternCostHatchetHead = Math.max(patternCostHatchetHeadProperty.getInt(4), 1); - patternCostHatchetHeadProperty.set(patternCostHatchetHead); - - Property patternCostSwordBladeProperty = config.get("patterns", "patternCostSwordBlade", 4); - patternCostSwordBladeProperty.comment = "TCon default is 2"; - patternCostSwordBlade = Math.max(patternCostSwordBladeProperty.getInt(4), 1); - patternCostSwordBladeProperty.set(patternCostSwordBlade); - - Property patternCostWideGuardProperty = config.get("patterns", "patternCostWideGuard", 1); - patternCostWideGuardProperty.comment = "TCon default is 1"; - patternCostWideGuard = Math.max(patternCostWideGuardProperty.getInt(1), 1); - patternCostWideGuardProperty.set(patternCostWideGuard); - - Property patternCostHandGuardProperty = config.get("patterns", "patternCostHandGuard", 1); - patternCostHandGuardProperty.comment = "TCon default is 1"; - patternCostHandGuard = Math.max(patternCostHandGuardProperty.getInt(1), 1); - patternCostHandGuardProperty.set(patternCostHandGuard); - - Property patternCostCrossbarProperty = config.get("patterns", "patternCostCrossbar", 1); - patternCostCrossbarProperty.comment = "TCon default is 1"; - patternCostCrossbar = Math.max(patternCostCrossbarProperty.getInt(1), 1); - patternCostCrossbarProperty.set(patternCostCrossbar); - - Property patternCostBindingProperty = config.get("patterns", "patternCostBinding", 1); - patternCostBindingProperty.comment = "TCon default is 1"; - patternCostBinding = Math.max(patternCostBindingProperty.getInt(1), 1); - patternCostBindingProperty.set(patternCostBinding); - - Property patternCostFrypanHeadProperty = config.get("patterns", "patternCostFrypanHead", 6); - patternCostFrypanHeadProperty.comment = "TCon default is 2"; - patternCostFrypanHead = Math.max(patternCostFrypanHeadProperty.getInt(6), 1); - patternCostFrypanHeadProperty.set(patternCostFrypanHead); - - Property patternCostSignHeadProperty = config.get("patterns", "patternCostSignHead", 6); - patternCostSignHeadProperty.comment = "TCon default is 2"; - patternCostSignHead = Math.max(patternCostSignHeadProperty.getInt(6), 1); - patternCostSignHeadProperty.set(patternCostSignHead); - - Property patternCostKnifeBladeProperty = config.get("patterns", "patternCostKnifeBlade", 1); - patternCostKnifeBladeProperty.comment = "TCon default is 1"; - patternCostKnifeBlade = Math.max(patternCostKnifeBladeProperty.getInt(1), 1); - patternCostKnifeBladeProperty.set(patternCostKnifeBlade); - - Property patternCostChiselHeadProperty = config.get("patterns", "patternCostChiselHead", 1); - patternCostChiselHeadProperty.comment = "TCon default is 1"; - patternCostChiselHead = Math.max(patternCostChiselHeadProperty.getInt(1), 1); - patternCostChiselHeadProperty.set(patternCostChiselHead); - - Property patternCostToughRodProperty = config.get("patterns", "patternCostToughRod", 6); - patternCostToughRodProperty.comment = "TCon default is 6"; - patternCostToughRod = Math.max(patternCostToughRodProperty.getInt(6), 1); - patternCostToughRodProperty.set(patternCostToughRod); - - Property patternCostToughBindingProperty = config.get("patterns", "patternCostToughBinding", 6); - patternCostToughBindingProperty.comment = "TCon default is 6"; - patternCostToughBinding = Math.max(patternCostToughBindingProperty.getInt(6), 1); - patternCostToughBindingProperty.set(patternCostToughBinding); - - Property patternCostHeavyPlateProperty = config.get("patterns", "patternCostHeavyPlate", 16); - patternCostHeavyPlateProperty.comment = "TCon default is 16"; - patternCostHeavyPlate = Math.max(patternCostHeavyPlateProperty.getInt(16), 1); - patternCostHeavyPlateProperty.set(patternCostHeavyPlate); - - Property patternCostBroadAxeHeadProperty = config.get("patterns", "patternCostBroadAxeHead", 16); - patternCostBroadAxeHeadProperty.comment = "TCon default is 16"; - patternCostBroadAxeHead = Math.max(patternCostBroadAxeHeadProperty.getInt(16), 1); - patternCostBroadAxeHeadProperty.set(patternCostBroadAxeHead); - - Property patternCostScytheBladeProperty = config.get("patterns", "patternCostScytheBlade", 16); - patternCostScytheBladeProperty.comment = "TCon default is 16"; - patternCostScytheBlade = Math.max(patternCostScytheBladeProperty.getInt(16), 1); - patternCostScytheBladeProperty.set(patternCostScytheBlade); - - Property patternCostExcavatorHeadProperty = config.get("patterns", "patternCostExcavatorHead", 16); - patternCostExcavatorHeadProperty.comment = "TCon default is 16"; - patternCostExcavatorHead = Math.max(patternCostExcavatorHeadProperty.getInt(16), 1); - patternCostExcavatorHeadProperty.set(patternCostExcavatorHead); - - Property patternCostLargeSwordBladeProperty = config.get("patterns", "patternCostLargeSwordBlade", 16); - patternCostLargeSwordBladeProperty.comment = "TCon default is 16"; - patternCostLargeSwordBlade = Math.max(patternCostLargeSwordBladeProperty.getInt(16), 1); - patternCostLargeSwordBladeProperty.set(patternCostLargeSwordBlade); - - Property patternCostHammerHeadProperty = config.get("patterns", "patternCostHammerHead", 16); - patternCostHammerHeadProperty.comment = "TCon default is 16"; - patternCostHammerHead = Math.max(patternCostHammerHeadProperty.getInt(16), 1); - patternCostHammerHeadProperty.set(patternCostHammerHead); - - Property patternCostFullGuardProperty = config.get("patterns", "patternCostFullGuard", 6); - patternCostFullGuardProperty.comment = "TCon default is 6"; - patternCostFullGuard = Math.max(patternCostFullGuardProperty.getInt(6), 1); - patternCostFullGuardProperty.set(patternCostFullGuard); - - Property patternCostBowstringProperty = config.get("patterns", "patternCostBowstring", 6); - patternCostBowstringProperty.comment = "TCon default is 6"; - patternCostBowstring = Math.max(patternCostBowstringProperty.getInt(6), 1); - patternCostBowstringProperty.set(patternCostBowstring); - - Property patternCostFletchingProperty = config.get("patterns", "patternCostFletching", 2); - patternCostFletchingProperty.comment = "TCon default is 2"; - patternCostFletching = Math.max(patternCostFletchingProperty.getInt(2), 1); - patternCostFletchingProperty.set(patternCostFletching); - - Property patternCostArrowHeadProperty = config.get("patterns", "patternCostArrowHead", 2); - patternCostArrowHeadProperty.comment = "TCon default is 2"; - patternCostArrowHead = Math.max(patternCostArrowHeadProperty.getInt(2), 1); - patternCostArrowHeadProperty.set(patternCostArrowHead); - */ - - // modifiers - ConfigCategory modifiersCategory = config.getCategory("modifiers"); + ConfigCategory modifiersCategory = configfile.getCategory("modifiers"); modifiersCategory.setComment("Options relating to tool modifiers"); - Property addCleanModifierProperty = config.get("modifiers", "addCleanModifier", true); + Property addCleanModifierProperty = configfile.get("modifiers", "addCleanModifier", true); addCleanModifierProperty.comment = "Silky Cloth can be used to remove all modifiers from a tool (currently safe but not working)"; addCleanModifier = addCleanModifierProperty.getBoolean(true); - Property moreExpensiveSilkyClothProperty = config.get("modifiers", "moreExpensiveSilkyCloth", true); + Property moreExpensiveSilkyClothProperty = configfile.get("modifiers", "moreExpensiveSilkyCloth", true); moreExpensiveSilkyClothProperty.comment = "Silky Cloth needs gold ingots, instead of nuggets"; moreExpensiveSilkyCloth = moreExpensiveSilkyClothProperty.getBoolean(true); - Property moreExpensiveSilkyJewelProperty = config.get("modifiers", "moreExpensiveSilkyJewel", true); + Property moreExpensiveSilkyJewelProperty = configfile.get("modifiers", "moreExpensiveSilkyJewel", true); moreExpensiveSilkyJewelProperty.comment = "Silky Jewel needs emerald block, instead of one emerald"; moreExpensiveSilkyJewel = moreExpensiveSilkyJewelProperty.getBoolean(true); - Property mossRepairSpeedProperty = config.get("modifiers", "mossRepairSpeed", 3); + Property mossRepairSpeedProperty = configfile.get("modifiers", "mossRepairSpeed", 3); mossRepairSpeedProperty.comment = "Rate tools with moss repair (TC default 3)"; mossRepairSpeed = Math.max(mossRepairSpeedProperty.getInt(3), 0); mossRepairSpeedProperty.set(mossRepairSpeed); - Property redstoneEffectProperty = config.get("modifiers", "redstoneEffect", 4); + Property redstoneEffectProperty = configfile.get("modifiers", "redstoneEffect", 4); redstoneEffectProperty.comment = "Amount each piece of redstone increases mining speed (tinkers default is 8)"; redstoneEffect = Math.max(redstoneEffectProperty.getInt(4), 1); redstoneEffectProperty.set(redstoneEffect); - // debug - ConfigCategory debugCategory = config.getCategory("debug"); - debugCategory.setComment("Debugging options"); - - Property logHarvestLevelChangesProperty = config.get("debug", "logHarvestLevelChanges", false); - logHarvestLevelChangesProperty.comment = "Outputs to the log when the harvest level of a block is changed"; - logHarvestLevelChanges = logHarvestLevelChangesProperty.getBoolean(false); - - Property logMiningLevelChangesProperty = config.get("debug", "logMiningLevelChanges", false); - logMiningLevelChangesProperty.comment = "Outputs to the log when the mining level of a tool is changed"; - logMiningLevelChanges = logMiningLevelChangesProperty.getBoolean(false); - - - // other - ConfigCategory otherCategory = config.getCategory("other"); - otherCategory.setComment("Random stuff to configure here"); - - Property cobaltArmorProperty = config.get("other", "cobaltArmor", false); - cobaltArmorProperty.comment = "Changes diamond armor to cobalt armor (more expensive recipe)"; - cobaltArmor = cobaltArmorProperty.getBoolean(false); - - Property partTooltipsProperty = config.get("other", "partTooltips", true); - partTooltipsProperty.comment = "Shows information about tool parts in the mouseover tooltip"; - partTooltips = partTooltipsProperty.getBoolean(true); - - Property partReplacementProperty = config.get("other", "partReplacement", true); - partReplacementProperty.comment = "Can you replace parts of existing tools?"; - partReplacement = partReplacementProperty.getBoolean(true); - - Property removeFlintDropProperty = config.get("other", "removeFlintDrop", true); - removeFlintDropProperty.comment = "Removes the random chance of getting flint from gravel"; - removeFlintDrop = removeFlintDropProperty.getBoolean(true); - - Property addFlintRecipeProperty = config.get("other", "addFlintRecipe", true); - addFlintRecipeProperty.comment = "Adds a shapeless recipe to get flint from 4 gravel blocks"; - addFlintRecipe = addFlintRecipeProperty.getBoolean(true); - - Property removeStoneTorchRecipeProperty = config.get("other", "removeStoneTorchRecipe", true); - removeStoneTorchRecipeProperty.comment = "Removes the recipe for Tinker's Construct's stone torch"; - removeStoneTorchRecipe = removeStoneTorchRecipeProperty.getBoolean(true); - - Property durabilityPercentageProperty = config.get("other", "durabilityPercentage", 50); - durabilityPercentageProperty.comment = "Change durability of all materials here (higher = tougher)"; - durabilityPercentage = Math.max(durabilityPercentageProperty.getInt(50), 1); - durabilityPercentageProperty.set(durabilityPercentage); - - Property miningSpeedPercentageProperty = config.get("other", "miningSpeedPercentage", 100); - miningSpeedPercentageProperty.comment = "Change mining speed of all materials here (higher = faster)"; - miningSpeedPercentage = Math.max(miningSpeedPercentageProperty.getInt(100), 1); - miningSpeedPercentageProperty.set(miningSpeedPercentage); - - Property toolsNeverDespawnProperty = config.get("other", "toolsNeverDespawn", true); - toolsNeverDespawnProperty.comment = "Do Tinker's tools on the ground never despawn?"; - toolsNeverDespawn = toolsNeverDespawnProperty.getBoolean(true); - //restrictions - ConfigCategory restrictionsCategory = config.getCategory("restrictions"); + ConfigCategory restrictionsCategory = configfile.getCategory("restrictions"); restrictionsCategory.setComment("See config section of mod thread for list of pattern ids"); - Property allowStoneToolsProperty = config.get("restrictions", "allowStoneTools", false); + Property allowStoneToolsProperty = configfile.get("restrictions", "allowStoneTools", false); allowStoneToolsProperty.comment = "Allow certain stone tools to be built (if equivalent flint tool can also be made, the stone version is allowed)"; allowStoneTools = allowStoneToolsProperty.getBoolean(false); - Property restrictedWoodPartsProperty = config.get("restrictions", "restrictedWoodParts", new int[] {2,4,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24}); + Property restrictedWoodPartsProperty = configfile.get("restrictions", "restrictedWoodParts", new int[] {2,4,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24}); restrictedWoodPartsProperty.comment = "Pattern ids to restrict for wood parts"; for (int i : restrictedWoodPartsProperty.getIntList()) restrictedWoodParts.add(i); - Property restrictedStonePartsProperty = config.get("restrictions", "restrictedStoneParts", new int[] {}); + Property restrictedStonePartsProperty = configfile.get("restrictions", "restrictedStoneParts", new int[] {}); restrictedStonePartsProperty.comment = "Pattern ids to restrict for stone parts"; for (int i : restrictedStonePartsProperty.getIntList()) restrictedStoneParts.add(i); - Property restrictedFlintPartsProperty = config.get("restrictions", "restrictedFlintParts", new int[] {1,5,6,7,8,9,10,11,14,15,16,17,18,19,20,21,22,23,24}); + Property restrictedFlintPartsProperty = configfile.get("restrictions", "restrictedFlintParts", new int[] {1,5,6,7,8,9,10,11,14,15,16,17,18,19,20,21,22,23,24}); restrictedFlintPartsProperty.comment = "Pattern ids to restrict for flint parts"; for (int i : restrictedFlintPartsProperty.getIntList()) restrictedFlintParts.add(i); - Property restrictedBonePartsProperty = config.get("restrictions", "restrictedBoneParts", new int[] {2,5,6,7,9,10,11,13,14,15,16,17,18,19,20,21,22,23,24}); + Property restrictedBonePartsProperty = configfile.get("restrictions", "restrictedBoneParts", new int[] {2,5,6,7,9,10,11,13,14,15,16,17,18,19,20,21,22,23,24}); restrictedBonePartsProperty.comment = "Pattern ids to restrict for bone parts"; for (int i : restrictedBonePartsProperty.getIntList()) restrictedBoneParts.add(i); - Property restrictedPaperPartsProperty = config.get("restrictions", "restrictedPaperParts", new int[] {2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,19,20,21,22,23,25}); + Property restrictedPaperPartsProperty = configfile.get("restrictions", "restrictedPaperParts", new int[] {2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,19,20,21,22,23,25}); restrictedPaperPartsProperty.comment = "Pattern ids to restrict for paper parts"; for (int i : restrictedPaperPartsProperty.getIntList()) restrictedPaperParts.add(i); - Property restrictedSlimePartsProperty = config.get("restrictions", "restrictedSlimeParts", new int[] {2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25}); + Property restrictedSlimePartsProperty = configfile.get("restrictions", "restrictedSlimeParts", new int[] {2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25}); restrictedSlimePartsProperty.comment = "Pattern ids to restrict for slime parts"; for (int i : restrictedSlimePartsProperty.getIntList()) restrictedSlimeParts.add(i); - Property restrictedCactusPartsProperty = config.get("restrictions", "restrictedCactusParts", new int[] {2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25}); + Property restrictedCactusPartsProperty = configfile.get("restrictions", "restrictedCactusParts", new int[] {2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25}); restrictedCactusPartsProperty.comment = "Pattern ids to restrict for cactus parts"; for (int i : restrictedCactusPartsProperty.getIntList()) restrictedCactusParts.add(i); +*/ - // harvest ids - ConfigCategory harvestidsCategory = config.getCategory("harvestids"); - harvestidsCategory.setComment("Set harvest levels of blocks here (most should be modified by default, so check if needed first)"); - - Property harvestLevel0IdsProperty = config.get("harvestids", "harvestLevel0Ids", new String[] {}); - harvestLevel0IdsProperty.comment = "Block ids (each on seperate line) for blocks to be set to harvest level 0 (stone pick+)"; - for (String i : harvestLevel0IdsProperty.getStringList()) harvestLevel0Ids.add(i); - - Property harvestLevel1IdsProperty = config.get("harvestids", "harvestLevel1Ids", new String[] {}); - harvestLevel1IdsProperty.comment = "Block ids (each on seperate line) for blocks to be set to harvest level 1 (flint pick+)"; - for (String i : harvestLevel1IdsProperty.getStringList()) harvestLevel1Ids.add(i); - - Property harvestLevel2IdsProperty = config.get("harvestids", "harvestLevel2Ids", new String[] {}); - harvestLevel2IdsProperty.comment = "Block ids (each on seperate line) for blocks to be set to harvest level 2 (copper pick+)"; - for (String i : harvestLevel2IdsProperty.getStringList()) harvestLevel2Ids.add(i); - - Property harvestLevel3IdsProperty = config.get("harvestids", "harvestLevel3Ids", new String[] {}); - harvestLevel3IdsProperty.comment = "Block ids (each on seperate line) for blocks to be set to harvest level 3 (iron pick+)"; - for (String i : harvestLevel3IdsProperty.getStringList()) harvestLevel3Ids.add(i); - - Property harvestLevel4IdsProperty = config.get("harvestids", "harvestLevel4Ids", new String[] {}); - harvestLevel4IdsProperty.comment = "Block ids (each on seperate line) for blocks to be set to harvest level 4 (bronze pick+)"; - for (String i : harvestLevel4IdsProperty.getStringList()) harvestLevel4Ids.add(i); - - Property harvestLevel5IdsProperty = config.get("harvestids", "harvestLevel5Ids", new String[] {}); - harvestLevel5IdsProperty.comment = "Block ids (each on seperate line) for blocks to be set to harvest level 5 (alumite pick+)"; - for (String i : harvestLevel5IdsProperty.getStringList()) harvestLevel5Ids.add(i); - - Property harvestLevel6IdsProperty = config.get("harvestids", "harvestLevel6Ids", new String[] {}); - harvestLevel6IdsProperty.comment = "Block ids (each on seperate line) for blocks to be set to harvest level 6 (ardite pick+)"; - for (String i : harvestLevel6IdsProperty.getStringList()) harvestLevel6Ids.add(i); - - Property harvestLevel7IdsProperty = config.get("harvestids", "harvestLevel7Ids", new String[] {}); - harvestLevel7IdsProperty.comment = "Block ids (each on seperate line) for blocks to be set to harvest level 7 (cobalt pick+)"; - for (String i : harvestLevel7IdsProperty.getStringList()) harvestLevel7Ids.add(i); - - - // pickaxe mining level overrides - ConfigCategory pickaxeoverridesCategory = config.getCategory("pickaxeoverrides"); - pickaxeoverridesCategory.setComment("Normally the mod changes the mining levels of all pickaxes to be in line with the new system, override that for specific picks here"); - - Property pickaxeOverridesProperty = config.get("pickaxeoverrides", "pickaxeOverrides", new String[] {}); - // TODO: Find a better way to implement pickaxeOveride - /*pickaxeOverridesProperty.comment = "Format : (Each on a separate line)"; - for (String i : pickaxeOverridesProperty.getStringList()) - { - String[] splt = i.split(":"); - pickaxeOverrides.put(Integer.parseInt(splt[0]), Integer.parseInt(splt[1])); - }*/ - - - config.save(); + configfile.save(); } + @SubscribeEvent + public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) + { + if(event.modID.equals(Reference.MOD_ID)) + sync(); + } + }