Beispiel #1
0
 public static void injectNBTToFile(File file, NBTTagCompound cmp) {
   try {
     CompressedStreamTools.writeCompressed(cmp, new FileOutputStream(file));
   } catch (IOException e) {
     GuiDevTools.logThrowable(e);
   }
 }
Beispiel #2
0
  public static NBTTagCompound getCacheCompound(File file) {
    if (file == null) throw new RuntimeException("No cache file!");

    try {
      NBTTagCompound cmp = CompressedStreamTools.readCompressed(new FileInputStream(file));
      return cmp;
    } catch (IOException e) {
      NBTTagCompound cmp = new NBTTagCompound();

      try {
        CompressedStreamTools.writeCompressed(cmp, new FileOutputStream(file));
        return getCacheCompound(file);
      } catch (IOException e1) {
        GuiDevTools.logThrowable(e1);
        return null;
      }
    }
  }