Files
NotEnoughItems/src/main/java/codechicken/nei/config/ConfigSet.java
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

44 lines
1.1 KiB
Java
Raw Normal View History

2014-04-29 10:54:20 +10:00
package codechicken.nei.config;
2023-09-25 00:35:24 +02:00
import java.io.File;
2023-09-25 00:34:42 +02:00
import net.minecraft.nbt.NBTTagCompound;
2023-09-25 00:35:24 +02:00
import codechicken.lib.config.ConfigTagParent;
import codechicken.nei.NEIServerUtils;
public class ConfigSet {
2019-12-30 20:19:16 -08:00
private final File nbtFile;
2014-04-29 10:54:20 +10:00
public NBTTagCompound nbt;
2019-12-30 20:19:16 -08:00
public final ConfigTagParent config;
2014-04-29 10:54:20 +10:00
2026-11-02 18:20:18 +02:00
public ConfigSet(File nbtFile) {
this(nbtFile, null);
}
2014-04-29 10:54:20 +10:00
public ConfigSet(File nbtFile, ConfigTagParent config) {
this.nbtFile = nbtFile;
this.config = config;
loadNBT();
}
public void loadNBT() {
nbt = new NBTTagCompound();
try {
if (!nbtFile.getParentFile().exists()) nbtFile.getParentFile().mkdirs();
if (!nbtFile.exists()) nbtFile.createNewFile();
if (nbtFile.length() > 0) nbt = NEIServerUtils.readNBT(nbtFile);
2014-04-29 10:54:20 +10:00
} catch (Exception e) {
e.printStackTrace();
}
}
public void saveNBT() {
try {
NEIServerUtils.writeNBT(nbt, nbtFile);
2014-04-29 10:54:20 +10:00
} catch (Exception e) {
e.printStackTrace();
}
}
}