modernize config

This commit is contained in:
FalsePattern committed 2022-06-15 22:28:46 +02:00
1 parent 164ec7b923
commit 072ca7bcf8
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;
}