Search in sources :

Example 1 with Translation

use of uk.co.qmunity.lib.transform.Translation in project BluePower by Qmunity.

the class GateComponentSolarPanel method renderStatic.

@Override
public void renderStatic(Vec3i translation, RenderHelper renderer, int pass) {
    renderer.addTransformation(new Translation(-3 / 16D + x, 0, -4 / 16D + z));
    renderer.renderBox(new Vec3dCube(3 / 16D, 2 / 16D, 4 / 16D, 13 / 16D, 4 / 16D, 12 / 16D), null, IconSupplier.gateSolarPanel, IconSupplier.gateButton, IconSupplier.gateButton, IconSupplier.gateButton, IconSupplier.gateButton);
    renderer.removeTransformation();
}
Also used : Translation(uk.co.qmunity.lib.transform.Translation) Vec3dCube(uk.co.qmunity.lib.vec.Vec3dCube)

Example 2 with Translation

use of uk.co.qmunity.lib.transform.Translation in project BluePower by Qmunity.

the class GateComponentTorch method renderStatic.

@Override
public void renderStatic(Vec3i translation, RenderHelper renderer, int pass) {
    IIcon icon = digital ? (state ? IconSupplier.bluestoneTorchOn : IconSupplier.bluestoneTorchOff) : (state ? Blocks.redstone_torch.getIcon(0, 0) : Blocks.unlit_redstone_torch.getIcon(0, 0));
    IIcon override = renderer.getOverrideTexture();
    renderer.setOverrideTexture(null);
    double height = 10 / 16D - this.height;
    renderer.addTransformation(new Translation(x - 7 / 16D, 2 / 16D - height, z - 7 / 16D));
    renderer.setRenderSides(false, false, false, false, true, true);
    renderer.renderBox(new Vec3dCube(0, height, 7 / 16D, 1, 1, 9 / 16D), icon);
    renderer.setRenderSides(false, false, true, true, false, false);
    renderer.renderBox(new Vec3dCube(7 / 16D, height, 0, 9 / 16D, 1, 1), icon);
    renderer.addTransformation(new Translation(0, 0, 1 / 16D));
    renderer.setRenderSides(false, true, false, false, false, false);
    renderer.renderBox(new Vec3dCube(7 / 16D, 10 / 16D, 6 / 16D, 9 / 16D, 10 / 16D, 8 / 16D), icon);
    renderer.resetRenderedSides();
    renderer.removeTransformations(2);
    renderer.setOverrideTexture(override);
}
Also used : Translation(uk.co.qmunity.lib.transform.Translation) IIcon(net.minecraft.util.IIcon) Vec3dCube(uk.co.qmunity.lib.vec.Vec3dCube)

Example 3 with Translation

use of uk.co.qmunity.lib.transform.Translation in project BluePower by Qmunity.

the class GateIntegratedCircuit method renderStatic.

