Search in sources :

Example 11 with Vec3dCube

use of uk.co.qmunity.lib.vec.Vec3dCube in project BluePower by Qmunity.

the class PneumaticTube method getOcclusionBoxes.

/**
     * Gets all the occlusion boxes for this block
     *
     * @return A list with the occlusion boxes
     */
@Override
public List<Vec3dCube> getOcclusionBoxes() {
    List<Vec3dCube> aabbs = new ArrayList<Vec3dCube>();
    aabbs.add(new Vec3dCube(0.25, 0.25, 0.25, 0.75, 0.75, 0.75));
    return aabbs;
}
Also used : ArrayList(java.util.ArrayList) Vec3dCube(uk.co.qmunity.lib.vec.Vec3dCube)

Example 12 with Vec3dCube

use of uk.co.qmunity.lib.vec.Vec3dCube in project BluePower by Qmunity.

the class PartCageLamp method renderLamp.

@Override
@SideOnly(Side.CLIENT)
public void renderLamp(RenderHelper renderer) {
    Vec3dCube vector = new Vec3dCube(3 / 16D, 0.0, 3 / 16D, 13 / 16D, 2 / 16D, 13 / 16D);
    IIcon topIcon = IconSupplier.cagedLampFootTop;
    IIcon sideIcon = IconSupplier.cagedLampFootSide;
    renderer.renderBox(vector, topIcon, topIcon, sideIcon, sideIcon, sideIcon, sideIcon);
    vector = new Vec3dCube(4 / 16D, 2 / 16D, 4 / 16D, 12 / 16D, 12 / 16D, 12 / 16D);
    topIcon = IconSupplier.cagedLampCageTop;
    sideIcon = IconSupplier.cagedLampCageSide;
    renderer.setRenderSide(ForgeDirection.DOWN, false);
    for (int i = 0; i < 2; i++) {
        renderer.setRenderFromInside(i == 1);
        renderer.renderBox(vector, topIcon, topIcon, sideIcon, sideIcon, sideIcon, sideIcon);
    }
    renderer.setRenderFromInside(false);
    vector = new Vec3dCube(5 / 16D, 2 / 16D, 5 / 16D, 11 / 16D, 11 / 16D, 11 / 16D);
    if (inverted ? (power & 0xFF) == 255 : power == 0) {
        sideIcon = IconSupplier.cagedLampLampInactive;
        topIcon = IconSupplier.cagedLampLampInactiveTop;
    } else {
        sideIcon = IconSupplier.cagedLampLampActive;
        topIcon = IconSupplier.cagedLampLampActiveTop;
    }
    renderer.setColor(color.getHex());
    renderer.renderBox(vector, topIcon, topIcon, sideIcon, sideIcon, sideIcon, sideIcon);
    renderer.setColor(0xFFFFFF);
}
Also used : IIcon(net.minecraft.util.IIcon) Vec3dCube(uk.co.qmunity.lib.vec.Vec3dCube) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 13 with Vec3dCube

use of uk.co.qmunity.lib.vec.Vec3dCube in project BluePower by Qmunity.

the class PartFixture method renderGlow.

@Override
@SideOnly(Side.CLIENT)
public void renderGlow(int pass) {
    Vec3dCube vector = new Vec3dCube(3 / 16D, 2 / 16D, 3 / 16D, 1.0 - (3 / 16D), 8 / 16D, 13 / 16D).rotate(getFace(), Vec3d.center);
    double r = ((color.getHex() & 0xFF0000) >> 16) / 256D;
    double g = ((color.getHex() & 0x00FF00) >> 8) / 256D;
    double b = (color.getHex() & 0x0000FF) / 256D;
    if (pass == 1) {
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glBegin(GL11.GL_QUADS);
        com.bluepowermod.client.render.RenderHelper.drawColoredCube(vector.clone().expand(0.5 / 16D), r, g, b, ((inverted ? 255 - (power & 0xFF) : (power & 0xFF)) / 256D) * 0.625);
        GL11.glEnd();
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glDisable(GL11.GL_BLEND);
    }
}
Also used : Vec3dCube(uk.co.qmunity.lib.vec.Vec3dCube) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 14 with Vec3dCube

