예제 #1
0
  @Override
  public void readFromNBT(NBTTagCompound nbttagcompound) {
    super.readFromNBT(nbttagcompound);

    inv.readFromNBT(nbttagcompound);

    if (nbttagcompound.hasKey("box")) {
      box.initialize(nbttagcompound.getCompoundTag("box"));
    }

    if (nbttagcompound.hasKey("path")) {
      path = new LinkedList<BlockIndex>();
      NBTTagList list = nbttagcompound.getTagList("path", Constants.NBT.TAG_COMPOUND);

      for (int i = 0; i < list.tagCount(); ++i) {
        path.add(new BlockIndex(list.getCompoundTagAt(i)));
      }
    }

    done = nbttagcompound.getBoolean("done");
    fluidTank.readFromNBT(nbttagcompound);

    // The rest of load has to be done upon initialize.
    initNBT = (NBTTagCompound) nbttagcompound.getCompoundTag("bptBuilder").copy();
  }
예제 #2
0
  @Override
  public void setInventorySlotContents(int i, ItemStack itemstack) {
    inv.setInventorySlotContents(i, itemstack);

    if (!worldObj.isRemote) {
      if (i == 0) {
        iterateBpt(false);
        done = false;
      }
    }
  }
예제 #3
0
  @Override
  public ItemStack decrStackSize(int i, int j) {
    ItemStack result = inv.decrStackSize(i, j);

    if (!worldObj.isRemote) {
      if (i == 0) {
        BuildCraftCore.instance.sendToWorld(
            new PacketCommand(this, "clearItemRequirements", null), worldObj);
        iterateBpt(false);
      }
    }

    return result;
  }
예제 #4
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);
  }
예제 #5
0
 @Override
 public ItemStack getStackInSlotOnClosing(int slot) {
   return inv.getStackInSlotOnClosing(slot);
 }
예제 #6
0
 @Override
 public ItemStack getStackInSlot(int i) {
   return inv.getStackInSlot(i);
 }
예제 #7
0
 @Override
 public int getSizeInventory() {
   return inv.getSizeInventory();
 }