2014-11-14 12:02:52 +01:00
|
|
|
/*
|
|
|
|
* This file is part of Applied Energistics 2.
|
|
|
|
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
|
|
|
*
|
|
|
|
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
|
|
|
*/
|
|
|
|
|
2014-09-24 02:26:27 +02:00
|
|
|
package appeng.client.render;
|
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
|
2014-09-24 02:26:27 +02:00
|
|
|
import net.minecraft.util.IIcon;
|
|
|
|
import net.minecraftforge.common.util.ForgeDirection;
|
|
|
|
|
2014-12-29 21:59:05 +01:00
|
|
|
import appeng.client.texture.FlippableIcon;
|
|
|
|
import appeng.client.texture.TmpFlippableIcon;
|
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
|
2014-09-24 02:26:27 +02:00
|
|
|
public class BlockRenderInfo
|
|
|
|
{
|
|
|
|
|
2015-04-06 00:35:42 +02:00
|
|
|
public final BaseBlockRender rendererInstance;
|
2014-09-29 09:54:34 +02:00
|
|
|
private final TmpFlippableIcon tmpTopIcon = new TmpFlippableIcon();
|
|
|
|
private final TmpFlippableIcon tmpBottomIcon = new TmpFlippableIcon();
|
|
|
|
private final TmpFlippableIcon tmpSouthIcon = new TmpFlippableIcon();
|
|
|
|
private final TmpFlippableIcon tmpNorthIcon = new TmpFlippableIcon();
|
|
|
|
private final TmpFlippableIcon tmpEastIcon = new TmpFlippableIcon();
|
|
|
|
private final TmpFlippableIcon tmpWestIcon = new TmpFlippableIcon();
|
2015-04-03 08:54:31 +02:00
|
|
|
private boolean useTmp = false;
|
2014-09-24 02:26:27 +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;
|
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
public BlockRenderInfo( BaseBlockRender inst )
|
|
|
|
{
|
|
|
|
this.rendererInstance = inst;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void updateIcons( FlippableIcon Bottom, FlippableIcon Top, FlippableIcon North, FlippableIcon South, FlippableIcon East, FlippableIcon West )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2014-12-29 15:13:47 +01:00
|
|
|
this.topIcon = Top;
|
|
|
|
this.bottomIcon = Bottom;
|
|
|
|
this.southIcon = South;
|
|
|
|
this.northIcon = North;
|
|
|
|
this.eastIcon = East;
|
|
|
|
this.westIcon = West;
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
public void setTemporaryRenderIcon( IIcon IIcon )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
if( IIcon == null )
|
2014-12-29 15:13:47 +01:00
|
|
|
this.useTmp = false;
|
2014-09-24 02:26:27 +02:00
|
|
|
else
|
|
|
|
{
|
2014-12-29 15:13:47 +01:00
|
|
|
this.useTmp = true;
|
|
|
|
this.tmpTopIcon.setOriginal( IIcon );
|
|
|
|
this.tmpBottomIcon.setOriginal( IIcon );
|
|
|
|
this.tmpSouthIcon.setOriginal( IIcon );
|
|
|
|
this.tmpNorthIcon.setOriginal( IIcon );
|
|
|
|
this.tmpEastIcon.setOriginal( IIcon );
|
|
|
|
this.tmpWestIcon.setOriginal( IIcon );
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
public void setTemporaryRenderIcons( IIcon nTopIcon, IIcon nBottomIcon, IIcon nSouthIcon, IIcon nNorthIcon, IIcon nEastIcon, IIcon nWestIcon )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2014-12-29 15:13:47 +01:00
|
|
|
this.tmpTopIcon.setOriginal( nTopIcon == null ? this.getTexture( ForgeDirection.UP ) : nTopIcon );
|
|
|
|
this.tmpBottomIcon.setOriginal( nBottomIcon == null ? this.getTexture( ForgeDirection.DOWN ) : nBottomIcon );
|
|
|
|
this.tmpSouthIcon.setOriginal( nSouthIcon == null ? this.getTexture( ForgeDirection.SOUTH ) : nSouthIcon );
|
|
|
|
this.tmpNorthIcon.setOriginal( nNorthIcon == null ? this.getTexture( ForgeDirection.NORTH ) : nNorthIcon );
|
|
|
|
this.tmpEastIcon.setOriginal( nEastIcon == null ? this.getTexture( ForgeDirection.EAST ) : nEastIcon );
|
|
|
|
this.tmpWestIcon.setOriginal( nWestIcon == null ? this.getTexture( ForgeDirection.WEST ) : nWestIcon );
|
|
|
|
this.useTmp = true;
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
public FlippableIcon getTexture( ForgeDirection dir )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
if( this.useTmp )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
switch( dir )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
case DOWN:
|
|
|
|
return this.tmpBottomIcon;
|
|
|
|
case UP:
|
|
|
|
return this.tmpTopIcon;
|
|
|
|
case NORTH:
|
|
|
|
return this.tmpNorthIcon;
|
|
|
|
case SOUTH:
|
|
|
|
return this.tmpSouthIcon;
|
|
|
|
case EAST:
|
|
|
|
return this.tmpEastIcon;
|
|
|
|
case WEST:
|
|
|
|
return this.tmpWestIcon;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
switch( dir )
|
|
|
|
{
|
2014-09-24 02:26:27 +02:00
|
|
|
case DOWN:
|
2015-04-03 08:54:31 +02:00
|
|
|
return this.bottomIcon;
|
2014-09-24 02:26:27 +02:00
|
|
|
case UP:
|
2015-04-03 08:54:31 +02:00
|
|
|
return this.topIcon;
|
2014-09-24 02:26:27 +02:00
|
|
|
case NORTH:
|
2015-04-03 08:54:31 +02:00
|
|
|
return this.northIcon;
|
2014-09-24 02:26:27 +02:00
|
|
|
case SOUTH:
|
2015-04-03 08:54:31 +02:00
|
|
|
return this.southIcon;
|
2014-09-24 02:26:27 +02:00
|
|
|
case EAST:
|
2015-04-03 08:54:31 +02:00
|
|
|
return this.eastIcon;
|
2014-09-24 02:26:27 +02:00
|
|
|
case WEST:
|
2015-04-03 08:54:31 +02:00
|
|
|
return this.westIcon;
|
2014-09-24 02:26:27 +02:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-12-29 15:13:47 +01:00
|
|
|
return this.topIcon;
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isValid()
|
|
|
|
{
|
2014-12-29 15:13:47 +01:00
|
|
|
return this.topIcon != null && this.bottomIcon != null && this.southIcon != null && this.northIcon != null && this.eastIcon != null && this.westIcon != null;
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
}
|