public class BakedColourFunctional extends BakedInsn {
    private final INodeDouble a, r, g, b;

    public BakedColourFunctional(INodeDouble a, INodeDouble r, INodeDouble g, INodeDouble b) {
        this.a = a;
        this.r = r;
        this.g = g;
        this.b = b;
    }

    @Override
    public void render() {
        GL11.glColor4d(r.evaluate(), g.evaluate(), b.evaluate(), a.evaluate());
    }
} public class BakedColourFunctionalTogether extends BakedInsn {
    private final INodeLong argb;

    public BakedColourFunctionalTogether(INodeLong argb) {
        this.argb = argb;
    }

    @Override
    public void render() {
        long value = argb.evaluate();
        float a = ((value >> 24) & 0xFF) / 255f;
        float r = ((value >> 16) & 0xFF) / 255f;
        float g = ((value >>  8) & 0xFF) / 255f;
        float b = (value & 0xFF) / 255f;
        GL11.glColor4f(r, g, b, a);
    }
} public class BakedColourSimple extends BakedInsn {
    private final float a, r, g, b;

    public BakedColourSimple(float a, float r, float g, float b) {
        this.a = a;
        this.r = r;
        this.g = g;
        this.b = b;
    }

    @Override
    public void render() {
        GL11.glColor4f(r, g, b, a);
    }
} public abstract class BakedInsn extends BakedTickable {
    public abstract void render();

    @Override
    public void tick(MinecraftDisplayerRenderer renderer) {
        render();
    }
} public class BakedRotationFunctional extends BakedInsn {
    private final INodeDouble angle, x, y, z;

    public BakedRotationFunctional(INodeDouble angle, INodeDouble x, INodeDouble y, INodeDouble z) {
        this.angle = angle;
        this.x = x;
        this.y = y;
        this.z = z;
    }

    @Override
    public void render() {
        double angle = this.angle.evaluate();
        double x = this.x.evaluate();
        double y = this.y.evaluate();
        double z = this.z.evaluate();
        GL11.glRotated(angle, x, y, z);
    }
} public class BakedRotationSimple extends BakedInsn {
    private final double angle, x, y, z;

    public BakedRotationSimple(double angle, double x, double y, double z) {
        this.angle = angle;
        this.x = x;
        this.y = y;
        this.z = z;
    }

    @Override
    public void render() {
        GL11.glRotated(angle, x, y, z);
    }
} public class BakedScaleFunctional extends BakedInsn {
    private final INodeDouble x, y, z;

    public BakedScaleFunctional(INodeDouble x, INodeDouble y, INodeDouble z) {
        this.x = x;
        this.y = y;
        this.z = z;
    }

    @Override
    public void render() {
        GL11.glScaled(x.evaluate(), y.evaluate(), z.evaluate());
    }
} public class BakedScaleSimple extends BakedInsn {
    private final double x, y, z;

    public BakedScaleSimple(double x, double y, double z) {
        this.x = x;
        this.y = y;
        this.z = z;
    }

    @Override
    public void render() {
        GL11.glScaled(x, y, z);
    }
} public class BakedTranslateFunctional extends BakedInsn {
    private final INodeDouble x, y, z;

    public static BakedTranslateFunctional bake(String x, String y, FunctionContext functions) throws InvalidExpressionException {
        INodeDouble expX = GenericExpressionCompiler.compileExpressionDouble(x, functions);
        INodeDouble expY = GenericExpressionCompiler.compileExpressionDouble(y, functions);
        return new BakedTranslateFunctional(expX, expY, NodeConstantDouble.ZERO);
    }

    public BakedTranslateFunctional(INodeDouble x, INodeDouble y, INodeDouble z) {
        this.x = x;
        this.y = y;
        this.z = z;
    }

    @Override
    public void render() {
        GL11.glTranslated(x.evaluate(), y.evaluate(), z.evaluate());
    }
} public class BakedTranslateSimple extends BakedInsn {
    private final double x, y, z;

    public BakedTranslateSimple(double x, double y, double z) {
        this.x = x;
        this.y = y;
        this.z = z;
    }

    @Override
    public void render() {
        GL11.glTranslated(x, y, z);
    }
}
import alexiil.mc.mod.load.baked.insn.BakedColourFunctional;
import alexiil.mc.mod.load.baked.insn.BakedColourFunctionalTogether;
import alexiil.mc.mod.load.baked.insn.BakedColourSimple;
import alexiil.mc.mod.load.baked.insn.BakedInsn;
import alexiil.mc.mod.load.baked.insn.BakedRotationFunctional;
import alexiil.mc.mod.load.baked.insn.BakedRotationSimple;
import alexiil.mc.mod.load.baked.insn.BakedScaleFunctional;
import alexiil.mc.mod.load.baked.insn.BakedScaleSimple;
import alexiil.mc.mod.load.baked.insn.BakedTranslateFunctional;
import alexiil.mc.mod.load.baked.insn.BakedTranslateSimple;
import buildcraft.lib.expression.FunctionContext;
import buildcraft.lib.expression.GenericExpressionCompiler;
import buildcraft.lib.expression.api.IExpressionNode.INodeDouble;
import buildcraft.lib.expression.api.IExpressionNode.INodeLong;
import buildcraft.lib.expression.api.InvalidExpressionException;
import buildcraft.lib.expression.node.value.NodeConstantDouble;
import buildcraft.lib.expression.node.value.NodeConstantLong;
package alexiil.mc.mod.load.json;



public abstract class JsonInsn extends JsonConfigurable<JsonInsn, BakedInsn> {
    public static class JsonInsnRotate extends JsonInsn {
        public final String angle, x, y, z;

        public JsonInsnRotate(String angle, String x, String y, String z) {
            this.angle = angle;
            this.x = x;
            this.y = y;
            this.z = z;
        }

        @Override
        public BakedInsn actuallyBake(FunctionContext functions) throws InvalidExpressionException {
            INodeDouble _a = GenericExpressionCompiler.compileExpressionDouble(angle, functions);
            INodeDouble _x = GenericExpressionCompiler.compileExpressionDouble(x, functions);
            INodeDouble _y = GenericExpressionCompiler.compileExpressionDouble(y, functions);
            INodeDouble _z = GenericExpressionCompiler.compileExpressionDouble(z, functions);
            if (_a instanceof NodeConstantDouble//
                && _x instanceof NodeConstantDouble//
                && _y instanceof NodeConstantDouble//
                && _z instanceof NodeConstantDouble//
            ) {
                return new BakedRotationSimple(_a.evaluate(), _x.evaluate(), _y.evaluate(), _z.evaluate());
            }
            return new BakedRotationFunctional(_a, _x, _y, _z);
        }
    }

    public static class JsonInsnScale extends JsonInsn {
        public final String x, y, z;

        public JsonInsnScale(String x, String y, String z) {
            this.x = x;
            this.y = y;
            this.z = z;
        }

        @Override
        public BakedInsn actuallyBake(FunctionContext functions) throws InvalidExpressionException {
            INodeDouble _x = GenericExpressionCompiler.compileExpressionDouble(x, functions);
            INodeDouble _y = GenericExpressionCompiler.compileExpressionDouble(y, functions);
            INodeDouble _z = GenericExpressionCompiler.compileExpressionDouble(z, functions);
            if (_x instanceof NodeConstantDouble//
                && _y instanceof NodeConstantDouble//
                && _z instanceof NodeConstantDouble//
            ) {
                return new BakedScaleSimple(_x.evaluate(), _y.evaluate(), _z.evaluate());
            }
            return new BakedScaleFunctional(_x, _y, _z);