/** Writes a tile entity to NBT. */
 @Override
 public void writeToNBT(NBTTagCompound par1NBTTagCompound) {
   par1NBTTagCompound.setInteger("QEnergyItemBuffer", this.QEnergyItemBuffer);
   par1NBTTagCompound.setInteger("LastItemValue", this.lastItemValue);
   TileUtil.saveInventory(par1NBTTagCompound, this.inventory);
   super.writeToNBT(par1NBTTagCompound);
 }
  @Override
  public void updateEntity() {
    super.updateEntity();
    if (redstonePower) return;
    if (worldObj.getWorldTime() % 20 == 0) isProcessing = canProcess();
    if (isProcessing) {
      this.lastItemValue = r.getEnergyValue();
      this.QEnergyItemBuffer = this.lastItemValue;

      if (processTime > 0) processTime--;

      this.QEnergyItemBuffer =
          (int) (((float) processTime / (float) r.getProcessTime()) * (float) this.lastItemValue);
      if (this.processTime == 0) process();

      if (this.processTime == -1) processTime = r.getProcessTime();

    } else {
      processTime = -1;
      QEnergyItemBuffer = 0;
    }

    if (updateNextTick) {
      // All nearby players need to be updated if the status of work
      // changes, or if heat runs out / starts up, in order to change
      // texture.
      updateNextTick = false;
      worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
    }
  }
 @Override
 public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
   super.readFromNBT(par1NBTTagCompound);
   TileUtil.readInventory(par1NBTTagCompound, this.inventory);
   this.QEnergyItemBuffer = par1NBTTagCompound.getInteger("QEnergyItemBuffer");
   this.lastItemValue = par1NBTTagCompound.getInteger("LastItemValue");
   updateNextTick = true;
 }