This repository has been archived by the owner on Mar 10, 2021. It is now read-only.
forked from iguanaman/IguanaTweaksTConstruct
/
Config.java
282 lines (216 loc) · 17.6 KB
/
Config.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
package iguanaman.iguanatweakstconstruct.reference;
import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import iguanaman.iguanatweakstconstruct.util.Log;
import iguanaman.iguanatweakstconstruct.restriction.RestrictionHelper;
import net.minecraftforge.common.config.Configuration;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.tools.ToolMaterial;
import java.io.File;
import java.util.*;
public class Config {
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 randomBonusesAreUseful;
public static boolean randomBonusesAreRandom;
// pick boost
public static boolean pickaxeBoostRequired;
public static boolean mobHeadPickaxeBoost;
public static boolean mobHeadRequiresModifier;
public static boolean levelingPickaxeBoost;
public static int levelingPickaxeBoostXpPercentage;
public static float xpPerBoostLevelMultiplier;
// Harvest Leveling
public static boolean nerfBronze;
public static int durabilityPercentage;
public static int miningSpeedPercentage;
// part replacement
public static boolean removeMobHeadOnPartReplacement;
public static int partReplacementXpPenality;
public static int partReplacementBoostXpPenality;
// heads
public static int baseHeadDropChance;
public static int beheadingHeadDropChance;
// tweaks
public static boolean nerfVanillaTools;
public static boolean removeFlintDrop;
public static boolean addFlintRecipe;
public static int recipeGravelPerFlint;
public static boolean disableStoneTools;
public static boolean castsBurnMaterial;
public static boolean easyToolRepair;
public static boolean allowPartReuse;
public static boolean removeStoneTorchRecipe;
public static boolean moreExpensiveSilkyCloth;
public static boolean moreExpensiveSilkyJewel;
public static boolean moreModifiersForFlux;
public static int maxToolRepairs;
//public static float repairAmountMultiplier;
// debug
public static boolean showDebugXP;
public static boolean logHarvestLevelChanges;
public static boolean logMiningLevelChanges;
public static boolean logToolMaterialChanges;
public void init(File file) {
configfile = new Configuration(file);
configfile.load();
sync();
}
public void sync()
{
final String CATEGORY_Leveling = "ToolLeveling";
final String CATEGORY_PickLeveling = "PickLeveling";
final String CATEGORY_HarvestLevels = "HarvestLevelTweaks";
final String CATEGORY_PartReplacement = "PartReplacement";
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, 1.0f, 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, "Disables less-useful modifiers on levelups. Like a sword with silktouch, or a pickaxe with beheading.");
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, true, "Every Pickaxes Mining Level is reduced by 1 and needs a mining levelup (separate from tool level) or, if enabled, a mob head modifier to advance");
levelingPickaxeBoost = configfile.getBoolean("allowLevelingBoost", CATEGORY_PickLeveling, true, "Pickaxes gain Mining Xp. A pickaxes mining level can be boosted through gaining XP. Should be used with pickaxeBoostRequired, otherwise tools will be able to mine higher than normally.");
mobHeadPickaxeBoost = configfile.getBoolean("addMobHeadBoost", CATEGORY_PickLeveling, true, "Mob heads can be used to boost a pickaxe's mining xp (REQUIRES allowLevelBoost)");
mobHeadRequiresModifier = configfile.getBoolean("mobHeadBoostNeedsModifier", CATEGORY_PickLeveling, false, "Mob head boosting requires a free modifier");
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)");
xpPerBoostLevelMultiplier = configfile.getFloat("xpPerBoostLevelMultiplier", CATEGORY_Leveling, 1.12f, 1.0f, 9.99f, "Exponential multiplier for required boost xp per level");
/** HarvestLevel Module **/
configfile.setCategoryComment(CATEGORY_HarvestLevels, "Harvest Level Tweak Module: Introduces a slower mining level progression.");
// bronze levels
nerfBronze = configfile.getBoolean("nerfBronze", CATEGORY_HarvestLevels, false, "Reduces the mining level of bronze by 1. This means bronze can not be used to harvest obsidian. ATTENTION: ONLY USE IF YOU HAVE A WAY OF GETTING STEEL (or something with equivalent mining level)");
// Tool durability/speed changes
durabilityPercentage = configfile.getInt("durabilityPercentage", CATEGORY_HarvestLevels, 80, 1, 999, "Change durability of all tool materials (in percent)");
miningSpeedPercentage = configfile.getInt("miningSpeedPercentage", CATEGORY_HarvestLevels, 100, 1, 999, "Change mining speed of all tool materials (in percent)");
/** PartReplacement Module **/
removeMobHeadOnPartReplacement = configfile.getBoolean("removeMobHead", CATEGORY_PartReplacement, true, "Removes the Mob Head Modifier on Tool-Head replacement, allowing it to be reapplied. Sholud be used with PickBoostXpPenality.");
partReplacementXpPenality = configfile.getInt("XpPenality", CATEGORY_PartReplacement, 0, 0, 100, "How much of the current XP% shall be removed when replacing parts (So if you had 50%, and penality is 10% it'll remove 5% xp, resulting in 45%). Does not remove Skill Levels.");
partReplacementBoostXpPenality = configfile.getInt("PickBoostXpPenality", CATEGORY_PartReplacement, 5, 0, 100, "How much of the current XP% to the next mining level shall be removed when replacing the pickaxe head. Useful to remove the mining level boost on part replacement.");
/** MobHeads **/
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 **/
configfile.setCategoryComment(CATEGORY_Tweaks, "Tweak Module: Tweaks to vanilla Minecraft and Tinker's Construct");
nerfVanillaTools = configfile.getBoolean("ohNoYouAreNOTgoingToUseThatTool", CATEGORY_Tweaks, true, "Makes all non-TConstruct tools mine nothing");
// 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, 3, 1, 9, "How many gravel are required to craft one Flint");
// ticon tweaks
disableStoneTools = configfile.getBoolean("disablestoneTools", CATEGORY_Tweaks, true, "Stone Tools can only be used to create casts, but no tools");
castsBurnMaterial = configfile.getBoolean("castingBurnsMaterial", CATEGORY_Tweaks, true, "Creating a metal cast burns up the material that was used to create it");
easyToolRepair = configfile.getBoolean("easyToolRepair", CATEGORY_Tweaks, true, "Allows to repair your tool in a crafting grid, without tool station");
allowPartReuse = configfile.getBoolean("allowPartReuse", CATEGORY_Tweaks, true, "Allows toolparts to be used as material in the Part Builder. Like, turn a Pick head into a Shovel head.!");
// stuff
removeStoneTorchRecipe = configfile.getBoolean("removeStoneTorchRecipe", CATEGORY_Tweaks, false, "Removes the recipe for Tinker's Construct's stone torch");
moreExpensiveSilkyCloth = configfile.getBoolean("moreExpensiveSilkyCloth", CATEGORY_Tweaks, true, "Silky Cloth needs gold ingots, instead of nuggets");
moreExpensiveSilkyJewel = configfile.getBoolean("moreExpensiveSilkyJewel", CATEGORY_Tweaks, false, "Silky Jewel needs an emerald block, instead of one emerald");
moreModifiersForFlux = configfile.getBoolean("moreModifiersForFlux", CATEGORY_Tweaks, true, "Flux modifier requires 2 Modifiers. Because that stuff is broken.");
// repair
maxToolRepairs = configfile.getInt("repairsLimit", CATEGORY_Tweaks, -1, -1, 999, "Limits the amount how often a tool can be repaired. -1 means unlimited repairs, like normally.");
//repairAmountMultiplier = configfile.getFloat("repairAmountMultiplier", CATEGORY_Tweaks, 1.0f, 0.01f, 9.99f, "A factor that is multiplied onto the amount a tool is repaired. (0.5 = half durability restored per repair, 2.0 = twice as much durability restored per repair)");
/** 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, true, "Logs when the harvest level of a prefix is changed");
logMiningLevelChanges = configfile.getBoolean("logToolMiningLevelChange", CATEGORY_Debug, true, "Logs when the mining level of a (non-tinker) tool is changed");
logToolMaterialChanges = configfile.getBoolean("logTinkerMaterialChange", CATEGORY_Debug, true, "Logs when the mining level of a tinkers tool material is changed");
/** not implemented anymore **/
/*
// repairs
ConfigCategory repairsCategory = configfile.getCategory("repairs");
repairsCategory.setComment("Changes to tool repairing");
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 = configfile.get("repairs", "repairLimitActive", false);
repairLimitActiveProperty.comment = "Number of times TC tools can be repaired is limited";
repairLimitActive = repairLimitActiveProperty.getBoolean(false);
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 = 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 = 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);
// crafting
ConfigCategory craftingCategory = configfile.getCategory("crafting");
craftingCategory.setComment("Allow Tinkers crafting to be done in a normal crafting window");
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 = configfile.get("crafting", "easyPartCrafting", true);
easyPartCraftingProperty.comment = "Allows you to make tool parts in a normal crafting window";
easyPartCrafting = easyPartCraftingProperty.getBoolean(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 = configfile.get("crafting", "easyToolCreation", true);
easyToolCreationProperty.comment = "Allows you create tinkers tools in a normal crafting window";
easyToolCreation = easyToolCreationProperty.getBoolean(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);
// modifiers
ConfigCategory modifiersCategory = configfile.getCategory("modifiers");
modifiersCategory.setComment("Options relating to tool modifiers");
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 = configfile.get("modifiers", "moreExpensiveSilkyCloth", true);
moreExpensiveSilkyClothProperty.comment = "Silky Cloth needs gold ingots, instead of nuggets";
moreExpensiveSilkyCloth = moreExpensiveSilkyClothProperty.getBoolean(true);
Property moreExpensiveSilkyJewelProperty = configfile.get("modifiers", "moreExpensiveSilkyJewel", true);
moreExpensiveSilkyJewelProperty.comment = "Silky Jewel needs emerald prefix, instead of one emerald";
moreExpensiveSilkyJewel = moreExpensiveSilkyJewelProperty.getBoolean(true);
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 = 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);
*/
configfile.save();
}
@SubscribeEvent
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event)
{
if(event.modID.equals(Reference.MOD_ID))
sync();
}
}