@Override
	public void writeToNBT(NBTTagCompound nbt)
	{
		super.writeToNBT(nbt);
		nbt.setInteger("ENERGY", this.heat.heat);
		nbt.setBoolean("ENABLED", this.enabled);
		
		if(this.input != null)
			nbt.setInteger("INPUT", this.input.ordinal());
		
		if(this.output != null)
			nbt.setInteger("OUTPUT", this.output.ordinal());
		
		if(this.screen != null)
			nbt.setInteger("SCREEN", this.screen.ordinal());
		
		NBTTagList itemList = new NBTTagList();
        for (int i = 0; i < stacks.length; i++) {
        	ItemStack stack = stacks[i];
        	if (stack != null) {
        		NBTTagCompound tag = new NBTTagCompound();
        		tag.setByte("Slot", (byte) i);
        		stack.writeToNBT(tag);
        		itemList.appendTag(tag);
        	}
        }
        nbt.setTag("Inventory", itemList);
	}