Search in sources :

Example 31 with Vec3dCube

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

the class GateNullCell method addBoxes.

// Collision/selection boxes
@Override
protected void addBoxes(List<Vec3dCube> boxes) {
    super.addBoxes(boxes);
    double height = 2 / 16D;
    if (typeA != null) {
        boxes.add(new Vec3dCube(7 / 16D, 2 / 16D, 1 / 16D, 9 / 16D, 2 / 16D + height, 15 / 16D));
        boxes.add(new Vec3dCube(7 / 16D, 2 / 16D, 0 / 16D, 9 / 16D, 2 / 16D + (height / 2), 1 / 16D));
        boxes.add(new Vec3dCube(7 / 16D, 2 / 16D, 15 / 16D, 9 / 16D, 2 / 16D + (height / 2), 16 / 16D));
    }
    if (typeB != null) {
        boxes.add(new Vec3dCube(0 / 16D, 2 / 16D, 7 / 16D, 2 / 16D, 12 / 16D, 9 / 16D));
        boxes.add(new Vec3dCube(14 / 16D, 2 / 16D, 7 / 16D, 16 / 16D, 12 / 16D, 9 / 16D));
        boxes.add(new Vec3dCube(2 / 16D, 10 / 16D, 7 / 16D, 14 / 16D, 12 / 16D, 9 / 16D));
    }
}
Also used : Vec3dCube(uk.co.qmunity.lib.vec.Vec3dCube)

Example 32 with Vec3dCube

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

the class PartRedwireFreestanding method getOcclusionBoxes.

@Override
public List<Vec3dCube> getOcclusionBoxes() {
    List<Vec3dCube> boxes = new ArrayList<Vec3dCube>();
    double size = 8 / 16D;
    boxes.add(new Vec3dCube(0.5 - (size / 2), 0.5 - (size / 2), 0.5 - (size / 2), 0.5 + (size / 2), 0.5 + (size / 2), 0.5 + (size / 2)));
    return boxes;
}
Also used : ArrayList(java.util.ArrayList) Vec3dCube(uk.co.qmunity.lib.vec.Vec3dCube)

Example 33 with Vec3dCube

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

the class PartRedwireFreestanding method getSelectionBoxes.

// Selection and occlusion boxes
@Override
public List<Vec3dCube> getSelectionBoxes() {
    List<Vec3dCube> boxes = new ArrayList<Vec3dCube>();
    double size = 8 / 16D;
    boxes.add(new Vec3dCube(0.5 - (size / 2), 0.5 - (size / 2), 0.5 - (size / 2), 0.5 + (size / 2), 0.5 + (size / 2), 0.5 + (size / 2)));
    if (getParent() == null || getWorld() == null)
        return boxes;
    Vec3dCube box = new Vec3dCube(0.5 - (size / 2), 0, 0.5 - (size / 2), 0.5 + (size / 2), 0.5 - (size / 2), 0.5 + (size / 2));
    for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
        if (isConnected(d) || shouldRenderConnection(d))
            boxes.add(box.clone().rotate(d, Vec3d.center));
    }
    return boxes;
}
Also used : ArrayList(java.util.ArrayList) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) Vec3dCube(uk.co.qmunity.lib.vec.Vec3dCube)

Example 34 with Vec3dCube

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

the class TubeStack method render.

