2013-12-27 23:59:59 +01:00
|
|
|
package appeng.client.texture;
|
|
|
|
|
2014-02-09 02:34:52 +01:00
|
|
|
import net.minecraft.util.IIcon;
|
2013-12-27 23:59:59 +01:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
|
|
|
2014-02-09 02:34:52 +01:00
|
|
|
public class TaughtIcon implements IIcon
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
final float tightness;
|
|
|
|
|
2014-02-09 02:34:52 +01:00
|
|
|
private IIcon p;
|
2013-12-27 23:59:59 +01:00
|
|
|
|
2014-02-09 02:34:52 +01:00
|
|
|
public TaughtIcon(IIcon o, float tightness) {
|
2013-12-27 23:59:59 +01:00
|
|
|
p = o;
|
2014-03-27 05:08:47 +01:00
|
|
|
this.tightness = tightness * 0.4f;
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public float getMinU()
|
|
|
|
{
|
|
|
|
return u( 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public float getMaxU()
|
|
|
|
{
|
|
|
|
return u( 16 );
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public float getInterpolatedU(double d0)
|
|
|
|
{
|
|
|
|
return u( d0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public float getMinV()
|
|
|
|
{
|
|
|
|
return v( 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public float getMaxV()
|
|
|
|
{
|
|
|
|
return v( 16 );
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public float getInterpolatedV(double d0)
|
|
|
|
{
|
|
|
|
return v( d0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
private float v(double d)
|
|
|
|
{
|
|
|
|
if ( d < 8 )
|
|
|
|
d -= tightness;
|
|
|
|
if ( d > 8 )
|
|
|
|
d += tightness;
|
|
|
|
return p.getInterpolatedV( Math.min( 16.0, Math.max( 0.0, d ) ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
private float u(double d)
|
|
|
|
{
|
|
|
|
if ( d < 8 )
|
|
|
|
d -= tightness;
|
|
|
|
if ( d > 8 )
|
|
|
|
d += tightness;
|
|
|
|
return p.getInterpolatedU( Math.min( 16.0, Math.max( 0.0, d ) ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public String getIconName()
|
|
|
|
{
|
|
|
|
return p.getIconName();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getIconWidth()
|
|
|
|
{
|
|
|
|
return p.getIconWidth();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getIconHeight()
|
|
|
|
{
|
|
|
|
return p.getIconHeight();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|