@Override public void markDirty() { IMachine machine = this.getMachine(); machine.markDirty(); } }
@Override public void markDirty() { super.markDirty(); ++this.guiRefreshCounter; }
@Override public void readFromNBT(final NBTTagCompound nbttagcompound) { super.readFromNBT(nbttagcompound); final NBTTagList indexerNBT = nbttagcompound.getTagList("indexer", 10); this.indexerInventory.clear(); for (int i = 0; i < indexerNBT.tagCount(); ++i) { final NBTTagCompound itemNBT = indexerNBT.getCompoundTagAt(i); this.setInventorySlotContents(i, new ItemStack(itemNBT)); } this.needsSorting = true; this.markDirty(); }
@Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { compound = super.writeToNBT(compound); NBTUtil.writeToList(compound, INVENTORY_KEY, inventory, (index, slot) -> { NBTTagCompound slotTag = new NBTTagCompound(); slotTag.setInteger(INDEX_KEY, index); slot.writeToNBT(slotTag); return slotTag; }); return compound; }
@Override public void readFromNBT(final NBTTagCompound compound) { super.readFromNBT(compound); NBTUtil.readFromList(compound, INVENTORY_KEY, (slotNBT) -> { int index = slotNBT.getInteger(INDEX_KEY); InventorySlot slot = getInternalSlot(index); slot.readFromNBT(slotNBT); }); this.markDirty(); }
@Override public NBTTagCompound writeToNBT(final NBTTagCompound nbttagcompound2) { NBTTagCompound nbttagcompound = super.writeToNBT(nbttagcompound2); final NBTTagList indexerNBT = new NBTTagList(); for (final ItemStack item : this.indexerInventory) { final NBTTagCompound itemNBT = new NBTTagCompound(); item.writeToNBT(itemNBT); indexerNBT.appendTag(itemNBT); } nbttagcompound.setTag("indexer", indexerNBT); return nbttagcompound; }