@SideOnly(Side.CLIENT)
public void render(float partialTick) {
    if (renderMode == RenderMode.AUTO) {
        renderMode = Minecraft.getMinecraft().gameSettings.fancyGraphics ? RenderMode.NORMAL : RenderMode.REDUCED;
    }
    final RenderMode finalRenderMode = renderMode;
    if (customRenderItem == null) {
        customRenderItem = new RenderItem() {

            @Override
            public boolean shouldBob() {
                return false;
            }

            ;

            @Override
            public byte getMiniBlockCount(ItemStack stack, byte original) {
                return finalRenderMode == RenderMode.REDUCED ? (byte) 1 : original;
            }
        };
        customRenderItem.setRenderManager(RenderManager.instance);
        renderedItem = new EntityItem(FMLClientHandler.instance().getWorldClient());
        renderedItem.hoverStart = 0.0F;
    }
    renderedItem.setEntityItemStack(stack);
    double renderProgress = (oldProgress + (progress - oldProgress) * partialTick) * 2 - 1;
    GL11.glPushMatrix();
    GL11.glTranslated(heading.offsetX * renderProgress * 0.5, heading.offsetY * renderProgress * 0.5, heading.offsetZ * renderProgress * 0.5);
    if (finalRenderMode != RenderMode.NONE) {
        GL11.glPushMatrix();
        if (stack.stackSize > 5) {
            GL11.glScaled(0.8, 0.8, 0.8);
        }
        if (!(stack.getItem() instanceof ItemBlock)) {
            GL11.glScaled(0.8, 0.8, 0.8);
            GL11.glTranslated(0, -0.15, 0);
        }
        customRenderItem.doRender(renderedItem, 0, 0, 0, 0, 0);
        GL11.glPopMatrix();
    } else {
        float size = 0.02F;
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glBegin(GL11.GL_QUADS);
        RenderHelper.drawColoredCube(new Vec3dCube(-size, -size, -size, size, size, size), 1, 1, 1, 1);
        GL11.glEnd();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
    }
    if (color != TubeColor.NONE) {
        float size = 0.2F;
        int colorInt = ItemDye.field_150922_c[color.ordinal()];
        float red = (colorInt >> 16) / 256F;
        float green = (colorInt >> 8 & 255) / 256F;
        float blue = (colorInt & 255) / 256F;
        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glColor3f(red, green, blue);
        Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(Refs.MODID, "textures/blocks/tubes/inside_color_border.png"));
        RenderHelper.drawTesselatedTexturedCube(new Vec3dCube(-size, -size, -size, size, size, size));
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_LIGHTING);
    }
    GL11.glPopMatrix();
}
Also used : RenderItem(net.minecraft.client.renderer.entity.RenderItem) ResourceLocation(net.minecraft.util.ResourceLocation) ItemStack(net.minecraft.item.ItemStack) ItemBlock(net.minecraft.item.ItemBlock) EntityItem(net.minecraft.entity.item.EntityItem) Vec3dCube(uk.co.qmunity.lib.vec.Vec3dCube) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 35 with Vec3dCube

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

the class PartWireFreestanding method getFrameBoxes.

