public void updateEntity() {
   super.updateEntity();
   if (!this.initialized && this.worldObj != null) {
     this.intialize();
   }
   if (!this.worldObj.isRemote) {
     if (this.lastX != this.xCoord || this.lastZ != this.yCoord || this.lastY != this.zCoord) {
       this.lastX = this.xCoord;
       this.lastY = this.yCoord;
       this.lastZ = this.zCoord;
       this.onUnloaded();
       this.intialize();
     }
     this.gainFuel();
     if (this.generating > 0) {
       if (this.storage + this.generating <= this.maxStorage) {
         this.storage += this.generating;
       } else {
         this.storage = this.maxStorage;
       }
     }
     boolean needInvUpdate = false;
     double sentPacket = 0.0D;
     for (int i = 0; i < this.chargeSlots.length; ++i) {
       if (this.chargeSlots[i] != null
           && this.chargeSlots[i].getItem() instanceof IElectricItem
           && this.storage > 0) {
         sentPacket =
             ElectricItem.manager.charge(
                 this.chargeSlots[i], (double) this.storage, Integer.MAX_VALUE, false, false);
         if (sentPacket > 0.0D) {
           needInvUpdate = true;
         }
         this.storage = (int) ((double) this.storage - sentPacket);
       }
     }
     if (needInvUpdate) {
       super.markDirty();
     }
   }
 }