2013-12-27 23:59:59 +01:00
|
|
|
package appeng.client.render;
|
|
|
|
|
2014-09-20 23:22:45 +02:00
|
|
|
import appeng.client.texture.FlippableIcon;
|
|
|
|
import appeng.client.texture.TmpFlippableIcon;
|
2014-02-09 02:34:52 +01:00
|
|
|
import net.minecraft.util.IIcon;
|
|
|
|
import net.minecraftforge.common.util.ForgeDirection;
|
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;
|
2014-09-20 23:22:45 +02:00
|
|
|
private TmpFlippableIcon tmpTopIcon = new TmpFlippableIcon();
|
|
|
|
private TmpFlippableIcon tmpBottomIcon = new TmpFlippableIcon();
|
|
|
|
private TmpFlippableIcon tmpSouthIcon = new TmpFlippableIcon();
|
|
|
|
private TmpFlippableIcon tmpNorthIcon = new TmpFlippableIcon();
|
|
|
|
private TmpFlippableIcon tmpEastIcon = new TmpFlippableIcon();
|
|
|
|
private TmpFlippableIcon tmpWestIcon = new TmpFlippableIcon();
|
2013-12-27 23:59:59 +01:00
|
|
|
|
2014-09-20 23:22:45 +02:00
|
|
|
private FlippableIcon topIcon = null;
|
|
|
|
private FlippableIcon bottomIcon = null;
|
|
|
|
private FlippableIcon southIcon = null;
|
|
|
|
private FlippableIcon northIcon = null;
|
|
|
|
private FlippableIcon eastIcon = null;
|
|
|
|
private FlippableIcon westIcon = null;
|
2013-12-27 23:59:59 +01:00
|
|
|
|
2014-09-20 23:22:45 +02:00
|
|
|
public void updateIcons(FlippableIcon Bottom, FlippableIcon Top, FlippableIcon North, FlippableIcon South, FlippableIcon East, FlippableIcon 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;
|
|
|
|
}
|
|
|
|
|
2014-09-20 23:22:45 +02:00
|
|
|
public FlippableIcon getTexture(ForgeDirection dir)
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
}
|