package codechicken.lib.vec.uv;

import codechicken.lib.render.CCRenderState;
import codechicken.lib.vec.IrreversibleTransformationException;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;

public class IconTransformation extends UVTransformation {

    public TextureAtlasSprite icon;

    public IconTransformation(TextureAtlasSprite icon) {
        this.icon = icon;
    }

    @Override
    public void operate(CCRenderState state) {
        super.operate(state);
        state.sprite = icon;
    }

    @Override
    public void apply(UV uv) {
        uv.u = icon.getInterpolatedU(uv.u * 16);
        uv.v = icon.getInterpolatedV(uv.v * 16);
    }

    @Override
    public UVTransformation inverse() {
        throw new IrreversibleTransformationException(this);
    }
}

@@ -75,72 +75,8 @@
 te;%0A
-import codechicken.lib.vec.IrreversibleTransformationException;%0A
 impo
@@ -667,59 +667,396 @@
     
-throw new IrreversibleTransformationException(this)
+return new UVTransformation() %7B%0A            @Override%0A            public void apply(UV uv) %7B%0A                uv.u = icon.getUnInterpolatedU((float) uv.u) / 16;%0A                uv.v = icon.getUnInterpolatedV((float) uv.v) / 16;%0A            %7D%0A%0A            @Override%0A            public UVTransformation inverse() %7B%0A                return new IconTransformation(icon);%0A            %7D%0A        %7D
 ;%0A  

Allow IconTransformations to be inverted.