mirror of
https://github.com/GTMEGA/EndlessIDs.git
synced 2026-11-16 21:05:01 +00:00
modernize config
This commit is contained in:
2 files changed
+32
-34
No files matched your search
@@ -1,35 +1,22 @@
|
||||
package com.falsepattern.endlessids;
|
||||
|
||||
import java.io.File;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import com.falsepattern.lib.config.Config;
|
||||
|
||||
@Config(modid = Tags.MODID)
|
||||
public class IEConfig {
|
||||
static Configuration config;
|
||||
public static boolean catchUnregisteredBlocks;
|
||||
public static boolean removeInvalidBlocks;
|
||||
public static boolean extendDataWatcher;
|
||||
public static int countCorrectionBits;
|
||||
|
||||
public static void init(final File file) {
|
||||
File newFile;
|
||||
if (file.getPath().contains("bin")) {
|
||||
newFile = new File(file.getParent() + "/eclipse/config", Tags.MODID + ".cfg");
|
||||
}
|
||||
else {
|
||||
newFile = new File(file.getParentFile().getParent() + "/config", Tags.MODID + ".cfg");
|
||||
}
|
||||
IEConfig.config = new Configuration(newFile);
|
||||
IEConfig.catchUnregisteredBlocks = IEConfig.config.getBoolean("CatchUnregisteredBlocks", Tags.MODNAME, false, "");
|
||||
IEConfig.removeInvalidBlocks = IEConfig.config.getBoolean("RemoveInvalidBlocks", Tags.MODNAME, false, "Remove invalid (corrupted) blocks from the game.");
|
||||
IEConfig.extendDataWatcher = IEConfig.config.getBoolean("ExtendDataWatcher", Tags.MODNAME, false, "Extend DataWatcher IDs. Vanilla limit is 31, new limit is 127.");
|
||||
IEConfig.countCorrectionBits = IEConfig.config.getInt("UnusedIDBits", Tags.MODNAME, 0, 0, 12, "Setting this value greater than 0 will reduce RAM usage, at the cost of less available IDs.");
|
||||
IEConfig.config.save();
|
||||
}
|
||||
|
||||
static {
|
||||
IEConfig.catchUnregisteredBlocks = false;
|
||||
IEConfig.removeInvalidBlocks = false;
|
||||
IEConfig.extendDataWatcher = false;
|
||||
IEConfig.countCorrectionBits = 0;
|
||||
}
|
||||
public static boolean catchUnregisteredBlocks = false;
|
||||
|
||||
@Config.Comment("Remove invalid (corrupted) blocks from the game.")
|
||||
public static boolean removeInvalidBlocks = false;
|
||||
|
||||
@Config.Comment("Extend DataWatcher IDs. Vanilla limit is 31, new limit is 127.")
|
||||
public static boolean extendDataWatcher = false;
|
||||
|
||||
@Config.Comment("Setting this value greater than 0 will reduce RAM usage, at the cost of less available Block IDs.\n" +
|
||||
"Notice: This does not affect ITEM IDs.\n" +
|
||||
"By default, block IDs can also go up to 16 Million, and each additional bit in this setting halves\n" +
|
||||
"this value.\n" +
|
||||
"(0: 16M, 1: 8M, 2: 4M, 3: 2M, 4: 1M, 5: 512K, 6: 256K, 7: 128K, 8: 64K, 9: 32K, 10: 16K, 11: 8K, 12: 4K)\n")
|
||||
@Config.RangeInt(min = 0, max = 12)
|
||||
public static int countCorrectionBits = 0;
|
||||
}
|
||||
@@ -1,15 +1,27 @@
|
||||
package com.falsepattern.endlessids;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
|
||||
import com.falsepattern.endlessids.asm.IETransformer;
|
||||
import com.falsepattern.lib.config.ConfigException;
|
||||
import com.falsepattern.lib.config.ConfigurationManager;
|
||||
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
|
||||
|
||||
@IFMLLoadingPlugin.MCVersion("1.7.10")
|
||||
@IFMLLoadingPlugin.TransformerExclusions({ "com.falsepattern.endlessids.asm" })
|
||||
import static cpw.mods.fml.relauncher.IFMLLoadingPlugin.*;
|
||||
|
||||
@MCVersion("1.7.10")
|
||||
@Name(Tags.MODID)
|
||||
@TransformerExclusions({ "com.falsepattern.endlessids.asm" })
|
||||
@DependsOn("falsepatternlib")
|
||||
public class IEPlugin implements IFMLLoadingPlugin
|
||||
{
|
||||
static {
|
||||
try {
|
||||
ConfigurationManager.registerConfig(IEConfig.class);
|
||||
} catch (ConfigException e) {
|
||||
System.err.println("Failed to load EndlessIDs config. Using defaults.");
|
||||
}
|
||||
}
|
||||
public IEPlugin() {
|
||||
super();
|
||||
}
|
||||
@@ -27,7 +39,6 @@ public class IEPlugin implements IFMLLoadingPlugin
|
||||
}
|
||||
|
||||
public void injectData(final Map<String, Object> data) {
|
||||
IEConfig.init((File) data.get("coremodLocation"));
|
||||
IETransformer.isObfuscated = (Boolean) data.get("runtimeDeobfuscationEnabled");
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user