@Override public void setInventorySlotContents(int slot, ItemStack itemstack) { super.setInventorySlotContents(slot, itemstack); if (itemstack != null) { MinechemBlueprint blueprint = MinechemItems.blueprint.getBlueprint(itemstack); setBlueprint(blueprint); } }
@Override public void writeToNBT(NBTTagCompound nbtTagCompound) { super.writeToNBT(nbtTagCompound); ItemStack blueprintStack = inventory[0]; if (blueprintStack != null) { NBTTagCompound blueprintNBT = new NBTTagCompound(); blueprintStack.writeToNBT(blueprintNBT); nbtTagCompound.setTag("blueprint", blueprintNBT); } }
@Override public void readFromNBT(NBTTagCompound nbtTagCompound) { super.readFromNBT(nbtTagCompound); this.inventory = new ItemStack[getSizeInventory()]; this.isComplete = false; NBTTagCompound blueprintNBT = (NBTTagCompound) nbtTagCompound.getTag("blueprint"); if (blueprintNBT != null) { ItemStack blueprintStack = ItemStack.loadItemStackFromNBT(blueprintNBT); MinechemBlueprint blueprint = MinechemItems.blueprint.getBlueprint(blueprintStack); setBlueprint(blueprint); this.inventory[0] = blueprintStack; } }