mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-11 15:57:31 +00:00
fixed constant feature config lookups
This commit is contained in:
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user