use of uk.co.qmunity.lib.vec.Vec3dCube in project BluePower by Qmunity.

the class MagTube method getSelectionBoxes.

@Override
public List<Vec3dCube> getSelectionBoxes() {
    List<Vec3dCube> aabbs = super.getSelectionBoxes();
    if (!shouldRenderNode()) {
        if (connections[0]) {
            aabbs.add(new Vec3dCube(2 / 16D, 2 / 16D, 2 / 16D, 14 / 16D, 6 / 16D, 14 / 16D));
            aabbs.add(new Vec3dCube(2 / 16D, 10 / 16D, 2 / 16D, 14 / 16D, 14 / 16D, 14 / 16D));
        } else if (connections[2]) {
            aabbs.add(new Vec3dCube(2 / 16D, 2 / 16D, 2 / 16D, 14 / 16D, 14 / 16D, 6 / 16D));
            aabbs.add(new Vec3dCube(2 / 16D, 2 / 16D, 10 / 16D, 14 / 16D, 14 / 16D, 14 / 16D));
        } else if (connections[4]) {
            aabbs.add(new Vec3dCube(2 / 16D, 2 / 16D, 2 / 16D, 6 / 16D, 14 / 16D, 14 / 16D));
            aabbs.add(new Vec3dCube(10 / 16D, 2 / 16D, 2 / 16D, 14 / 16D, 14 / 16D, 14 / 16D));
        }
    }
    return aabbs;
}
Also used : Vec3dCube(uk.co.qmunity.lib.vec.Vec3dCube)

Example 15 with Vec3dCube

use of uk.co.qmunity.lib.vec.Vec3dCube in project BluePower by Qmunity.

the class PartWireFace method renderStatic.

