forked from GTNewHorizons/AdventureBackpack2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfigHandler.java
More file actions
360 lines (328 loc) · 16.4 KB
/
ConfigHandler.java
File metadata and controls
360 lines (328 loc) · 16.4 KB
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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
package com.darkona.adventurebackpack.config;
import java.io.File;
import net.minecraftforge.common.config.Configuration;
import com.darkona.adventurebackpack.reference.ModInfo;
import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class ConfigHandler {
public static Configuration config;
public static boolean allowSoulBound = true;
public static boolean allowTranslucency = true;
public static boolean allowStickyItems = true;
public static boolean backpackDeathPlace = true;
public static boolean backpackAbilities = true;
public static boolean enableCampfireSpawn = false;
public static boolean enableHoseDrink = true;
public static boolean enableToolsCycling = true;
public static boolean fixLead = true;
public static boolean portableSleepingBag = true;
public static boolean tinkerToolsMaintenance = true;
public static boolean enableBackRendering = true;
public static boolean enableFullnessBar = false;
public static boolean enableTemperatureBar = false;
public static boolean enableToolsRender = true;
public static int typeTankRender = 2;
public static boolean showGuiTooltips = true;
public static boolean statusOverlay = true;
public static boolean statusOverlayLeft = true;
public static boolean statusOverlayTop = true;
public static int statusOverlayIndentH = 2;
public static int statusOverlayIndentV = 2;
public static boolean statusOverlayThaumcraft = true;
public static boolean tanksOverlay = true;
public static boolean tanksOverlayRight = true;
public static boolean tanksOverlayBottom = true;
public static int tanksOverlayIndentH = 2;
public static int tanksOverlayIndentV = 1;
public static boolean allowSoundCopter = true;
public static boolean allowSoundJetpack = true;
public static boolean allowSoundPiston = true;
public static boolean enableItemFilters = false;
public static String[] forbiddenDimensions;
public static String[] copterFuels;
private static final String[] defaultFuels = { "biodiesel, 1.0", "biofuel, 1.0", "bioethanol, 1.5", "creosote, 7.0",
"fuel, 0.8", "highoctanegasoline, 0.16", "lava, 5.0", "liquid_light_oil, 3.0", "liquid_medium_oil, 3.0",
"liquid_heavy_oil, 3.0", "liquid_light_fuel, 1.0", "liquid_heavy_fuel, 1.3", "nitrofuel, 0.4", "oil, 3.0",
"rocket_fuel, 0.8" };
public static String[] nameLocalized;
public static String[] nameInternalID;
public static String[] nameInternalIDs;
public static String[] nameUnlocalized;
private static final String[] nameDefault = {};
public static boolean consumeDragonEgg = false;
public static boolean recipeAdventuresSet = true;
public static boolean recipeInflatableBoat = true;
public static boolean recipeInflatableBoatM = false;
public static boolean recipeClockCrossbow = true;
public static boolean recipeCoalJetpack = true;
public static boolean recipeCopterPack = true;
public static boolean recipePitonBoots = true;
public static boolean recipeSaddle = true;
public static boolean recipeMachete = true;
public static boolean pistonBootsAutoStep = true;
public static int pistonBootsJumpHeight = 3;
public static int pistonBootsSprintBoost = 1;
public static int dragonBackpackRegen = 1;
public static int dragonBackpackDamage = 2;
public static int rainbowBackpackSpeed = 1;
public static int rainbowBackpackSSpeed = 3;
public static int rainbowBackpackSJump = 1;
public static boolean allowBatGen = true;
public static boolean allowBonusGen = false;
public static boolean allowGolemGen = true;
public static boolean allowPigmanGen = false;
public static boolean disableVillagerTrade = true;
public static boolean chatSpam = true;
public static int bossBarIndent = 12;
public static void init(File configFile) {
if (config == null) {
config = new Configuration(configFile);
loadConfiguration();
}
}
private static void loadConfiguration() {
// Gameplay
allowSoulBound = config
.getBoolean("Allow SoulBound", "gameplay", true, "Allow SoulBound enchant on wearable packs");
allowTranslucency = config
.getBoolean("Allow Translucency", "gameplay", true, "Allow Translucency enchant on wearable packs");
allowStickyItems = config.getBoolean(
"Allow Sticky Items",
"gameplay",
true,
"Allow Sticky Items potion effect on wearable packs");
backpackAbilities = config.getBoolean(
"Backpack Abilities",
"gameplay",
true,
"Allow the backpacks to execute their special abilities, or be only cosmetic (Doesn't affect lightning transformation) Must be "
+ "disabled in both Client and Server to work properly");
backpackDeathPlace = config
.getBoolean("Backpack Death Place", "gameplay", true, "Place backpacks as a block when you die?");
fixLead = config.getBoolean(
"Fix Vanilla Lead",
"gameplay",
true,
"Fix the vanilla Lead? (Checks mobs falling on a leash to not die of fall damage if they're not falling so fast)");
enableCampfireSpawn = config
.getBoolean("Enable Campfire Spawn", "gameplay", false, "Enable/Disable ability to spawn at campfire");
enableHoseDrink = config.getBoolean("Enable Hose Drink", "gameplay", true, "Enable/Disable hose drink mode");
enableToolsCycling = config.getBoolean("Enable Tools Cycling", "gameplay", true, "Enable/Disable tool cycling");
portableSleepingBag = config.getBoolean(
"Portable Sleeping Bag",
"gameplay",
true,
"Allows to use sleeping bag directly from wearing backpacks. Sleep by one touch");
tinkerToolsMaintenance = config.getBoolean(
"Maintenance Tinker Tools",
"gameplay",
true,
"Allows to maintenance (repair/upgarde) Tinkers Construct tools in backpacks as if it's Crafting Station");
// Graphics
enableBackRendering = config.getBoolean(
"Show Backpack on Back",
"graphics",
true,
"Whether or not to render the backpack when wearing it.");
typeTankRender = config.getInt(
"Tank Render Type",
"graphics",
3,
1,
3,
"1,2 or 3 for different rendering of fluids in the Backpack GUI");
enableFullnessBar = config.getBoolean(
"Enable Fullness Bar",
"graphics",
false,
"Enable durability bar showing fullness of backpacks inventory");
enableTemperatureBar = config.getBoolean(
"Enable Temperature Bar",
"graphics",
false,
"Enable durability bar showing temperature of jetpack");
enableToolsRender = config.getBoolean(
"Enable Tools Render",
"graphics",
true,
"Enable rendering for tools in the backpack tool slots");
showGuiTooltips = config.getBoolean("Hovering Text", "graphics", true, "Show tooltips in GUIs?");
// Graphics.Status
statusOverlay = config
.getBoolean("Enable Overlay", "graphics.status", true, "Show player status effects on screen?");
statusOverlayLeft = config.getBoolean(
"Stick To Left",
"graphics.status",
true,
"Stick to left? Icons will appears from left to right. If false: stick to right, icons will appears from right to left");
statusOverlayTop = config.getBoolean("Stick To Top", "graphics.status", true, "Stick to top?");
statusOverlayIndentH = config
.getInt("Indent Horizontal", "graphics.status", 2, 0, 1000, "Horizontal indent from the window border");
statusOverlayIndentV = config
.getInt("Indent Vertical", "graphics.status", 2, 0, 500, "Vertical indent from the window border");
statusOverlayThaumcraft = config.getBoolean(
"Respect Thaumcraft",
"graphics.status",
true,
"Take into account Thaumcraft wands GUI and do not overlap it");
// Graphics.Tanks
tanksOverlay = config.getBoolean(
"Enable Overlay",
"graphics.tanks",
true,
"Show the different wearable overlays on screen?");
tanksOverlayRight = config.getBoolean("Stick To Right", "graphics.tanks", true, "Stick to right?");
tanksOverlayBottom = config.getBoolean("Stick To Bottom", "graphics.tanks", true, "Stick to bottom?");
tanksOverlayIndentH = config
.getInt("Indent Horizontal", "graphics.tanks", 2, 0, 1000, "Horizontal indent from the window border");
tanksOverlayIndentV = config
.getInt("Indent Vertical", "graphics.tanks", 1, 0, 500, "Vertical indent from the window border");
// Sound
allowSoundCopter = config.getBoolean(
"Copter Pack",
"sound",
true,
"Allow playing the CopterPack sound (Client Only, other players may hear it)");
allowSoundJetpack = config.getBoolean(
"Coal Jetpack",
"sound",
true,
"Allow playing the CoalJetpack sound (Client Only, other players may hear it)");
allowSoundPiston = config.getBoolean("Piston Boots", "sound", true, "Allow playing the PistonBoots sound");
// Items
enableItemFilters = config
.getBoolean("Enable Item Filters", "items", true, "Enable filters from Disallow category");
forbiddenDimensions = config.getStringList(
"Forbidden Dimensions",
"items",
nameDefault,
"Disallow opening backpack inventory for specific dimension ID");
copterFuels = config.getStringList(
"Valid Copter Fuels",
"items",
defaultFuels,
"List of valid fuels for Copter. Consumption rate range: 0.05 ~ 20.0. Format: 'fluid, rate', ex.: 'water, 0.0'");
// Items.Disallowed
nameLocalized = config.getStringList(
"By Displayed Name",
"items.disallowed",
nameDefault,
"Disallow items by displayed (localized) name. Not case sensitive. Worst option, use only when there is no choice. Example: Dirt");
nameInternalID = config.getStringList(
"By Internal ID",
"items.disallowed",
nameDefault,
"Disallow items by internal ID. Case sensitive. Example: minecraft:dirt");
nameInternalIDs = config.getStringList(
"By Internal IDs",
"items.disallowed",
nameDefault,
"Disallow items by internal ID. Case sensitive. Will be disallowed all items containing that word in their IDs. Use with caution. Example: minecraft:di");
nameUnlocalized = config.getStringList(
"By Internal Name",
"items.disallowed",
nameDefault,
"Disallow items by internal (unlocalized) name. Not case sensitive. Example: tile.dirt");
// Items.Recipes
consumeDragonEgg = config.getBoolean(
"Consume Dragon Egg",
"items.recipes",
false,
"Consume Dragon Egg when Dragon backpack crafted?");
recipeAdventuresSet = config.getBoolean(
"Adventures Set",
"items.recipes",
true,
"Enable/Disable recipe for Adventure's Hat, Suit and Pants");
recipeInflatableBoat = config
.getBoolean("Inflatable Boat", "items.recipes", true, "Enable/Disable recipe for Inflatable Boat");
recipeInflatableBoatM = config.getBoolean(
"Inflatable Boat Motorized",
"items.recipes",
false,
"Enable/Disable recipe for Inflatable Boat (motorized). For aesthetic only, not fully implemented (yet?)");
recipeClockCrossbow = config
.getBoolean("Clockwork Crossbow", "items.recipes", true, "Enable/Disable Clockwork Crossbow recipe");
recipeCopterPack = config.getBoolean("Copter Pack", "items.recipes", true, "Enable/Disable CopterPack recipe");
recipeCoalJetpack = config
.getBoolean("Coal Jetpack", "items.recipes", true, "Enable/Disable CoalJetpack recipe");
recipePitonBoots = config
.getBoolean("Piston Boots", "items.recipes", true, "Enable/Disable PistonBoots recipe");
recipeSaddle = config.getBoolean("Saddle", "items.recipes", true, "Add recipe for saddle?");
recipeMachete = config.getBoolean("Machete", "items.recipes", true, "Enable/Disable Machete recipe");
// Items.Settings
pistonBootsAutoStep = config
.getBoolean("Piston Boots Auto Step", "items.settings", true, "Allow Piston Boots auto step blocks");
pistonBootsJumpHeight = config
.getInt("Piston Boots Jump Height", "items.settings", 3, 1, 8, "Piston Boots jump height in blocks");
pistonBootsSprintBoost = config
.getInt("Piston Boots Sprint", "items.settings", 1, 0, 4, "Piston Boots sprint boost. 0 - disable");
dragonBackpackRegen = config.getInt(
"Dragon Regeneration",
"items.settings",
1,
0,
4,
"Dragon Backpack regeneration level. 0 - disable");
dragonBackpackDamage = config
.getInt("Dragon Damage Boost", "items.settings", 2, 0, 4, "Dragon Backpack damage boost. 0 - disable");
rainbowBackpackSpeed = config
.getInt("Rainbow Speed", "items.settings", 1, 0, 4, "Rainbow Backpack speed boost. 0 - disable");
rainbowBackpackSSpeed = config.getInt(
"Rainbow Special Speed",
"items.settings",
3,
0,
4,
"Rainbow Backpack special speed. 0 - disable");
rainbowBackpackSJump = config.getInt(
"Rainbow Special Jump",
"items.settings",
1,
0,
4,
"Rainbow Backpack special jump. 0 - disable");
// WorldGen
allowBatGen = config.getBoolean(
"Bat Backpacks",
"worldgen",
true,
"Allow generation of Bat Backpacks in dungeon and mineshaft loot. It cannot be obtained by crafting");
allowBonusGen = config.getBoolean(
"Bonus Backpack",
"worldgen",
false,
"Include a Standard Adventure Backpack in bonus chest?");
allowGolemGen = config.getBoolean(
"IronGolem Backpacks",
"worldgen",
true,
"Allow generation of IronGolem Backpacks in village blacksmith loot. It cannot be obtained by crafting");
allowPigmanGen = config.getBoolean(
"Pigman Backpacks",
"worldgen",
false,
"Allow generation of Pigman Backpacks in dungeon loot and villager trades");
disableVillagerTrade = config
.getBoolean("Disable Villager Trade", "worldgen", true, "Disables trade for Villager Backpacks");
// Experimental
bossBarIndent = config.getInt(
"Boss Bar Indent",
"experimental",
0,
0,
500,
"Boss health bar indent from top border, 0 = standard Forge render");
chatSpam = config
.getBoolean("Chat Spam", "experimental", true, "Set this to false to greatly reduce chat spam.");
if (config.hasChanged()) {
config.save();
}
}
@SubscribeEvent
public void onConfigChangeEvent(ConfigChangedEvent.OnConfigChangedEvent event) {
if (event.modID.equalsIgnoreCase(ModInfo.MOD_ID)) {
loadConfiguration();
}
}
}