|
| 1 | +package org.dimdev.vanillafix; |
| 2 | + |
| 3 | +import net.minecraftforge.common.config.Configuration; |
| 4 | +import net.minecraftforge.common.config.Property; |
| 5 | + |
| 6 | +import java.io.File; |
| 7 | + |
| 8 | +public class LoadingConfig { |
| 9 | + |
| 10 | + private Configuration config; |
| 11 | + |
| 12 | + public boolean bugFixes; |
| 13 | + public boolean crashFixes; |
| 14 | + public boolean idLimit; |
| 15 | + public boolean modSupport; |
| 16 | + public boolean profiler; |
| 17 | + public boolean textureFixes; |
| 18 | + |
| 19 | + |
| 20 | + public void init(File file) { |
| 21 | + if (!file.exists()) { |
| 22 | + bugFixes = true; |
| 23 | + crashFixes = true; |
| 24 | + idLimit = true; |
| 25 | + modSupport = true; |
| 26 | + profiler = true; |
| 27 | + textureFixes = true; |
| 28 | + return; |
| 29 | + } |
| 30 | + if (config == null) { |
| 31 | + config = new Configuration(file); |
| 32 | + reload(); |
| 33 | + } |
| 34 | + } |
| 35 | + |
| 36 | + public void reload() { |
| 37 | + bugFixes = getBoolean("bugFixes", "fixes", true); |
| 38 | + crashFixes = getBoolean("crashFixes", "fixes", true); |
| 39 | + idLimit = getBoolean("idLimit", "fixes", true); |
| 40 | + modSupport = getBoolean("modSupport", "fixes", true); |
| 41 | + profiler = getBoolean("profiler", "fixes", true); |
| 42 | + textureFixes = getBoolean("textureFixes", "fixes", true); |
| 43 | + } |
| 44 | + |
| 45 | + private boolean getBoolean(String name, String category, boolean defaultValue) { |
| 46 | + Property prop = config.get(category, name, defaultValue); |
| 47 | + return prop.getBoolean(defaultValue); |
| 48 | + } |
| 49 | + |
| 50 | +} |
0 commit comments