gt: 		if (fd != null) {
context: package dinglydell.tftechness.tileentities.machine;
  
  import net.minecraft.block.Block;
  import net.minecraft.block.material.Material;
  import net.minecraft.entity.player.InventoryPlayer;
  import net.minecraft.item.ItemStack;
  import net.minecraft.nbt.NBTTagCompound;
  import net.minecraft.tileentity.TileEntity;
  import net.minecraftforge.common.util.ForgeDirection;
  import net.minecraftforge.fluids.Fluid;
  import net.minecraftforge.fluids.FluidStack;
  import net.minecraftforge.fluids.FluidTankInfo;
  import net.minecraftforge.fluids.IFluidHandler;
  import cofh.core.network.PacketCoFHBase;
  import cofh.core.util.fluid.FluidTankAdv;
  import cofh.lib.util.helpers.FluidHelper;
  import cofh.lib.util.helpers.ServerHelper;
  
  import com.bioxx.tfc.api.HeatIndex;
  import com.bioxx.tfc.api.HeatRegistry;
  import com.bioxx.tfc.api.Metal;
  import com.bioxx.tfc.api.TFC_ItemHeat;
  import com.bioxx.tfc.api.Interfaces.ISmeltable;
  
  import dinglydell.tftechness.block.machine.BlockTFTMachine;
  import dinglydell.tftechness.fluid.TFTFluids;
  import dinglydell.tftechness.gui.GuiRFForge;
  import dinglydell.tftechness.gui.container.ContainerRFForge;
  import dinglydell.tftechness.item.TFTAugments;
  
  public class TileRFForge extends TileTemperatureControl implements
  		IRFForgeMultiBlock, IFluidHandler {
  
  	protected static final int[] tankCapacity = { 4000, 8000, 16000, 32000 };
  
  	// Currently all items have the same properties
  	protected static final float itemSurfaceArea = 0.074f;
  	protected static final float itemMass = 10;
  
  	// protected float internalTemperature = TFTechness.baseTemp;
  
  	protected FluidTankAdv tank = new FluidTankAdv(tankCapacity[0]);
  	/**
  	 * All input slots will have an < this value
  	 */
  	public static final int inputSlotEnd = 6;
  	// protected FluidTankAlloy tankB = new FluidTankAlloy(tankCapacity[0]);
  
  	private int outputTrackerFluid;
  
  	// private FluidTankAdv guiTankA = new FluidTankAdv(tankCapacity[0]);
  	// private FluidTankAdv guiTankB = new FluidTankAdv(tankCapacity[0]);
  
  	public TileRFForge() {
  		super(true);
  		inventory = new ItemStack[8];
  
  	}
  
  	@Override
  	protected boolean shouldActivate() {
  		return true;
  	}
  
  	@Override
  	protected boolean shouldDeactivate() {
  		return false;
  	}
  
  	@Override
  	protected void onActivate() {
  	}
  
  	@Override
  	protected void onDeactivate() {
  	}
  
  	@Override
  	public PacketCoFHBase getGuiPacket() {
  		PacketCoFHBase packet = super.getGuiPacket();
  		packet.addFluidStack(tank.getFluid());
  		return packet;
  
  	}
  
  	@Override
  	public void handleGuiPacket(PacketCoFHBase packet) {
  		super.handleGuiPacket(packet);
  		tank.setFluid(packet.getFluidStack());
  	}
  
  	@Override
  	public void readFromNBT(NBTTagCompound nbt) {
  		super.readFromNBT(nbt);
  		hasMaster = nbt.getBoolean("HasMaster");
  		isMaster = nbt.getBoolean("IsMaster");
  		direction = ForgeDirection.values()[nbt.getInteger("Direction")];
  		tank.readFromNBT(nbt.getCompoundTag("Tank"));
  		outputTrackerFluid = nbt.getInteger("OutputTracker");
  	}
  
  	@Override
  	public void writeToNBT(NBTTagCompound nbt) {
  		super.writeToNBT(nbt);
  		nbt.setBoolean("HasMaster", hasMaster);
  		nbt.setBoolean("IsMaster", isMaster);
  		nbt.setInteger("Direction", direction.ordinal());
  		nbt.setInteger("OutputTracker", outputTrackerFluid);
  		nbt.setTag("Tank", tank.writeToNBT(new NBTTagCompound()));
  	}
  
  	@Override
  	public void updateEntity() {
  		//		if (hasMaster()) {
  		//			if (isMaster()) {
  		super.updateEntity();
  		if (!ServerHelper.isClientWorld(this.worldObj)) {
  			adjustTargetTemperature();
  			transferOutputFluid();
  			transferOutput();
  			heatInventorySlots();
  			handleMoldOutputs();
  		}
  		//			}
  		//		} else {
  		//			setupMultiblock(checkForMultiblock());
  		//
  		//		}
  	}
  
  	private void transferOutputFluid() {
  		if (this.augmentAutoOutput && this.tank.getFluidAmount() > 0) {
  			FluidStack outputBuffer = new FluidStack(this.tank.getFluid(),
  					Math.min(this.tank.getFluidAmount(), 500));
  			for (int i = outputTrackerFluid + 1; i <= outputTrackerFluid + 6; i++) {
  				int j = i % 6;
  				if (this.sideCache[j] == Colours.red.ordinal()
  						|| this.sideCache[j] == Colours.orange.ordinal()) {
  					int k = FluidHelper
  							.insertFluidIntoAdjacentFluidHandler(this,
  									j,
  									outputBuffer,
  									true);
  					if (k > 0) {
  						this.tank.drain(k, true);
  						this.outputTrackerFluid = j;
  						break;
  					}
  				}
  			}
  		}
  
  	}
  
  	//protected void transferOutput() {
  	//	if (!this.augmentAutoOutput) {
  	//		return;
  	//	}
  	//	for (int i = 0; i < inputSlotEnd; i++) {
  	//		if (inventory[i] == null) {
  	//			continue;
  	//		}
  	//		HeatIndex index = HeatRegistry.getInstance()
  	//				.findMatchingIndex(inventory[i]);
  	//		float temp = TFC_ItemHeat.getTemp(inventory[i]);
  	//		if (temp <= index.meltTemp * 0.99) {
  	//			continue;
  	//		}
  	//		for (int j = 0; j < 6; j++) {
  	//			if (this.sideCache[j] == Colours.yellow.ordinal()) {
  	//				//TODO: investigate exactly how this function works
  	//				this.transferItem(i, AUTO_TRANSFER[this.level], j);
  	//			}
  	//		}
  	//	}
  	//
  	//}
  	//
  	private void adjustTargetTemperature() {
  		if (hasAugment(TFTAugments.RFFORGE_AUTO_TEMP, 1)) {
  			float minTemp = MAX_TEMPERATURE;
  			for (int i = 0; i < inputSlotEnd; i++) {
  				//minTemp = Math.min(inventory[i], arg1)
  				ItemStack is = inventory[i];
  				if (is != null) {
  					HeatIndex index = HeatRegistry.getInstance()
  							.findMatchingIndex(is);
  					if (index != null && index.hasOutput()) {
  						minTemp = Math.min(minTemp, index.meltTemp);
  					}
  				}
  			}
  			if (minTemp != MAX_TEMPERATURE) {
  				float oldTarget = targetTemperature;
  				targetTemperature = minTemp - TFTAugments.AUTO_TEMP_THRESHHOLD;
  				if (oldTarget != targetTemperature) {
  					sendModePacket();
  				}
  			}
  		}
  
  	}
  
  	private void setupMultiblock(ForgeDirection fd) {
  