Example #1
0
  /**
   * Loads a tag from the file.
   *
   * @param file
   * @return tag
   * @throws IOException
   */
  public static NBTTagCompound load(File file) throws IOException {
    DataInputStream dis = NbtUtils.getDataInput(file);
    NBTTagCompound tag = null;

    try {
      Method method =
          NBTCompressedStreamTools.class.getDeclaredMethod(
              "a", DataInput.class, int.class, NBTReadLimiter.class);
      method.setAccessible(true);

      tag = (NBTTagCompound) method.invoke(null, dis, 0, new NBTReadLimiter(Long.MAX_VALUE));
    } catch (Exception e) {
      e.printStackTrace();
    }

    dis.close();
    return tag;
  }