@Override
 public void writeCustomNBT(NBTTagCompound nbt, boolean descPacket) {
   energyStorage.writeToNBT(nbt);
   nbt.setInteger("facing", facing.ordinal());
   //		nbt.setIntArray("sockets", sockets);
   nbt.setBoolean("active", active);
 }
 @Override
 public int receiveEnergy(EnumFacing from, int energy, boolean simulate) {
   //		if(sockets[from.ordinal()]==0)
   //			return 0;
   if (from != facing) return 0;
   return energyStorage.receiveEnergy(energy, simulate);
 }
 @Override
 public void readCustomNBT(NBTTagCompound nbt, boolean descPacket) {
   energyStorage.readFromNBT(nbt);
   facing = EnumFacing.getFront(nbt.getInteger("facing"));
   //		sockets = nbt.getIntArray("sockets");
   //		if(sockets.length<6)
   //			sockets = new int[0];
   active = nbt.getBoolean("active");
 }
 @Override
 public void update() {
   if (!worldObj.isRemote) {
     boolean a = active;
     if (active) active = false;
     for (EnumFacing fd : EnumFacing.VALUES) {
       TileEntity tileEntity = worldObj.getTileEntity(getPos().offset(fd));
       int consumed = 0;
       if (tileEntity != null)
         if (tileEntity instanceof IExternalHeatable)
           consumed =
               ((IExternalHeatable) tileEntity)
                   .doHeatTick(
                       energyStorage.getEnergyStored(),
                       worldObj.isBlockIndirectlyGettingPowered(getPos()) > 0);
         else {
           ExternalHeaterHandler.HeatableAdapter adapter =
               ExternalHeaterHandler.getHeatableAdapter(tileEntity.getClass());
           if (adapter != null)
             consumed =
                 adapter.doHeatTick(
                     tileEntity,
                     energyStorage.getEnergyStored(),
                     worldObj.isBlockIndirectlyGettingPowered(getPos()) > 0);
         }
       if (consumed > 0) {
         this.energyStorage.extractEnergy(consumed, false);
         if (!active) active = true;
       }
     }
     if (active != a) {
       this.markDirty();
       this.markContainingBlockForUpdate(null);
       worldObj.addBlockEvent(getPos(), this.getBlockType(), 1, active ? 1 : 0);
     }
   }
 }
 @Override
 public int getMaxEnergyStored(EnumFacing from) {
   return energyStorage.getMaxEnergyStored();
 }