// Rendering
@Override
@SideOnly(Side.CLIENT)
public boolean renderStatic(Vec3i translation, RenderHelper renderer, RenderBlocks renderBlocks, int pass) {
    switch(getFace()) {
        case DOWN:
            break;
        case UP:
            renderer.addTransformation(new Rotation(180, 180, 0, Vec3d.center));
            break;
        case NORTH:
            renderer.addTransformation(new Rotation(90, 0, 0, Vec3d.center));
            break;
        case SOUTH:
            renderer.addTransformation(new Rotation(-90, 0, 0, Vec3d.center));
            break;
        case WEST:
            renderer.addTransformation(new Rotation(0, 0, -90, Vec3d.center));
            break;
        case EAST:
            renderer.addTransformation(new Rotation(0, 0, 90, Vec3d.center));
            break;
        default:
            break;
    }
    int rotation = getRotation();
    if (rotation != -1)
        renderer.addTransformation(new Rotation(0, 90 * -rotation, 0));
    IIcon[] icons = new IIcon[] { getIcon(ForgeDirection.DOWN), getIcon(ForgeDirection.UP), getIcon(ForgeDirection.WEST), getIcon(ForgeDirection.EAST), getIcon(ForgeDirection.NORTH), getIcon(ForgeDirection.SOUTH) };
    renderer.renderBox(new Vec3dCube(0, 0, 0, 1, 1 / 16D, 1), icons);
    renderer.renderBox(new Vec3dCube(0, 1 / 16D, 0, 1, 2 / 16D, 1 / 16D), icons);
    renderer.renderBox(new Vec3dCube(0, 1 / 16D, 15 / 16D, 1, 2 / 16D, 1), icons);
    renderer.renderBox(new Vec3dCube(0, 1 / 16D, 0, 1 / 16D, 2 / 16D, 1), icons);
    renderer.renderBox(new Vec3dCube(15 / 16D, 1 / 16D, 0, 1, 2 / 16D, 1), icons);
    for (IGateComponent c : getComponents()) c.renderStatic(translation, renderer, pass);
    double scale = (1 - border * 2D) / getSize();
    renderer.addTransformation(new Scale(scale, scale, scale));
    for (int x = 0; x < getSize(); x++) {
        for (int z = 0; z < getSize(); z++) {
            IIntegratedCircuitPart part = getPart(x, z);
            if (part == null)
                continue;
            int s = getSize();
            if (s % 2 == 1)
                s -= 1;
            double a = (getSize() - 1) / 2D;
            renderer.addTransformation(new Translation(-(s - x - a), -a, -(s - z - a)));
            part.renderStatic(translation, renderer, renderBlocks, pass);
            renderer.addTransformation(new Translation(s - x - a, a, s - z - a));
        }
    }
    renderer.removeTransformation();
    return true;
}
Also used : Translation(uk.co.qmunity.lib.transform.Translation) IIcon(net.minecraft.util.IIcon) IGateComponent(com.bluepowermod.api.gate.IGateComponent) IIntegratedCircuitPart(com.bluepowermod.api.gate.IIntegratedCircuitPart) Scale(uk.co.qmunity.lib.transform.Scale) Rotation(uk.co.qmunity.lib.transform.Rotation) Vec3dCube(uk.co.qmunity.lib.vec.Vec3dCube) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 4 with Translation

use of uk.co.qmunity.lib.transform.Translation in project BluePower by Qmunity.

