Custom End Portal

This commit is contained in:
paulevsGitch 2021-03-19 00:11:18 +03:00
parent 22e916f4a1
commit 674d80a3de
6 changed files with 109 additions and 35 deletions

View file

@ -0,0 +1,41 @@
package ru.betterend.util;
import java.io.File;
import java.io.IOException;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtIo;
import ru.betterend.BetterEnd;
public class WorldDataUtil {
private static CompoundTag root;
private static File saveFile;
public static void load(File file) {
saveFile = file;
if (file.exists()) {
try {
root = NbtIo.read(file);
}
catch (IOException e) {
BetterEnd.LOGGER.error("World data loading failed", e);
root = new CompoundTag();
}
return;
}
root = new CompoundTag();
}
public static CompoundTag getRootTag() {
return root;
}
public static void saveFile() {
try {
NbtIo.write(root, saveFile);
}
catch (IOException e) {
BetterEnd.LOGGER.error("World data saving failed", e);
}
}
}