2013-12-27 23:59:59 +01:00
|
|
|
package appeng.client.render;
|
|
|
|
|
2014-02-09 02:34:52 +01:00
|
|
|
import net.minecraft.util.IIcon;
|
|
|
|
import net.minecraftforge.common.util.ForgeDirection;
|
2014-02-23 21:06:07 +01:00
|
|
|
import appeng.client.texture.FlipableIcon;
|
|
|
|
import appeng.client.texture.TmpFlipableIcon;
|
2013-12-27 23:59:59 +01:00
|
|
|
|
|
|
|
public class BlockRenderInfo
|
|
|
|
{
|
|
|
|
|
|
|
|
public BlockRenderInfo(BaseBlockRender inst) {
|
|
|
|
rendererInstance = inst;
|
|
|
|
}
|
|
|
|
|
|
|
|
final public BaseBlockRender rendererInstance;
|
|
|
|
|
|
|
|
private boolean useTmp = false;
|
|
|
|
private TmpFlipableIcon tmpTopIcon = new TmpFlipableIcon();
|
|
|
|
private TmpFlipableIcon tmpBottomIcon = new TmpFlipableIcon();
|
|
|
|
private TmpFlipableIcon tmpSouthIcon = new TmpFlipableIcon();
|
|
|
|
private TmpFlipableIcon tmpNorthIcon = new TmpFlipableIcon();
|
|
|
|
private TmpFlipableIcon tmpEastIcon = new TmpFlipableIcon();
|
|
|
|
private TmpFlipableIcon tmpWestIcon = new TmpFlipableIcon();
|
|
|
|
|
|
|
|
private FlipableIcon topIcon = null;
|
|
|
|
private FlipableIcon bottomIcon = null;
|
|
|
|
private FlipableIcon southIcon = null;
|
|
|
|
private FlipableIcon northIcon = null;
|
|
|
|
private FlipableIcon eastIcon = null;
|
|
|
|
private FlipableIcon westIcon = null;
|
|
|
|
|
2014-02-23 21:06:07 +01:00
|
|
|
public void updateIcons(FlipableIcon Bottom, FlipableIcon Top, FlipableIcon North, FlipableIcon South, FlipableIcon East, FlipableIcon West)
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
|
|
|
topIcon = Top;
|
|
|
|
bottomIcon = Bottom;
|
|
|
|
southIcon = South;
|
|
|
|
northIcon = North;
|
|
|
|
eastIcon = East;
|
|
|
|
westIcon = West;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-02-09 02:34:52 +01:00
|
|
|
public void setTemporaryRenderIcon(IIcon IIcon)
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
2014-02-09 02:34:52 +01:00
|
|
|
if ( IIcon == null )
|
2013-12-27 23:59:59 +01:00
|
|
|
useTmp = false;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
useTmp = true;
|
2014-02-09 02:34:52 +01:00
|
|
|
tmpTopIcon.setOriginal( IIcon );
|
|
|
|
tmpBottomIcon.setOriginal( IIcon );
|
|
|
|
tmpSouthIcon.setOriginal( IIcon );
|
|
|
|
tmpNorthIcon.setOriginal( IIcon );
|
|
|
|
tmpEastIcon.setOriginal( IIcon );
|
|
|
|
tmpWestIcon.setOriginal( IIcon );
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-23 21:06:07 +01:00
|
|
|
public void setTemporaryRenderIcons(IIcon nTopIcon, IIcon nBottomIcon, IIcon nSouthIcon, IIcon nNorthIcon, IIcon nEastIcon, IIcon nWestIcon)
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
|
|
|
tmpTopIcon.setOriginal( nTopIcon == null ? getTexture( ForgeDirection.UP ) : nTopIcon );
|
|
|
|
tmpBottomIcon.setOriginal( nBottomIcon == null ? getTexture( ForgeDirection.DOWN ) : nBottomIcon );
|
|
|
|
tmpSouthIcon.setOriginal( nSouthIcon == null ? getTexture( ForgeDirection.SOUTH ) : nSouthIcon );
|
|
|
|
tmpNorthIcon.setOriginal( nNorthIcon == null ? getTexture( ForgeDirection.NORTH ) : nNorthIcon );
|
|
|
|
tmpEastIcon.setOriginal( nEastIcon == null ? getTexture( ForgeDirection.EAST ) : nEastIcon );
|
|
|
|
tmpWestIcon.setOriginal( nWestIcon == null ? getTexture( ForgeDirection.WEST ) : nWestIcon );
|
|
|
|
useTmp = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public FlipableIcon getTexture(ForgeDirection dir)
|
|
|
|
{
|
|
|
|
if ( useTmp )
|
|
|
|
{
|
|
|
|
switch (dir)
|
|
|
|
{
|
|
|
|
case DOWN:
|
|
|
|
return tmpBottomIcon;
|
|
|
|
case UP:
|
|
|
|
return tmpTopIcon;
|
|
|
|
case NORTH:
|
|
|
|
return tmpNorthIcon;
|
|
|
|
case SOUTH:
|
|
|
|
return tmpSouthIcon;
|
|
|
|
case EAST:
|
|
|
|
return tmpEastIcon;
|
|
|
|
case WEST:
|
|
|
|
return tmpWestIcon;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (dir)
|
|
|
|
{
|
|
|
|
case DOWN:
|
|
|
|
return bottomIcon;
|
|
|
|
case UP:
|
|
|
|
return topIcon;
|
|
|
|
case NORTH:
|
|
|
|
return northIcon;
|
|
|
|
case SOUTH:
|
|
|
|
return southIcon;
|
|
|
|
case EAST:
|
|
|
|
return eastIcon;
|
|
|
|
case WEST:
|
|
|
|
return westIcon;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return topIcon;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isValid()
|
|
|
|
{
|
2014-02-23 21:06:07 +01:00
|
|
|
return topIcon != null && bottomIcon != null && southIcon != null && northIcon != null && eastIcon != null && westIcon != null;
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|