fixed constant feature config lookups

This commit is contained in:
boubou_19 committed 2021-12-07 02:11:49 +01:00
1 parent 57730ee5e7
commit 3b436ac6fe
1 file changed
+10 -1
@@ -1,6 +1,8 @@
package team.chisel.config;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import net.minecraft.item.ItemDye;
import net.minecraftforge.common.config.Configuration;
@@ -61,6 +63,8 @@ public class Configurations {
public static boolean fullBlockConcrete;
public static Map<String, Boolean> features = new HashMap<>();
public static boolean refreshConfig() {
String category;
@@ -142,6 +146,11 @@ public class Configurations {
}
}
/* features */
for (Features feature : Features.values()) {
features.putIfAbsent(featureName(feature), config.get("features", featureName(feature), true).getBoolean(true));
}
if (config.hasChanged()) {
config.save();
}
@@ -149,7 +158,7 @@ public class Configurations {
}
public static boolean featureEnabled(Features feature) {
return config.get("features", featureName(feature), true).getBoolean(true) && refreshConfig();
return features.getOrDefault(featureName(feature), false);
}
/**