use of net.minecraft.nbt.NbtCompound in project EdenClient by HahaOO7.
the class ChestShopEntry method toTag.
public NbtCompound toTag() {
NbtCompound tag = new NbtCompound();
tag.putIntArray("pos", new int[] { pos.getX(), pos.getY(), pos.getZ() });
tag.putString("owner", owner);
tag.putString("item", item);
tag.putInt("amount", amount);
if (canBuy())
tag.putInt("buyPrice", buyPrice);
if (canSell())
tag.putInt("sellPrice", sellPrice);
return tag;
}
use of net.minecraft.nbt.NbtCompound in project EdenClient by HahaOO7.
the class PerWorldConfig method loadConfig.
private void loadConfig() {
File file = new File(folder, worldName + ".mca");
if (!folder.exists())
folder.mkdirs();
NbtCompound tag = new NbtCompound();
try {
tag = file.exists() ? NbtIo.readCompressed(file) : new NbtCompound();
} catch (IOException e) {
System.err.println("Error while loading PerWorldConfig: " + worldName);
}
NbtCompound finalTag = tag;
registered.forEach((key, obj) -> load(getCompound(finalTag, key), obj));
}
use of net.minecraft.nbt.NbtCompound in project EdenClient by HahaOO7.
the class PerWorldConfig method saveConfig.
private void saveConfig() {
NbtCompound tag = new NbtCompound();
registered.forEach((key, obj) -> {
NbtCompound compound = getCompound(tag, key);
save(compound, obj);
});
File file = new File(folder, worldName + ".mca");
if (!folder.exists())
folder.mkdirs();
try {
NbtIo.writeCompressed(tag, file);
} catch (IOException e) {
System.err.println("Error while saving PerWorldConfig: " + worldName);
}
}
use of net.minecraft.nbt.NbtCompound in project EdenClient by HahaOO7.
the class PerWorldConfig method getCompound.
private NbtCompound getCompound(NbtCompound root, String path) {
if (path.isEmpty())
return root;
String[] a = path.split("\\.");
for (String s : a) {
NbtCompound tag = root.getCompound(s);
root.put(s, tag);
root = tag;
}
return root;
}
use of net.minecraft.nbt.NbtCompound in project EdenClient by HahaOO7.
the class BiStringStringMapLoader method parse.
public NbtCompound parse(String s) {
NbtCompound tag = new NbtCompound();
if (s.isEmpty())
return tag;
String[] a = s.split(";");
for (int i = 0; i < a.length; i++) {
String k = a[i];
i++;
tag.putString(k, a[i]);
}
return tag;
}
Aggregations