the class RenderCircuitTile method renderItem.

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    boolean blend = GL11.glGetBoolean(GL11.GL_BLEND);
    boolean alpha = GL11.glGetBoolean(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glPushMatrix();
    {
        switch(type) {
            case ENTITY:
                GL11.glTranslated(-0.5, 0, -0.5);
                break;
            case EQUIPPED:
                GL11.glTranslated(-0.375, 0.5, -0.125);
                GL11.glScaled(1.5, 1.5, 1.5);
                break;
            case EQUIPPED_FIRST_PERSON:
                GL11.glTranslated(-0.375, 0.75, -0.125);
                GL11.glScaled(1.5, 1.5, 1.5);
                break;
            case INVENTORY:
                GL11.glTranslated(0, 0.4, 0);
                GL11.glScaled(1.75, 1.75, 1.75);
                break;
            default:
                break;
        }
        Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
        Tessellator.instance.startDrawingQuads();
        RenderHelper rh = RenderHelper.instance;
        rh.renderBox(new Vec3dCube(4 / 16D, 0, 4 / 16D, 12 / 16D, 2 / 16D, 12 / 16D), Blocks.stone_slab.getIcon(0, 0));
        rh.reset();
        Tessellator.instance.draw();
        double wireHeight = 1 / 32D;
        double wireWidth = 1.5 / 16D;
        double bundledHeight = 4 / 32D;
        double bundledWidth = 6 / 16D;
        IIcon wireTexture = IconSupplier.wire;
        // Bluestone tiles
        rh.setColor(WireHelper.getColorForPowerLevel(RedwireType.BLUESTONE, (byte) (255 / 2)));
        if (item.getItem() == BPItems.bluestone_cathode_tile) {
            com.bluepowermod.client.render.RenderHelper.renderDigitalRedstoneTorch(0, 0, 0, 13 / 16D, true);
            Tessellator.instance.startDrawingQuads();
            rh.renderBox(new Vec3dCube(0.5 - (wireWidth / 2), 2 / 16D, 4 / 16D, 0.5 + (wireWidth / 2), 2 / 16D + wireHeight, 7 / 16D), wireTexture);
            Tessellator.instance.draw();
        }
        if (item.getItem() == BPItems.bluestone_pointer_tile) {
            com.bluepowermod.client.render.RenderHelper.renderDigitalRedstoneTorch(0, 0, 0, 13 / 16D, true);
            GL11.glPushMatrix();
            GL11.glTranslated(0.5, 0, 0.5);
            GL11.glScaled(0.875, 1, 0.875);
            GL11.glTranslated(-0.5, 0, -0.5);
            com.bluepowermod.client.render.RenderHelper.renderPointer(0, 3 / 16D, 0, 0.25);
            GL11.glPopMatrix();
            Tessellator.instance.startDrawingQuads();
            rh.renderBox(new Vec3dCube(0.5 - (wireWidth / 2), 2 / 16D, 4 / 16D, 0.5 + (wireWidth / 2), 2 / 16D + wireHeight, 7 / 16D), wireTexture);
            Tessellator.instance.draw();
        }
        if (item.getItem() == BPItems.bluestone_anode_tile) {
            Tessellator.instance.startDrawingQuads();
            rh.renderBox(new Vec3dCube(0.5 - (wireWidth / 2), 2 / 16D, 4 / 16D, 0.5 + (wireWidth / 2), 2 / 16D + wireHeight, 7.5 / 16D), wireTexture);
            rh.renderBox(new Vec3dCube(4 / 16D, 2 / 16D, 0.5 - (wireWidth / 2), 12 / 16D, 2 / 16D + wireHeight, 0.5 + (wireWidth / 2)), wireTexture);
            Tessellator.instance.draw();
        }
        if (item.getItem() == BPItems.bluestone_wire_tile) {
            Tessellator.instance.startDrawingQuads();
            rh.renderBox(new Vec3dCube(0.5 - (wireWidth / 2), 2 / 16D, 4 / 16D, 0.5 + (wireWidth / 2), 2 / 16D + wireHeight, 12 / 16D), wireTexture);
            Tessellator.instance.draw();
        }
        // Redstone tiles
        rh.setColor(WireHelper.getColorForPowerLevel(RedwireType.RED_ALLOY, (byte) (255 / 2)));
        if (item.getItem() == BPItems.redstone_cathode_tile) {
            com.bluepowermod.client.render.RenderHelper.renderAnalogRedstoneTorch(0, 0, 0, 13 / 16D, true);
            Tessellator.instance.startDrawingQuads();
            rh.renderBox(new Vec3dCube(0.5 - (wireWidth / 2), 2 / 16D, 4 / 16D, 0.5 + (wireWidth / 2), 2 / 16D + wireHeight, 7 / 16D), wireTexture);
            Tessellator.instance.draw();
        }
        if (item.getItem() == BPItems.redstone_pointer_tile) {
            com.bluepowermod.client.render.RenderHelper.renderAnalogRedstoneTorch(0, 0, 0, 13 / 16D, true);
            GL11.glPushMatrix();
            GL11.glTranslated(0.5, 0, 0.5);
            GL11.glScaled(0.875, 1, 0.875);
            GL11.glTranslated(-0.5, 0, -0.5);
            com.bluepowermod.client.render.RenderHelper.renderPointer(0, 3 / 16D, 0, 0.25);
            GL11.glPopMatrix();
            Tessellator.instance.startDrawingQuads();
            rh.renderBox(new Vec3dCube(0.5 - (wireWidth / 2), 2 / 16D, 4 / 16D, 0.5 + (wireWidth / 2), 2 / 16D + wireHeight, 7 / 16D), wireTexture);
            Tessellator.instance.draw();
        }
        if (item.getItem() == BPItems.redstone_anode_tile) {
            Tessellator.instance.startDrawingQuads();
            rh.renderBox(new Vec3dCube(0.5 - (wireWidth / 2), 2 / 16D, 4 / 16D, 0.5 + (wireWidth / 2), 2 / 16D + wireHeight, 7.5 / 16D), wireTexture);
            rh.renderBox(new Vec3dCube(4 / 16D, 2 / 16D, 0.5 - (wireWidth / 2), 12 / 16D, 2 / 16D + wireHeight, 0.5 + (wireWidth / 2)), wireTexture);
            Tessellator.instance.draw();
        }
        if (item.getItem() == BPItems.redstone_wire_tile) {
            Tessellator.instance.startDrawingQuads();
            rh.renderBox(new Vec3dCube(0.5 - (wireWidth / 2), 2 / 16D, 4 / 16D, 0.5 + (wireWidth / 2), 2 / 16D + wireHeight, 12 / 16D), wireTexture);
            Tessellator.instance.draw();
        }
        rh.setColor(0xFFFFFF);
        if (item.getItem() == BPItems.stone_bundle) {
            GL11.glPushMatrix();
            {
                GL11.glTranslated(0.5, 0, 0.5);
                GL11.glScaled(0.5, 0.5, 0.5);
                GL11.glTranslated(-0.5, 0.125, -0.5);
                Tessellator.instance.startDrawingQuads();
                rh.renderBox(new Vec3dCube(0.5 - (bundledWidth / 2), 2 / 16D, 0, 0.5 + (bundledWidth / 2), 2 / 16D + bundledHeight, 1), null, IconSupplier.wireBundledStraight1, IconSupplier.wireBundledSide1, IconSupplier.wireBundledSide2, IconSupplier.wireBundledConnection, IconSupplier.wireBundledConnection);
                Tessellator.instance.draw();
            }
            GL11.glPopMatrix();
        }
        // Misc renderers
        rh.setColor(0xFFFFFF);
        rh.addTransformation(new Translation(0.375, 0, 0.375));
        Tessellator.instance.startDrawingQuads();
        if (item.getItem() == BPItems.quartz_resonator_tile) {
            new GateComponentQuartzResonator(null, -1).renderStatic(new Vec3i(0, 0, 0), rh, 0);
        }
        if (item.getItem() == BPItems.silicon_chip_tile) {
            new GateComponentSiliconChip(null, -1).setState(true).renderStatic(new Vec3i(0, 0, 0), rh, 0);
        }
        if (item.getItem() == BPItems.tainted_silicon_chip_tile) {
            new GateComponentTaintedSiliconChip(null, -1).setState(true).renderStatic(new Vec3i(0, 0, 0), rh, 0);
        }
        Tessellator.instance.draw();
        rh.reset();
    }
    GL11.glPopMatrix();
    if (!blend)
        GL11.glDisable(GL11.GL_BLEND);
    if (!alpha)
        GL11.glDisable(GL11.GL_ALPHA_TEST);
}
Also used : Vec3i(uk.co.qmunity.lib.vec.Vec3i) GateComponentSiliconChip(com.bluepowermod.part.gate.component.GateComponentSiliconChip) Translation(uk.co.qmunity.lib.transform.Translation) RenderHelper(uk.co.qmunity.lib.client.render.RenderHelper) IIcon(net.minecraft.util.IIcon) GateComponentTaintedSiliconChip(com.bluepowermod.part.gate.component.GateComponentTaintedSiliconChip) GateComponentQuartzResonator(com.bluepowermod.part.gate.component.GateComponentQuartzResonator) Vec3dCube(uk.co.qmunity.lib.vec.Vec3dCube)

