-
Notifications
You must be signed in to change notification settings - Fork 18
/
Config.java
768 lines (668 loc) · 31.2 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
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
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
package knightminer.inspirations.common;
import knightminer.inspirations.common.config.CachedBoolean;
import knightminer.inspirations.common.config.CachedValue;
import net.minecraftforge.common.ForgeConfigSpec;
import java.util.ArrayList;
import java.util.List;
import static net.minecraftforge.common.ForgeConfigSpec.BooleanValue;
import static net.minecraftforge.common.ForgeConfigSpec.Builder;
import static net.minecraftforge.common.ForgeConfigSpec.ConfigValue;
@SuppressWarnings("WeakerAccess")
public class Config {
/** List of all cached config values, for cache clearing */
private static final List<CachedValue<?>> CACHED_VALUES = new ArrayList<>();
// TODO: add client config
public static Builder BUILDER;
public static ForgeConfigSpec SPEC;
public static Builder BUILDER_OVERRIDE;
public static ForgeConfigSpec SPEC_OVERRIDE;
// modules
public static CachedBoolean buildingModule;
public static CachedBoolean utilityModule;
public static CachedBoolean toolsModule;
public static CachedBoolean tweaksModule;
public static CachedBoolean recipesModule;
// general
public static CachedBoolean showAllVariants;
// building
public static CachedBoolean enableRope;
public static CachedBoolean enableRopeLadder;
public static CachedBoolean enableGlassDoor;
public static CachedBoolean enableMulch;
public static CachedBoolean enablePath;
public static CachedBoolean enableFlowers;
public static CachedBoolean enableEnlightenedBush;
// OVERRIDE
public static CachedBoolean climbableIronBars;
public static CachedBoolean enableBookshelf;
public static CachedBoolean enableColoredBooks;
public static CachedBoolean bookshelvesBoostEnchanting;
public static CachedValue<Double> defaultEnchantingPower;
public static CachedValue<String> bookKeywords;
private static final String BOOK_KEYWORD_DEFAULTS = "almanac, atlas, book, catalogue, concordance, dictionary, directory, encyclopedia, guide, journal, lexicon, manual, thesaurus, tome";
// utility
public static CachedBoolean enableTorchLever;
public static CachedBoolean enableRedstoneBook;
public static CachedBoolean enableBricksButton;
public static CachedBoolean enableCarpetedTrapdoor;
public static CachedBoolean enableCarpetedPressurePlate;
public static CachedBoolean enableCollector;
public static CachedBoolean enablePipe;
public static CachedBoolean pipeUpwards;
//public static BooleanValue enableDispenserFluidTanks;
//public static BooleanValue milkSquids;
//public static IntValue milkSquidCooldown;
// recipes
// cauldron
public static CachedBoolean cauldronRecipes;
public static CachedBoolean cauldronConcrete;
// extended
public static CachedBoolean extendedCaulronRecipes;
public static CachedBoolean extendedCauldron;
// fluids
public static CachedBoolean enableCauldronFluids;
// dyes
public static CachedBoolean enableCauldronDyeing;
public static CachedBoolean extraBottleRecipes;
// potions
public static CachedBoolean enableCauldronPotions;
public static CachedBoolean enableCauldronBrewing;
public static CachedBoolean cauldronTipArrows;
// misc
public static CachedBoolean fasterCauldronRain;
// anvil smashing
public static CachedBoolean enableAnvilSmashing;
// tools
public static CachedBoolean enableLock;
public static CachedBoolean enableRedstoneCharger;
public static CachedBoolean enableChargedArrow;
public static CachedBoolean harvestHangingVines;
public static CachedBoolean shearsReclaimMelons;
public static CachedBoolean enableNorthCompass;
public static CachedBoolean enableBarometer;
public static CachedBoolean enablePhotometer;
// waypoint compass
public static CachedBoolean enableWaypointCompass;
public static CachedBoolean dyeWaypointCompass;
public static CachedBoolean craftWaypointCompass;
public static CachedBoolean copyWaypointCompass;
public static CachedBoolean waypointCompassAdvTooltip;
public static CachedBoolean waypointCompassCrossDimension;
// enchantments
public static CachedBoolean moreShieldEnchantments;
public static CachedBoolean shieldEnchantmentTable;
public static CachedBoolean fixShieldTooltip;
public static CachedBoolean axeWeaponEnchants;
public static CachedBoolean axeEnchantmentTable;
// tweaks
public static CachedBoolean enablePigDesaddle;
public static CachedBoolean enableFittedCarpets;
public static CachedBoolean coloredEnchantedRibbons;
public static CachedBoolean coloredFireworkItems;
public static CachedBoolean lilypadBreakFall;
public static CachedBoolean betterCauldronItem;
public static CachedBoolean unstackableRecipeAlts;
public static CachedBoolean dispensersPlaceAnvils;
public static CachedBoolean milkCooldown;
public static CachedValue<Integer> milkCooldownTime;
public static CachedBoolean customPortalColor;
public static CachedBoolean waterlogHopper;
// heartbeet
public static CachedBoolean enableHeartbeet;
private static CachedBoolean brewHeartbeet;
public static boolean brewHeartbeet() {
return brewHeartbeet.get() && enableHeartbeet.get();
}
public static CachedValue<Integer> heartbeetChance;
// seeds
public static CachedBoolean enableBlockCrops;
public static CachedBoolean smoothBlockCropGrowth;
public static CachedBoolean bonemealBlockCrop;
public static CachedBoolean nerfCactusFarms;
// public static BooleanValue enableMoreSeeds;
// private static BooleanValue addGrassDrops;
// private static BooleanValue nerfCarrotPotatoDrops;
// public static boolean addGrassDrops() {
// return addGrassDrops.get() && enableMoreSeeds.get();
// }
// public static boolean nerfCarrotPotatoDrops() {
// return nerfCarrotPotatoDrops.get() && enableMoreSeeds.get();
// }
// bonemeal
public static CachedBoolean bonemealMushrooms;
public static CachedBoolean bonemealDeadBush;
public static CachedBoolean bonemealGrassSpread;
public static CachedBoolean bonemealMyceliumSpread;
public static CachedBoolean caveSpiderDrops;
public static CachedBoolean skeletonSkull;
static {
BUILDER = new Builder();
BUILDER_OVERRIDE = new Builder();
configure(BUILDER, BUILDER_OVERRIDE);
SPEC = BUILDER.build();
SPEC_OVERRIDE = BUILDER_OVERRIDE.build();
}
private static void configure(Builder builder, Builder builder_override) {
builder.push("modules");
{
buildingModule = cached(builder
.comment("Building blocks to improve decoration")
.worldRestart()
.define("building", true));
utilityModule = cached(builder
.comment("Adds tools for automation and redstone interaction")
.worldRestart()
.define("utility", true));
tweaksModule = cached(builder
.comment("Contains tweaks to vanilla features")
.worldRestart()
.define("tweaks", true));
toolsModule = cached(builder
.comment("Includes new tools to reduce dependency on debug features")
.worldRestart()
.define("tools", true));
recipesModule = cached(builder
.comment("Includes new blocks that add new types of recipes")
.worldRestart()
.define("tools", true));
}
builder.pop();
showAllVariants = cached(builder
.comment("Shows all variants for dynamically textured blocks, like bookshelves. If false just the first will be shown")
.define("general.showAllVariants", true));
builder.push("building");
{
// bookshelves
enableBookshelf = and(buildingModule, builder
.comment("Enables the bookshelf: a decorative block to display books")
.worldRestart()
.define("bookshelf.enable", true));
enableColoredBooks = and(enableBookshelf, builder
.comment("Enables colored books: basically colored versions of the vanilla book to decorate bookshelves")
.worldRestart()
.define("bookshelf.coloredBooks", true));
bookshelvesBoostEnchanting = and(buildingModule, builder
.comment("If true, bookshelves will increase enchanting table power.")
.define("bookshelf.boostEnchanting", true));
defaultEnchantingPower = cached(builder
.comment("Default power for a book for enchanting, can be overridden in the book overrides.")
.defineInRange("bookshelf.defaultEnchanting", 1.5f, 0.0f, 15.0f));
bookKeywords = cached(builder
.comment("List of keywords for valid books, used to determine valid books in the bookshelf. Separate each by commas.")
.define("bookshelf.bookKeywords", BOOK_KEYWORD_DEFAULTS));
// rope
enableRope = and(buildingModule, builder
.comment("Enables rope: can be climbed like ladders and extended with additional rope")
.worldRestart()
.define("rope", true));
enableRopeLadder = and(enableRope, builder
.comment("Enables rope ladders: right click ropes with sticks to extend the hitbox")
.define("ropeLadder", true));
climbableIronBars = override(builder_override
.comment("Makes iron bars climbable if a rope is below them.")
.worldRestart()
.define("rope.climbableBars", true));
// glass door
enableGlassDoor = and(buildingModule, builder
.comment("Enables glass doors and trapdoors: basically doors, but made of glass. Not sure what you would expect.")
.worldRestart()
.define("glassDoor", true));
// mulch
enableMulch = and(buildingModule, builder
.comment("Enables mulch: a craftable falling block which supports plants such as flowers")
.worldRestart()
.define("mulch", true));
// path
enablePath = and(buildingModule, builder
.comment("Enables stone paths: a carpet like decorative block for making decorative paths")
.worldRestart()
.define("path", true));
// flowers
enableFlowers = and(buildingModule, builder
.comment("Enables additional flowers from breaking double flowers with shears.")
.worldRestart()
.define("flowers", true));
// enlightenedBush
enableEnlightenedBush = and(buildingModule, builder
.comment("Enables enlightened bushes: bushes with lights.")
.worldRestart()
.define("enlightenedBush", true));
}
builder.pop();
builder.push("utility");
{
enableRedstoneBook = and(utilityModule, enableBookshelf, builder
.comment("Enables the trapped book: will emit redstone power when placed in a bookshelf. Requires bookshelf.")
.worldRestart()
.define("redstoneBook", true));
// torch lever
enableTorchLever = and(utilityModule, builder
.comment("Enables the torch lever: basically a lever which looks like a torch")
.worldRestart()
.define("torchLever", true));
// bricks button
/*
enableBricksButton = builder
.comment("Enables button blocks disguised as a full bricks or nether bricks block")
.worldRestart()
.define("bricksButton", true);
*/
// carpeted trapdoor
enableCarpetedTrapdoor = and(utilityModule, builder
.comment("Enables carpeted trapdoors: a trapdoor which appears to be a carpet when closed")
.worldRestart()
.define("carpetedTrapdoor", true));
// carpeted pressure plate
enableCarpetedPressurePlate = and(utilityModule, builder
.comment("Allows placing a carpet on a stone pressure plate to hide it")
.worldRestart()
.define("carpetedPressurePlate", true));
// collector
enableCollector = and(utilityModule, builder
.comment("Enables the collector: extracts items from inventories or the world similar to a hopper, but can face in all 6 directions and cannot place items in inventories")
.worldRestart()
.define("collector", true));
// pipe
enablePipe = and(utilityModule, builder
.comment("Enables pipes: a more economical hopper that only outputs items, does not pull from inventories. Both cheaper and better for performance.")
.worldRestart()
.define("pipe.enable", true));
pipeUpwards = cached(builder
.comment("Allows pipes to output upwards. This removes a limitation on not being able to pipe items up without dropper elevators, but should be balanced alongside modded pipes.")
.define("pipe.upwards", true));
// dispenser fluid containers
/*
enableDispenserFluidTanks = builder
.comment("Allows dispensers to fill and empty fluid tanks using fluid containers")
.worldRestart()
.define("dispenserFluidTanks", true);
*/
}
builder.pop();
// recipes
builder.push("recipes");
{
/*
// anvil smashing
// configFile.moveProperty("tweaks", "anvilSmashing", "recipes");
enableAnvilSmashing = builder_override
.comment("Anvils break glass blocks and transform blocks into other blocks on landing. Uses a block override, so disable if another mod replaces anvils.")
.worldRestart()
.define("anvilSmashing", true);
*/
// cauldron //
// extended options
extendedCauldron = override(builder_override
.comment("Replace the cauldron block to allow it to hold other liquids and perform extended recipes.")
.worldRestart()
.define("cauldron", true));
builder.push("cauldron");
{
// base config
cauldronRecipes = and(recipesModule, builder
.comment("Allows additional recipes to be performed in the cauldron. If the block replacement is disabled, functionality will be limited to water in cauldrons.")
.define("enable", true));
extendedCaulronRecipes = and(extendedCauldron, cauldronRecipes);
// vanilla recipes
cauldronConcrete = and(cauldronRecipes, builder
.comment("Allows concrete to be made in the cauldron")
.define("concrete", true));
// fluids
enableCauldronFluids = and(extendedCaulronRecipes, builder
.comment("Allows cauldrons to be filled with any fluid and use them in recipes")
.define("fluids.enable", true));
// dyeing
enableCauldronDyeing = and(extendedCaulronRecipes, builder
.comment("Allows cauldrons to be filled with dyes and dye items using cauldrons")
.define("dyeing.enable", true));
/* TODO: reimplement
patchVanillaDyeRecipes = builder
.comment("Makes crafting two dyed water bottles together produce a dyed water bottle. Requires modifying vanilla recipes to prevent a conflict")
.define("dyeing.patchVanillaRecipes", true);
*/
extraBottleRecipes = and(enableCauldronDyeing, builder
.comment("Adds extra dyed bottle recipes to craft green and brown")
.define("dyeing.extraBottleRecipes", true));
// potions
enableCauldronPotions = and(cauldronRecipes, extendedCauldron, builder
.comment("Allows cauldrons to be filled with potions and support brewing")
.define("potions.enable", true));
enableCauldronBrewing = and(enableCauldronPotions, builder
.comment("Allows cauldrons to perform brewing recipes.")
.define("potions.brewing", true));
/* TODO: reconsider
expensiveCauldronBrewing = builder
.comment("Caps brewing at 2 potions per ingredient, requiring 2 ingredients for a full cauldron. Makes the brewing stand still useful and balances better against the bigger cauldron.")
.define("potions.brewingExpensive", true);
*/
cauldronTipArrows = and(enableCauldronPotions, builder
.comment("Allows cauldrons to tip arrows with potions.")
.define("potions.tippedArrow", true));
fasterCauldronRain = and(recipesModule, extendedCauldron, builder
.comment("If true, cauldrons fill faster in the rain.")
.define("fasterRain", true));
// dispensers
/* TODO: reconsider
enableCauldronDispenser = builder
.comment("Allows dispensers to perform some recipes in the cauldron. Intended to be used for recipes to fill and empty fluid containers as droppers can already be used for recipes")
.define("dispenser", true);
*/
}
builder.pop();
}
builder.pop();
builder.push("tools");
{
// redstone charge
enableRedstoneCharger = and(toolsModule, builder
.comment("Enables the redstone charger: a quick pulse created with a flint and steel like item")
.worldRestart()
.define("redstoneCharger", true));
enableChargedArrow = and(toolsModule, builder
.comment("Enables the charged arrow: places a redstone pulse where it lands")
.worldRestart()
.define("chargedArrow", true));
// lock
enableLock = and(toolsModule, builder
.comment("Enables locks and keys: an item allowing you to lock a tile entity to only open for a special named item")
.worldRestart()
.define("lock", true));
// harvest hanging vines
harvestHangingVines = and(toolsModule, builder
.comment("When shearing vines, any supported vines will also be sheared instead of just broken")
.define("shears.harvestHangingVines", true));
// shears reclaim melons
shearsReclaimMelons = and(toolsModule, builder
.comment("Breaking a melon block with shears will always return 9 slices")
.define("reclaimMelons", true));
// compass
enableNorthCompass = and(toolsModule, builder
.comment("Enables the north compass: a cheaper compass that always points north. Intended to either allow packs to replace the compass or as an alternative for F3 navigation")
.worldRestart()
.define("northCompass.enable", true));
/*
renameVanillaCompass = builder
.comment("Renames the vanilla compass to 'origin compass' to help clarify the difference between the two compasses.")
.worldRestart()
.define("northCompass.renameVanilla", true);
*/
// barometer
enableBarometer = and(toolsModule, builder
.comment("Enables the barometer: a tool to measure the player's height in world.")
.worldRestart()
.define("barometer", true));
// photometer
enablePhotometer = and(toolsModule, builder
.comment("Enables the photometer: a tool to measure light in world. Can be pointed at a block to measure the light level of that block.")
.worldRestart()
.define("photometer", true));
// waypoint compass
enableWaypointCompass = and(toolsModule, builder
.comment("Enables the waypoint compass: a compass which points towards a full beacon.")
.worldRestart()
.define("waypointCompass.enable", true));
dyeWaypointCompass = and(enableWaypointCompass, builder
.comment("If true, waypoint compasses can be dyed all vanilla colors")
.worldRestart()
.define("waypointCompass.dye", true));
craftWaypointCompass = and(enableWaypointCompass, builder
.comment("If true, waypoint compasses can be crafted using iron and a blaze rod. If false, they are obtained by using a vanilla compass on a beacon.")
.worldRestart()
.define("waypointCompass.craft", true));
waypointCompassAdvTooltip = cached(builder
.comment("If true, waypoint compasses show the position target in the advanced item tooltip. Disable for packs that disable coordinates.")
.define("waypointCompass.advTooltip", true));
waypointCompassCrossDimension = cached(builder
.comment("If true, waypoint compasses work across dimensions. The coordinates between the overworld and nether will be adjusted, allowing for portal syncing.")
.define("waypointCompass.crossDimension", true));
copyWaypointCompass = and(enableWaypointCompass, builder
.comment("If true, you can copy the position of one waypoint compass to another in a crafting table, similarly to maps or compasses")
.worldRestart()
.define("waypointCompass.copy", true));
// TODO: consider a way to allow the registry sub, but still have these props set by the server
// enchantments
moreShieldEnchantments = cached(builder_override
.comment("If true, shields can now be enchanted with enchantments such as protection, fire aspect, knockback, and thorns. This requires replacing these enchantments.")
.worldRestart()
.define("enchantments.moreShield", true));
shieldEnchantmentTable = andOverride(moreShieldEnchantments, builder_override
.comment("If true, shields can be enchanted in an enchantment table. Does not support modded shields as it requires a registry substitution")
.worldRestart()
.define("enchantments.shieldTable", true));
fixShieldTooltip = and(toolsModule, builder
.comment("If true, fixes the tooltip on shield items so it looks better with both patterns and enchantments")
.worldRestart()
.define("enchantments.fixShieldTooltip", true));
axeWeaponEnchants = cached(builder_override
.comment("If true, axes will be able to be enchanted with weapon enchants such as looting, fire aspect, and knockback")
.worldRestart()
.define("enchantments.axeWeapon", true));
axeEnchantmentTable = cached(builder_override
.comment("If true, axes can receive available weapon enchantments at the enchantment table")
.worldRestart()
.define("enchantments.axeTable", true));
}
builder.pop();
builder.push("tweaks");
{
// pig desaddle
enablePigDesaddle = and(tweaksModule, builder
.comment("Allows pigs to be desaddled by shift-right click with an empty hand")
.define("desaddlePig", true));
// fitted carpets
enableFittedCarpets = override(builder_override
.comment("Replace carpet blocks, allowing them to fit to stairs below them.")
.worldRestart()
.define("fittedCarpets", true));
// waterloggable hoppers
waterlogHopper = override(builder_override
.comment("Replace hopper blocks, allowing them to be waterlogged.")
.worldRestart()
.define("hopper", true));
// bonemeal
builder.push("bonemeal");
bonemealMushrooms = and(tweaksModule, builder
.comment("Bonemeal can be used on mycelium to produce mushrooms")
.define("mushrooms", true));
bonemealDeadBush = and(tweaksModule, builder
.comment("Bonemeal can be used on sand to produce dead bushes")
.define("deadBush", true));
bonemealGrassSpread = and(tweaksModule, builder
.comment("Bonemeal can be used on dirt to produce grass if adjecent to grass")
.define("grassSpread", true));
bonemealMyceliumSpread = and(tweaksModule, builder
.comment("Bonemeal can be used on dirt to produce mycelium if adjecent to mycelium")
.define("myceliumSpread", true));
builder.pop();
// heartroot
enableHeartbeet = and(tweaksModule, builder
.comment("Enables heartbeets: a rare drop from beetroots which can be eaten to restore a bit of health")
.worldRestart()
.define("heartbeet.enable", true));
brewHeartbeet = and(enableHeartbeet, builder
.comment("Allows heartbeets to be used as an alternative to ghast tears in making potions of regeneration")
.worldRestart()
.define("heartbeet.brewRegeneration", true)); // && enableHeartbeet;
// TODO: move to loot tables
heartbeetChance = cached(builder
.comment("Chance of a heartbeet to drop instead of a normal drop. Formula is two 1 in [chance] chances for it to drop each harvest")
.defineInRange("heartbeet.chance", 75, 10, 1000));
// dispensers place anvils
dispensersPlaceAnvils = and(tweaksModule, builder
.comment("Dispensers will place anvils instead of dropping them. Plays well with anvil smashing.")
.worldRestart()
.define("dispensersPlaceAnvils", true));
// better cauldron item
betterCauldronItem = and(tweaksModule, builder
.comment("Replaces the flat cauldron sprite with the 3D cauldron block model")
.worldRestart()
.define("betterCauldronItemModel", true));
// colored enchanted book ribbons
coloredEnchantedRibbons = and(tweaksModule, builder
.comment("The ribbon on enchanted books colors based on the enchantment rarity")
.worldRestart()
.define("coloredEnchantedRibbons", true));
// colored fireworks
coloredFireworkItems = and(tweaksModule, builder
.comment("Colors the fireworks item based on the colors of the stars")
.worldRestart()
.define("coloredFireworkItems", true));
// lilypad fall breaking
lilypadBreakFall = and(tweaksModule, builder
.comment("Lily pads prevent fall damage, but break in the process")
.define("lilypadBreakFall", true));
// stackable alternative recipes
unstackableRecipeAlts = and(tweaksModule, builder
.comment("Adds stackable recipes to some vanilla or Inspriations items that require unstackable items to craft")
.worldRestart()
.define("unstackableRecipeAlts", true));
// seeds
builder.push("seeds");
{
builder.push("blockCrops");
{
enableBlockCrops = and(tweaksModule, builder
.comment("If true, adds seeds for cactus and sugar cane, useful for recipes for the crops")
.worldRestart()
.define("enable", true));
smoothBlockCropGrowth = and(enableBlockCrops, builder
.comment("If true, cactus and sugar cane will grow in 2 pixel increments using the block crops")
.define("smoothGrowth", true));
bonemealBlockCrop = and(tweaksModule, builder
.comment("If true, allows bonemeal to be used to speed block crop growth")
.define("bonemeal", false));
nerfCactusFarms = cached(builder
.comment("If false, cactus seeds planted on cactus have fewer restrictions.",
"Setting to true means cactus seeds are broken by neighboring blocks, meaning classic cactus farms will drop cactus seeds instead of full cactus.")
.define("nerfCactusFarms", false));
}
builder.pop();
/*
builder.push("veggies");
{
enableMoreSeeds = builder
.comment("Adds seeds for carrots and potatoes.")
.worldRestart()
.define("enable", true);
addGrassDrops = builder
.comment("Makes carrot and potato seeds drop from grass")
.define("grassDrops", true);
nerfCarrotPotatoDrops = builder
.comment("Makes carrots and potatoes drop their respective seed if not fully grown")
.define("nerfCarrotPotatoDrops", true);
}
builder.pop();
*/
}
builder.pop();
// milk cooldown
milkCooldown = cached(builder
.comment("Adds a cooldown to milking cows, prevents practically infinite milk in modded worlds where milk is more useful.")
.define("milkCooldown.enable", false));
milkCooldownTime = cached(builder
.comment("Delay in seconds after milking a cow before it can be milked again.")
.defineInRange("milkCooldown.time", 600, 1, Short.MAX_VALUE));
// milk squids
/*
milkSquids = builder
.comment("Allows milking squids with a glass bottle to get black dyed water.")
.define("milkSquids.enable", true);
milkSquidCooldown = builder
.comment("Delay in seconds after milking a squid before it can be milked again.")
.defineInRange("milkSquids.cooldown", 300, 1, Short.MAX_VALUE);
*/
// portal color
customPortalColor = and(tweaksModule, builder
.comment("Allows the portal color to be changed by placing colored blocks under the portal. Any block that tints a beacon beam will work for the color.")
.define("customPortalColor", true));
// drops
caveSpiderDrops = and(tweaksModule, builder
.comment("If true, cave spiders will rarely drop webs, giving them an advantage to farm over regular spiders")
.define("caveSpiderWeb", true));
skeletonSkull = and(tweaksModule, builder
.comment("If true, skeletons will rarely drop their skull for consistency with wither skeletons. Does not affect creeper or zombie heads.")
.define("skeletonSkull", true));
}
builder.pop();
}
/* Helpers */
/**
* Creates a cached config value and adds it to the list to be invalidated on reload
* @param value Config value
* @param <T> Value type
* @return Cached config value
*/
private static <T> CachedValue<T> cached(ConfigValue<T> value) {
CachedValue<T> cached = new CachedValue<>(value);
CACHED_VALUES.add(cached);
return cached;
}
/**
* Creates a cached boolean value and adds it to the list to be invalidated on realod
* @param value Boolean config value
* @return Cached config value
*/
private static CachedBoolean cached(BooleanValue value) {
CachedBoolean cached = new CachedBoolean(value);
CACHED_VALUES.add(cached);
return cached;
}
/**
* Creates a cached config value by anding two config values
* @param first First config value, typically a module
* @param second Property config value
* @return Cached config value
*/
private static CachedBoolean and(CachedBoolean first, BooleanValue second) {
CachedBoolean cached = new CachedBoolean(() -> first.get() && second.get());
CACHED_VALUES.add(cached);
return cached;
}
/**
* Creates a cached config value by anding two config values
* @param first First config value, typically a module
* @param second Property config value
* @return Cached config value
*/
private static CachedBoolean and(CachedBoolean first, CachedBoolean second) {
CachedBoolean cached = new CachedBoolean(() -> first.get() && second.get());
CACHED_VALUES.add(cached);
return cached;
}
/**
* Creates a cached config value by anding three config values
* @param first First config value, typically a module
* @param second Second config value
* @param third Property config value
* @return Cached config value
*/
private static CachedBoolean and(CachedBoolean first, CachedBoolean second, BooleanValue third) {
CachedBoolean cached = new CachedBoolean(() -> first.get() && second.get() && third.get());
CACHED_VALUES.add(cached);
return cached;
}
/* Override methods */
/**
* Creates a cached config value for an override config value. Unlike {@link #cached(BooleanValue)}, override does not invalidate as it does not reload.
* @param value Config value
* @return Cached config value
*/
private static CachedBoolean override(BooleanValue value) {
return new CachedBoolean(value);
}
/**
* Ands two override config properties together, caching the result
* @param first First config value
* @param second Property config value
* @return Cached config value
*/
private static CachedBoolean andOverride(CachedBoolean first, BooleanValue second) {
return new CachedBoolean(() -> first.get() && second.get());
}
/**
* Clears the cache of all regular config values. Called during the config loaded event
*/
public static void clearCache() {
CACHED_VALUES.forEach(CachedValue::invalidate);
}
}