From db89cd25e23a46b4e355f59440806871f31c8983 Mon Sep 17 00:00:00 2001 From: XiaoMoMi <70987828+Xiao-MoMi@users.noreply.github.com> Date: Thu, 5 Sep 2024 00:31:34 +0800 Subject: [PATCH] check enable state of fertilized pots --- .../customcrops/api/core/ConfigManager.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/api/src/main/java/net/momirealms/customcrops/api/core/ConfigManager.java b/api/src/main/java/net/momirealms/customcrops/api/core/ConfigManager.java index b3a36f8..283978d 100644 --- a/api/src/main/java/net/momirealms/customcrops/api/core/ConfigManager.java +++ b/api/src/main/java/net/momirealms/customcrops/api/core/ConfigManager.java @@ -372,14 +372,16 @@ public abstract class ConfigManager implements ConfigLoader, Reloadable { public HashMap> getFertilizedPotMap(Section section) { HashMap> map = new HashMap<>(); if (section != null) { - for (Map.Entry entry : section.getStringRouteMappedValues(false).entrySet()) { - if (entry.getValue() instanceof Section innerSection) { - FertilizerType type = Registries.FERTILIZER_TYPE.get(entry.getKey().replace("-", "_")); - if (type != null) { - map.put(type, Pair.of( - Preconditions.checkNotNull(innerSection.getString("dry"), entry.getKey() + ".dry should not be null"), - Preconditions.checkNotNull(innerSection.getString("wet"), entry.getKey() + ".wet should not be null") - )); + if (section.getBoolean("enable")) { + for (Map.Entry entry : section.getStringRouteMappedValues(false).entrySet()) { + if (entry.getValue() instanceof Section innerSection) { + FertilizerType type = Registries.FERTILIZER_TYPE.get(entry.getKey().replace("-", "_")); + if (type != null) { + map.put(type, Pair.of( + Preconditions.checkNotNull(innerSection.getString("dry"), entry.getKey() + ".dry should not be null"), + Preconditions.checkNotNull(innerSection.getString("wet"), entry.getKey() + ".wet should not be null") + )); + } } } }