2015-06-16 02:44:59 +02:00
|
|
|
|
|
|
|
package appeng.client.render;
|
|
|
|
|
2015-12-24 02:03:16 +01:00
|
|
|
|
2015-06-16 02:44:59 +02:00
|
|
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
2015-12-24 02:07:03 +01:00
|
|
|
|
2015-06-16 02:44:59 +02:00
|
|
|
import appeng.client.texture.IAESprite;
|
|
|
|
|
|
|
|
|
|
|
|
public class IconUnwrapper extends TextureAtlasSprite
|
|
|
|
{
|
2015-10-08 15:42:42 +02:00
|
|
|
|
2015-12-24 02:09:38 +01:00
|
|
|
private final int width;
|
|
|
|
private final int height;
|
2015-10-08 15:42:42 +02:00
|
|
|
|
2015-12-24 02:09:38 +01:00
|
|
|
private final float max_u;
|
|
|
|
private final float min_u;
|
|
|
|
private final float min_v;
|
|
|
|
private final float max_v;
|
2015-10-08 15:42:42 +02:00
|
|
|
|
2016-01-01 02:02:05 +01:00
|
|
|
protected IconUnwrapper( final IAESprite src )
|
2015-06-16 02:44:59 +02:00
|
|
|
{
|
|
|
|
super( src.getIconName() );
|
2015-09-30 14:26:54 +02:00
|
|
|
this.width = src.getIconWidth();
|
|
|
|
this.height = src.getIconHeight();
|
|
|
|
this.min_u = src.getMinU();
|
|
|
|
this.max_u = src.getMaxU();
|
|
|
|
this.min_v = src.getMinV();
|
|
|
|
this.max_v = src.getMaxV();
|
2015-06-16 02:44:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getIconWidth()
|
|
|
|
{
|
2015-09-30 14:26:54 +02:00
|
|
|
return this.width;
|
2015-06-16 02:44:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getIconHeight()
|
|
|
|
{
|
2015-09-30 14:26:54 +02:00
|
|
|
return this.height;
|
2015-06-16 02:44:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public float getMaxU()
|
|
|
|
{
|
2015-09-30 14:26:54 +02:00
|
|
|
return this.max_u;
|
2015-06-16 02:44:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public float getMinV()
|
|
|
|
{
|
2015-09-30 14:26:54 +02:00
|
|
|
return this.min_v;
|
2015-06-16 02:44:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public float getMaxV()
|
|
|
|
{
|
2015-09-30 14:26:54 +02:00
|
|
|
return this.max_v;
|
2015-06-16 02:44:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getIconName()
|
|
|
|
{
|
|
|
|
return super.getIconName();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public float getMinU()
|
|
|
|
{
|
2015-09-30 14:26:54 +02:00
|
|
|
return this.min_u;
|
2015-06-16 02:44:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-12-24 02:03:16 +01:00
|
|
|
public float getInterpolatedU( final double d )
|
|
|
|
{
|
|
|
|
final float f = this.max_u - this.min_u;
|
|
|
|
return this.min_u + f * (float) d / 16.0F;
|
|
|
|
}
|
2015-06-16 02:44:59 +02:00
|
|
|
|
|
|
|
@Override
|
2015-12-24 02:03:16 +01:00
|
|
|
public float getInterpolatedV( final double d )
|
|
|
|
{
|
|
|
|
final float f = this.max_v - this.min_v;
|
|
|
|
return this.min_v + f * ( (float) d / 16.0F );
|
|
|
|
}
|
2015-06-16 02:44:59 +02:00
|
|
|
|
|
|
|
}
|