protected List<Vec3dCube> getFrameBoxes(double wireSize, double frameSeparation, double frameThickness, boolean down, boolean up, boolean west, boolean east, boolean north, boolean south, boolean sideDown, boolean sideUp, boolean sideWest, boolean sideEast, boolean sideNorth, boolean sideSouth, boolean isInWorld) {
    List<Vec3dCube> boxes = new ArrayList<Vec3dCube>();
    // Top
    if (west == up || !isInWorld)
        boxes.add(new Vec3dCube(0.5 - ((wireSize + frameSeparation) / 2) - frameThickness, 0.5 + ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2) + frameThickness, 0.5 + ((wireSize + frameSeparation) / 2)));
    if (east == up || !isInWorld)
        boxes.add(new Vec3dCube(0.5 + ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2) + frameThickness, 0.5 + ((wireSize + frameSeparation) / 2) + frameThickness, 0.5 + ((wireSize + frameSeparation) / 2)));
    if (south == up || !isInWorld)
        boxes.add(new Vec3dCube(0.5 + ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2) + frameThickness, 0.5 + ((wireSize + frameSeparation) / 2) + frameThickness));
    if (north == up || !isInWorld)
        boxes.add(new Vec3dCube(0.5 + ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2) - frameThickness, 0.5 - ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2) + frameThickness, 0.5 - ((wireSize + frameSeparation) / 2)));
    // Bottom
    if (west == down || !isInWorld)
        boxes.add(new Vec3dCube(0.5 - ((wireSize + frameSeparation) / 2) - frameThickness, 0.5 - ((wireSize + frameSeparation) / 2) - frameThickness, 0.5 - ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2)));
    if (east == down || !isInWorld)
        boxes.add(new Vec3dCube(0.5 + ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2) - frameThickness, 0.5 - ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2) + frameThickness, 0.5 - ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2)));
    if (south == down || !isInWorld)
        boxes.add(new Vec3dCube(0.5 + ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2) - frameThickness, 0.5 + ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2) + frameThickness));
    if (north == down || !isInWorld)
        boxes.add(new Vec3dCube(0.5 + ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2) - frameThickness, 0.5 - ((wireSize + frameSeparation) / 2) - frameThickness, 0.5 - ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2)));
    // Sides
    if (north == west || !isInWorld)
        boxes.add(new Vec3dCube(0.5 - ((wireSize + frameSeparation) / 2) - frameThickness, 0.5 - ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2) - frameThickness, 0.5 - ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2)));
    if (south == west || !isInWorld)
        boxes.add(new Vec3dCube(0.5 - ((wireSize + frameSeparation) / 2) - frameThickness, 0.5 - ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2) + frameThickness));
    if (north == east || !isInWorld)
        boxes.add(new Vec3dCube(0.5 + ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2) - frameThickness, 0.5 + ((wireSize + frameSeparation) / 2) + frameThickness, 0.5 + ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2)));
    if (south == east || !isInWorld)
        boxes.add(new Vec3dCube(0.5 + ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2) + frameThickness, 0.5 + ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2) + frameThickness));
    // Corners
    boxes.add(new Vec3dCube(0.5 - ((wireSize + frameSeparation) / 2) - frameThickness, 0.5 + ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2) - frameThickness, 0.5 - ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2) + frameThickness, 0.5 - ((wireSize + frameSeparation) / 2)));
    boxes.add(new Vec3dCube(0.5 - ((wireSize + frameSeparation) / 2) - frameThickness, 0.5 + ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2) + frameThickness, 0.5 + ((wireSize + frameSeparation) / 2) + frameThickness));
    boxes.add(new Vec3dCube(0.5 + ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2) - frameThickness, 0.5 + ((wireSize + frameSeparation) / 2) + frameThickness, 0.5 + ((wireSize + frameSeparation) / 2) + frameThickness, 0.5 - ((wireSize + frameSeparation) / 2)));
    boxes.add(new Vec3dCube(0.5 + ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2) + frameThickness, 0.5 + ((wireSize + frameSeparation) / 2) + frameThickness, 0.5 + ((wireSize + frameSeparation) / 2) + frameThickness));
    boxes.add(new Vec3dCube(0.5 - ((wireSize + frameSeparation) / 2) - frameThickness, 0.5 - ((wireSize + frameSeparation) / 2) - frameThickness, 0.5 - ((wireSize + frameSeparation) / 2) - frameThickness, 0.5 - ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2)));
    boxes.add(new Vec3dCube(0.5 - ((wireSize + frameSeparation) / 2) - frameThickness, 0.5 - ((wireSize + frameSeparation) / 2) - frameThickness, 0.5 + ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2) + frameThickness));
    boxes.add(new Vec3dCube(0.5 + ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2) - frameThickness, 0.5 - ((wireSize + frameSeparation) / 2) - frameThickness, 0.5 + ((wireSize + frameSeparation) / 2) + frameThickness, 0.5 - ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2)));
    boxes.add(new Vec3dCube(0.5 + ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2) - frameThickness, 0.5 + ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2) + frameThickness, 0.5 - ((wireSize + frameSeparation) / 2), 0.5 + ((wireSize + frameSeparation) / 2) + frameThickness));
    if (isInWorld) {
        // Connections
        Vec3dCube box = new Vec3dCube(0.5 - ((wireSize + frameSeparation) / 2) - frameThickness, 0, 0.5 - ((wireSize + frameSeparation) / 2) - frameThickness, 0.5 - ((wireSize + frameSeparation) / 2), 0.5 - ((wireSize + frameSeparation) / 2) - frameThickness, 0.5 - ((wireSize + frameSeparation) / 2));
        if (sideDown)
            for (int i = 0; i < 4; i++) boxes.add(box.clone().rotate(0, 90 * i, 0, Vec3d.center).rotate(ForgeDirection.DOWN, Vec3d.center));
        if (sideUp)
            for (int i = 0; i < 4; i++) boxes.add(box.clone().rotate(0, 90 * i, 0, Vec3d.center).rotate(ForgeDirection.UP, Vec3d.center));
        if (sideWest)
            for (int i = 0; i < 4; i++) boxes.add(box.clone().rotate(0, 90 * i, 0, Vec3d.center).rotate(ForgeDirection.WEST, Vec3d.center));
        if (sideEast)
            for (int i = 0; i < 4; i++) boxes.add(box.clone().rotate(0, 90 * i, 0, Vec3d.center).rotate(ForgeDirection.EAST, Vec3d.center));
        if (sideNorth)
            for (int i = 0; i < 4; i++) boxes.add(box.clone().rotate(0, 90 * i, 0, Vec3d.center).rotate(ForgeDirection.NORTH, Vec3d.center));
        if (sideSouth)
            for (int i = 0; i < 4; i++) boxes.add(box.clone().rotate(0, 90 * i, 0, Vec3d.center).rotate(ForgeDirection.SOUTH, Vec3d.center));
    }
    return boxes;
}
Also used : ArrayList(java.util.ArrayList) Vec3dCube(uk.co.qmunity.lib.vec.Vec3dCube)

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