001package net.minecraft.client.renderer;
002
003import cpw.mods.fml.relauncher.Side;
004import cpw.mods.fml.relauncher.SideOnly;
005import net.minecraft.util.Icon;
006
007@SideOnly(Side.CLIENT)
008public class IconFlipped implements Icon
009{
010    private final Icon baseIcon;
011    private final boolean flipU;
012    private final boolean flipV;
013
014    public IconFlipped(Icon par1Icon, boolean par2, boolean par3)
015    {
016        this.baseIcon = par1Icon;
017        this.flipU = par2;
018        this.flipV = par3;
019    }
020
021    /**
022     * Returns the X position of this icon on its texture sheet, in pixels.
023     */
024    public int getOriginX()
025    {
026        return this.baseIcon.getOriginX();
027    }
028
029    /**
030     * Returns the Y position of this icon on its texture sheet, in pixels.
031     */
032    public int getOriginY()
033    {
034        return this.baseIcon.getOriginY();
035    }
036
037    /**
038     * Returns the minimum U coordinate to use when rendering with this icon.
039     */
040    public float getMinU()
041    {
042        return this.flipU ? this.baseIcon.getMaxU() : this.baseIcon.getMinU();
043    }
044
045    /**
046     * Returns the maximum U coordinate to use when rendering with this icon.
047     */
048    public float getMaxU()
049    {
050        return this.flipU ? this.baseIcon.getMinU() : this.baseIcon.getMaxU();
051    }
052
053    /**
054     * Gets a U coordinate on the icon. 0 returns uMin and 16 returns uMax. Other arguments return in-between values.
055     */
056    public float getInterpolatedU(double par1)
057    {
058        float f = this.getMaxU() - this.getMinU();
059        return this.getMinU() + f * ((float)par1 / 16.0F);
060    }
061
062    /**
063     * Returns the minimum V coordinate to use when rendering with this icon.
064     */
065    public float getMinV()
066    {
067        return this.flipV ? this.baseIcon.getMinV() : this.baseIcon.getMinV();
068    }
069
070    /**
071     * Returns the maximum V coordinate to use when rendering with this icon.
072     */
073    public float getMaxV()
074    {
075        return this.flipV ? this.baseIcon.getMinV() : this.baseIcon.getMaxV();
076    }
077
078    /**
079     * Gets a V coordinate on the icon. 0 returns vMin and 16 returns vMax. Other arguments return in-between values.
080     */
081    public float getInterpolatedV(double par1)
082    {
083        float f = this.getMaxV() - this.getMinV();
084        return this.getMinV() + f * ((float)par1 / 16.0F);
085    }
086
087    public String getIconName()
088    {
089        return this.baseIcon.getIconName();
090    }
091
092    /**
093     * Returns the width of the texture sheet this icon is on, in pixels.
094     */
095    public int getSheetWidth()
096    {
097        return this.baseIcon.getSheetWidth();
098    }
099
100    /**
101     * Returns the height of the texture sheet this icon is on, in pixels.
102     */
103    public int getSheetHeight()
104    {
105        return this.baseIcon.getSheetHeight();
106    }
107}