mirror of
https://github.com/GTNewHorizons/Mantle.git
synced 2026-11-21 04:22:22 +00:00
Update ForgeCFG to be usable for ingame GUIs
This commit is contained in:
1 parent
d2d4c368ce
commit
05c7b3f85f
1 file changed
+17
-4
@@ -1,9 +1,13 @@
|
||||
package slimeknights.mantle.pulsar.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Locale;
|
||||
|
||||
import slimeknights.mantle.pulsar.pulse.PulseMeta;
|
||||
|
||||
import net.minecraftforge.common.config.ConfigCategory;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
|
||||
/**
|
||||
@@ -13,7 +17,7 @@ import net.minecraftforge.fml.common.Loader;
|
||||
public class ForgeCFG implements IConfiguration
|
||||
{
|
||||
|
||||
private static Configuration config;
|
||||
private Configuration config;
|
||||
|
||||
private final String confPath;
|
||||
|
||||
@@ -30,20 +34,22 @@ public class ForgeCFG implements IConfiguration
|
||||
public ForgeCFG(String confName, String description)
|
||||
{
|
||||
this.confPath = Loader.instance().getConfigDir().toString() + File.separator + confName + ".cfg";
|
||||
this.description = description;
|
||||
this.description = description.toLowerCase(Locale.US);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load()
|
||||
{
|
||||
config = new Configuration(new File(this.confPath));
|
||||
config = new Configuration(new File(this.confPath), "1");
|
||||
config.load();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModuleEnabled(PulseMeta meta)
|
||||
{
|
||||
return config.get(this.description, meta.getId(), meta.isEnabled(), meta.getDescription()).getBoolean(meta.isEnabled());
|
||||
Property prop = config.get(this.description, meta.getId(), meta.isEnabled(), meta.getDescription());
|
||||
prop.setRequiresMcRestart(true);
|
||||
return prop.getBoolean(meta.isEnabled());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -55,4 +61,11 @@ public class ForgeCFG implements IConfiguration
|
||||
}
|
||||
}
|
||||
|
||||
public Configuration getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
public ConfigCategory getCategory() {
|
||||
return config.getCategory(this.description);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user