Example 5 with Translation

use of uk.co.qmunity.lib.transform.Translation in project BluePower by Qmunity.

the class GateComponentLever method renderStatic.

@Override
public void renderStatic(Vec3i translation, RenderHelper renderer, int pass) {
    renderer.addTransformation(new Translation(x, 0, z));
    renderer.renderBox(new Vec3dCube(0, 2 / 16D, 0, 4 / 16D, 4 / 16D, 7 / 16D), Blocks.cobblestone.getIcon(0, 0));
    renderer.removeTransformation();
}
Also used : Translation(uk.co.qmunity.lib.transform.Translation) Vec3dCube(uk.co.qmunity.lib.vec.Vec3dCube)

Aggregations

Translation (uk.co.qmunity.lib.transform.Translation)5 Vec3dCube (uk.co.qmunity.lib.vec.Vec3dCube)5 IIcon (net.minecraft.util.IIcon)3 IGateComponent (com.bluepowermod.api.gate.IGateComponent)1 IIntegratedCircuitPart (com.bluepowermod.api.gate.IIntegratedCircuitPart)1 GateComponentQuartzResonator (com.bluepowermod.part.gate.component.GateComponentQuartzResonator)1 GateComponentSiliconChip (com.bluepowermod.part.gate.component.GateComponentSiliconChip)1 GateComponentTaintedSiliconChip (com.bluepowermod.part.gate.component.GateComponentTaintedSiliconChip)1 SideOnly (cpw.mods.fml.relauncher.SideOnly)1 RenderHelper (uk.co.qmunity.lib.client.render.RenderHelper)1 Rotation (uk.co.qmunity.lib.transform.Rotation)1 Scale (uk.co.qmunity.lib.transform.Scale)1 Vec3i (uk.co.qmunity.lib.vec.Vec3i)1