@Override
@SideOnly(Side.CLIENT)
public boolean renderStatic(Vec3i translation, RenderHelper renderer, RenderBlocks renderBlocks, int pass) {
    renderer.setIgnoreLighting(shouldIgnoreLighting());
    renderer.setLightingOverride(getBrightness());
    double height = (getHeight() / 16D) - 0.001;
    double width = getWidth() / 32D;
    int color = getColorMultiplier();
    ForgeDirection d1 = ForgeDirection.NORTH;
    ForgeDirection d2 = ForgeDirection.SOUTH;
    ForgeDirection d3 = ForgeDirection.WEST;
    ForgeDirection d4 = ForgeDirection.EAST;
    if (getFace() == ForgeDirection.NORTH) {
        d1 = ForgeDirection.UP;
        d2 = ForgeDirection.DOWN;
    } else if (getFace() == ForgeDirection.SOUTH) {
        d1 = ForgeDirection.DOWN;
        d2 = ForgeDirection.UP;
    } else if (getFace() == ForgeDirection.WEST) {
        d3 = ForgeDirection.UP;
        d4 = ForgeDirection.DOWN;
    } else if (getFace() == ForgeDirection.EAST) {
        d3 = ForgeDirection.DOWN;
        d4 = ForgeDirection.UP;
    } else if (getFace() == ForgeDirection.UP) {
        d3 = ForgeDirection.EAST;
        d4 = ForgeDirection.WEST;
    }
    switch(getFace()) {
        case DOWN:
            break;
        case UP:
            renderer.addTransformation(new Rotation(180, 180, 0, Vec3d.center));
            break;
        case NORTH:
            renderer.addTransformation(new Rotation(90, 90, 0, Vec3d.center));
            d1 = d1.getRotation(getFace());
            d2 = d2.getRotation(getFace());
            d3 = d3.getRotation(getFace());
            d4 = d4.getRotation(getFace());
            break;
        case SOUTH:
            renderer.addTransformation(new Rotation(-90, 90, 0, Vec3d.center));
            d1 = d1.getRotation(getFace());
            d2 = d2.getRotation(getFace());
            d3 = d3.getRotation(getFace());
            d4 = d4.getRotation(getFace());
            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;
    }
    boolean s1 = shouldRenderConnection(d1);
    boolean s2 = shouldRenderConnection(d2);
    boolean s3 = shouldRenderConnection(d3);
    boolean s4 = shouldRenderConnection(d4);
    renderer.setColor(color);
    // Center
    renderer.renderBox(new Vec3dCube(8 / 16D - width, 0, 8 / 16D - width, 8 / 16D + width, height, 8 / 16D + width), getIcons(ForgeDirection.UNKNOWN));
    // Sides
    if (s4 || s3) {
        if (s3 || (!s3 && s4 && !s1 && !s2))
            renderer.renderBox(new Vec3dCube(s3 ? (extendsToCorner(d3) ? -height : 0) : 4 / 16D, 0, 8 / 16D - width, 8 / 16D - width, height, 8 / 16D + width), getIcons(ForgeDirection.WEST));
        if (s4 || (s3 && !s4 && !s1 && !s2))
            renderer.renderBox(new Vec3dCube(8 / 16D + width, 0, 8 / 16D - width, s4 ? 1 + (extendsToCorner(d4) ? height : 0) : 12 / 16D, height, 8 / 16D + width), getIcons(ForgeDirection.EAST));
        if (s1)
            renderer.renderBox(new Vec3dCube(8 / 16D - width, 0, s1 ? (extendsToCorner(d1) ? -height : 0) : 4 / 16D, 8 / 16D + width, height, 8 / 16D - width), getIcons(ForgeDirection.NORTH));
        if (s2)
            renderer.renderBox(new Vec3dCube(8 / 16D - width, 0, 8 / 16D + width, 8 / 16D + width, height, s2 ? 1 + (extendsToCorner(d2) ? height : 0) : 12 / 16D), getIcons(ForgeDirection.SOUTH));
    } else {
        renderer.renderBox(new Vec3dCube(8 / 16D - width, 0, s1 ? (extendsToCorner(d1) ? -height : 0) : 4 / 16D, 8 / 16D + width, height, 8 / 16D - width), getIcons(ForgeDirection.NORTH));
        renderer.renderBox(new Vec3dCube(8 / 16D - width, 0, 8 / 16D + width, 8 / 16D + width, height, s2 ? 1 + (extendsToCorner(d2) ? height : 0) : 12 / 16D), getIcons(ForgeDirection.SOUTH));
    }
    renderer.setIgnoreLighting(false);
    renderer.setColor(0xFFFFFF);
    return true;
}
Also used : ForgeDirection(net.minecraftforge.common.util.ForgeDirection) Rotation(uk.co.qmunity.lib.transform.Rotation) Vec3dCube(uk.co.qmunity.lib.vec.Vec3dCube) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Aggregations

Vec3dCube (uk.co.qmunity.lib.vec.Vec3dCube)37 SideOnly (cpw.mods.fml.relauncher.SideOnly)13 IIcon (net.minecraft.util.IIcon)11 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)8 ArrayList (java.util.ArrayList)7 Rotation (uk.co.qmunity.lib.transform.Rotation)6 Translation (uk.co.qmunity.lib.transform.Translation)5 TubeColor (com.bluepowermod.api.tube.IPneumaticTube.TubeColor)3 RenderHelper (uk.co.qmunity.lib.client.render.RenderHelper)3 IScrewdriver (com.bluepowermod.api.misc.IScrewdriver)2 BlockLamp (com.bluepowermod.block.machine.BlockLamp)2 ItemPart (com.bluepowermod.item.ItemPart)2 PartRedwireFaceUninsulated (com.bluepowermod.part.wire.redstone.PartRedwireFace.PartRedwireFaceUninsulated)2 ItemStack (net.minecraft.item.ItemStack)2 Vec3d (uk.co.qmunity.lib.vec.Vec3d)2 Vec3i (uk.co.qmunity.lib.vec.Vec3i)2 IGateComponent (com.bluepowermod.api.gate.IGateComponent)1 IIntegratedCircuitPart (com.bluepowermod.api.gate.IIntegratedCircuitPart)1 BPPart (com.bluepowermod.part.BPPart)1 GateComponentQuartzResonator (com.bluepowermod.part.gate.component.GateComponentQuartzResonator)1