From 0a9f2b0d844805f09b184470969123de82228a1f Mon Sep 17 00:00:00 2001 From: Crystal Spider Date: Thu, 27 Jun 2024 22:55:15 +0200 Subject: [PATCH] Fix (#33) config value resetting after each game start. --- .../it/crystalnest/harvest_with_ease/config/ModConfig.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/it/crystalnest/harvest_with_ease/config/ModConfig.java b/common/src/main/java/it/crystalnest/harvest_with_ease/config/ModConfig.java index 0dc4e67..cd81bd3 100644 --- a/common/src/main/java/it/crystalnest/harvest_with_ease/config/ModConfig.java +++ b/common/src/main/java/it/crystalnest/harvest_with_ease/config/ModConfig.java @@ -196,7 +196,12 @@ protected void define(ModConfigSpec.Builder builder) { " From lesser to greater, Vanilla tiers are: " + String.join(", ", Stream.of(Tiers.values()).sorted(TierUtils::compare).map(tier -> "\"" + tier.toString().toLowerCase() + "\"").toArray(String[]::new)) + ".", " When set to \"none\", multi-harvest will be enabled without a tool too. Note that [require hoe] takes precedence.", " The tier can be specified with either the name of the tier, e.g. \"iron\", or the id of the tier, e.g. \"minecraft:iron\"." - ).define("multi-harvest starting tier", Tiers.WOOD.toString().toLowerCase(), value -> value instanceof String string && ("none".equalsIgnoreCase(string) || TierUtils.isIn(TierUtils.getAllTiers(), string))); + ).define( + "multi-harvest starting tier", + Tiers.WOOD.toString().toLowerCase(), + // With Forge/NeoForge tier registry, the list of all tiers is empty when the game starts and configurations are first checked. + value -> value instanceof String string && ("none".equalsIgnoreCase(string) || TierUtils.getAllTiers().isEmpty() || TierUtils.isIn(TierUtils.getAllTiers(), string)) + ); areaStartingSize = builder.comment(getAreaSizeComments()).defineEnum("starting harvest area size", AreaSize.SINGLE, AreaSize.values()); areaIncrementStep = builder.comment(getAreaStepComments()).defineEnum("area increment step", AreaStep.NONE, AreaStep.values()); }