Example #1
0
  @Override
  public void writeToNBT(NBTTagCompound nbttagcompound) {
    super.writeToNBT(nbttagcompound);

    inv.writeToNBT(nbttagcompound);

    if (box.isInitialized()) {
      NBTTagCompound boxStore = new NBTTagCompound();
      box.writeToNBT(boxStore);
      nbttagcompound.setTag("box", boxStore);
    }

    if (path != null) {
      NBTTagList list = new NBTTagList();

      for (BlockIndex i : path) {
        NBTTagCompound c = new NBTTagCompound();
        i.writeTo(c);
        list.appendTag(c);
      }

      nbttagcompound.setTag("path", list);
    }

    nbttagcompound.setBoolean("done", done);
    fluidTank.writeToNBT(nbttagcompound);

    NBTTagCompound bptNBT = new NBTTagCompound();

    if (currentBuilder != null) {
      NBTTagCompound builderCpt = new NBTTagCompound();
      currentBuilder.saveBuildStateToNBT(builderCpt, this);
      bptNBT.setTag("builderState", builderCpt);
    }

    if (currentPathIterator != null) {
      NBTTagCompound iteratorNBT = new NBTTagCompound();
      new BlockIndex(
              (int) currentPathIterator.ix,
              (int) currentPathIterator.iy,
              (int) currentPathIterator.iz)
          .writeTo(iteratorNBT);
      bptNBT.setTag("iterator", iteratorNBT);
    }

    nbttagcompound.setTag("bptBuilder", bptNBT);
  }