public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
TileEntity te = blockAccess.getTileEntity(x, y, z);
int metadata = blockAccess.getBlockMetadata(x,y,z);
if(te instanceof TileEntityTurbinePartBase) {
TileEntityTurbinePartBase part = (TileEntityTurbinePartBase)te;
MultiblockTurbine turbine = part.getTurbine();
if(metadata == METADATA_FLUIDPORT) {
if(te instanceof TileEntityTurbineFluidPort) {
if(turbine == null || !turbine.isAssembled() || part.getOutwardsDir().ordinal() == side)
{
if(((TileEntityTurbineFluidPort)te).getFlowDirection() == FluidFlow.Out)
return _subIcons[SUBICON_FLUIDPORT_OUTPUT];
else
return _icons[METADATA_FLUIDPORT];
}
else if(turbine.isAssembled() && part.getOutwardsDir().ordinal() != side)
return _subIcons[SUBICON_HOUSING_FACE];
}
return getIcon(side, metadata);
}
else if(!part.isConnected() || turbine == null || !turbine.isAssembled()) {
return getIcon(side, metadata);
}
else {
int subIcon = SUBICON_NONE;
if(metadata == METADATA_HOUSING) {
subIcon = getSubIconForHousing(blockAccess, x, y, z, turbine, side);
}
else if(part.getOutwardsDir().ordinal() == side) {
// Only put the fancy icon on one side of the machine. Other parts will use the base.
if(metadata == METADATA_CONTROLLER) {
if(turbine.getActive()) {
subIcon = SUBICON_CONTROLLER_ACTIVE;
}