@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(); }
@Override public void setInventorySlotContents(int i, ItemStack itemstack) { inv.setInventorySlotContents(i, itemstack); if (!worldObj.isRemote) { if (i == 0) { iterateBpt(false); done = false; } } }
@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; }
@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); }
@Override public ItemStack getStackInSlotOnClosing(int slot) { return inv.getStackInSlotOnClosing(slot); }
@Override public ItemStack getStackInSlot(int i) { return inv.getStackInSlot(i); }
@Override public int getSizeInventory() { return inv.getSizeInventory(); }