Search in sources :

Example 11 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project BluePower by Qmunity.

the class GateSupported method renderStatic.

// Redwire connectivity
// Rendering
@Override
@SideOnly(Side.CLIENT)
public boolean renderStatic(Vec3i translation, RenderHelper renderer, RenderBlocks renderBlocks, int pass) {
    super.renderStatic(translation, renderer, renderBlocks, pass);
    IIcon planks = Blocks.planks.getIcon(0, 0);
    renderer.renderBox(new Vec3dCube(2 / 16D, 2 / 16D, 2 / 16D, 3 / 16D, 10 / 16D, 3 / 16D), planks);
    renderer.renderBox(new Vec3dCube(2 / 16D, 2 / 16D, 13 / 16D, 3 / 16D, 10 / 16D, 14 / 16D), planks);
    renderer.renderBox(new Vec3dCube(2 / 16D, 9 / 16D, 3 / 16D, 3 / 16D, 10 / 16D, 13 / 16D), planks);
    renderer.renderBox(new Vec3dCube(13 / 16D, 2 / 16D, 2 / 16D, 14 / 16D, 10 / 16D, 3 / 16D), planks);
    renderer.renderBox(new Vec3dCube(13 / 16D, 2 / 16D, 13 / 16D, 14 / 16D, 10 / 16D, 14 / 16D), planks);
    renderer.renderBox(new Vec3dCube(13 / 16D, 9 / 16D, 3 / 16D, 14 / 16D, 10 / 16D, 13 / 16D), planks);
    renderer.setColor(0xFFFFFF);
    return true;
}
Also used : IIcon(net.minecraft.util.IIcon) Vec3dCube(uk.co.qmunity.lib.vec.Vec3dCube) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 12 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly 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 SideOnly

use of cpw.mods.fml.relauncher.SideOnly 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 SideOnly

use of cpw.mods.fml.relauncher.SideOnly 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)

Example 15 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project BluePower by Qmunity.

the class PartWireFreestanding method renderStatic.

@Override
@SideOnly(Side.CLIENT)
public boolean renderStatic(Vec3i translation, RenderHelper renderer, RenderBlocks renderBlocks, int pass) {
    double wireSize = getSize() / 16D;
    double frameSeparation = 4 / 16D - (wireSize - 2 / 16D);
    double frameThickness = 1 / 16D;
    int color = getColorMultiplier();
    boolean isInWorld = getParent() != null;
    boolean down = shouldRenderConnection(ForgeDirection.DOWN);
    boolean up = shouldRenderConnection(ForgeDirection.UP);
    boolean north = shouldRenderConnection(ForgeDirection.NORTH);
    boolean south = shouldRenderConnection(ForgeDirection.SOUTH);
    boolean west = shouldRenderConnection(ForgeDirection.WEST);
    boolean east = shouldRenderConnection(ForgeDirection.EAST);
    renderer.setColor(color);
    // Wire
    renderer.renderBox(new Vec3dCube(0.5 - (wireSize / 2), 0.5 - (wireSize / 2), 0.5 - (wireSize / 2), 0.5 + (wireSize / 2), 0.5 + (wireSize / 2), 0.5 + (wireSize / 2)), getIcons(ForgeDirection.UNKNOWN));
    if (up || !isInWorld)
        renderer.renderBox(new Vec3dCube(0.5 - (wireSize / 2), 0.5 + (wireSize / 2), 0.5 - (wireSize / 2), 0.5 + (wireSize / 2), 1, 0.5 + (wireSize / 2)), getIcons(ForgeDirection.UP));
    if (down || !isInWorld)
        renderer.renderBox(new Vec3dCube(0.5 - (wireSize / 2), 0, 0.5 - (wireSize / 2), 0.5 + (wireSize / 2), 0.5 - (wireSize / 2), 0.5 + (wireSize / 2)), getIcons(ForgeDirection.DOWN));
    if (north || !isInWorld)
        renderer.renderBox(new Vec3dCube(0.5 - (wireSize / 2), 0.5 - (wireSize / 2), 0, 0.5 + (wireSize / 2), 0.5 + (wireSize / 2), 0.5 - (wireSize / 2)), getIcons(ForgeDirection.NORTH));
    if (south || !isInWorld)
        renderer.renderBox(new Vec3dCube(0.5 - (wireSize / 2), 0.5 - (wireSize / 2), 0.5 + (wireSize / 2), 0.5 + (wireSize / 2), 0.5 + (wireSize / 2), 1), getIcons(ForgeDirection.SOUTH));
    if (west || !isInWorld)
        renderer.renderBox(new Vec3dCube(0, 0.5 - (wireSize / 2), 0.5 - (wireSize / 2), 0.5 - (wireSize / 2), 0.5 + (wireSize / 2), 0.5 + (wireSize / 2)), getIcons(ForgeDirection.WEST));
    if (east || !isInWorld)
        renderer.renderBox(new Vec3dCube(0.5 + (wireSize / 2), 0.5 - (wireSize / 2), 0.5 - (wireSize / 2), 1, 0.5 + (wireSize / 2), 0.5 + (wireSize / 2)), getIcons(ForgeDirection.EAST));
    renderer.setColor(getFrameColorMultiplier());
    // Frame
    renderFrame(renderer, wireSize, frameSeparation, frameThickness, down, up, west, east, north, south, isInWorld, getFrameIcon(), getFrameColorMultiplier());
    return true;
}
Also used : Vec3dCube(uk.co.qmunity.lib.vec.Vec3dCube) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Aggregations

SideOnly (cpw.mods.fml.relauncher.SideOnly)204 ItemStack (net.minecraft.item.ItemStack)52 IIcon (net.minecraft.util.IIcon)17 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)17 Vec3dCube (uk.co.qmunity.lib.vec.Vec3dCube)13 Block (net.minecraft.block.Block)12 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)10 TileEntity (net.minecraft.tileentity.TileEntity)10 AxisAlignedBB (net.minecraft.util.AxisAlignedBB)9 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)8 ArrayList (java.util.ArrayList)8 Rotation (uk.co.qmunity.lib.transform.Rotation)8 AMParticle (am2.particles.AMParticle)6 IconFlipped (net.minecraft.client.renderer.IconFlipped)6 ItemBlock (net.minecraft.item.ItemBlock)6 Minecraft (net.minecraft.client.Minecraft)5 Tessellator (net.minecraft.client.renderer.Tessellator)5 EntityPlayer (net.minecraft.entity.player.EntityPlayer)5 GuiScreen (net.minecraft.client.gui.GuiScreen)4 RenderHelper (uk.co.qmunity.lib.client.render.RenderHelper)4