use of uk.co.qmunity.lib.transform.Rotation in project BluePower by Qmunity.
the class PartLamp method renderDynamic.
/**
* @author Koen Beckers (K4Unl), Amadornes
*/
@Override
@SideOnly(Side.CLIENT)
public void renderDynamic(Vec3d translation, double delta, int pass) {
RenderHelper renderer = RenderHelper.instance;
renderer.reset();
switch(getFace().ordinal()) {
case 0:
break;
case 1:
renderer.addTransformation(new Rotation(180, 0, 0, Vec3d.center));
break;
case 2:
renderer.addTransformation(new Rotation(90, 0, 0, Vec3d.center));
break;
case 3:
renderer.addTransformation(new Rotation(-90, 0, 0, Vec3d.center));
break;
case 4:
renderer.addTransformation(new Rotation(0, 0, -90, Vec3d.center));
break;
case 5:
renderer.addTransformation(new Rotation(0, 0, 90, Vec3d.center));
break;
}
renderGlow(pass);
renderer.resetTransformations();
}
use of uk.co.qmunity.lib.transform.Rotation in project BluePower by Qmunity.
the class GateTransceiver method renderStatic.
@Override
@SideOnly(Side.CLIENT)
public boolean renderStatic(Vec3i translation, RenderHelper renderer, RenderBlocks renderBlocks, int pass) {
super.renderStatic(translation, renderer, renderBlocks, pass);
if (getParent() != null)
renderer.addTransformation(new Rotation(0, 180, 0));
IIcon obsidian = Blocks.obsidian.getIcon(0, 0);
IIcon quartz = Blocks.quartz_block.getIcon(0, 0);
IIcon iron = Blocks.iron_block.getIcon(0, 0);
IIcon gold = Blocks.gold_block.getIcon(0, 0);
// Base
renderer.renderBox(new Vec3dCube(7 / 16D, 2 / 16D, 7 / 16D, 9 / 16D, 8 / 16D, 9 / 16D), obsidian);
if (getParent() == null || getWorld() == null)
renderer.addTransformation(new Rotation(0, -(System.currentTimeMillis() / 100D) % 360, 0));
renderer.addTransformation(new Rotation(45, 0, 0));
// Post
renderer.renderBox(new Vec3dCube(15 / 32D, 9 / 16D, 15 / 32D, 17 / 32D, 10 / 16D, 17 / 32D), iron);
// Ball thingy
renderer.renderBox(new Vec3dCube(7 / 16D, 10 / 16D, 7 / 16D, 9 / 16D, 12 / 16D, 9 / 16D), gold);
renderer.renderBox(new Vec3dCube(6 / 16D, 8 / 16D, 5 / 16D, 10 / 16D, 9 / 16D, 11 / 16D), quartz);
renderer.renderBox(new Vec3dCube(5 / 16D, 8 / 16D, 6 / 16D, 11 / 16D, 9 / 16D, 10 / 16D), quartz);
for (int i = 0; i < 4; i++) {
renderer.renderBox(new Vec3dCube(5 / 16D, 9 / 16D, 10 / 16D, 6 / 16D, 10 / 16D, 11 / 16D).rotate(0, i * 90, 0, Vec3d.center), quartz);
renderer.renderBox(new Vec3dCube(4 / 16D, 9 / 16D, 6 / 16D, 5 / 16D, 10 / 16D, 10 / 16D).rotate(0, i * 90, 0, Vec3d.center), quartz);
renderer.renderBox(new Vec3dCube(4 / 16D, 10 / 16D, 5 / 16D, 5 / 16D, 11 / 16D, 11 / 16D).rotate(0, i * 90, 0, Vec3d.center), quartz);
renderer.renderBox(new Vec3dCube(4 / 16D, 11 / 16D, 11 / 16D, 5 / 16D, 12 / 16D, 12 / 16D).rotate(0, i * 90, 0, Vec3d.center), quartz);
renderer.renderBox(new Vec3dCube(3 / 16D, 11 / 16D, 4 / 16D, 4 / 16D, 12 / 16D, 12 / 16D).rotate(0, i * 90, 0, Vec3d.center), quartz);
}
renderer.resetTransformations();
return true;
}
use of uk.co.qmunity.lib.transform.Rotation in project BluePower by Qmunity.
the class PneumaticTube method renderStatic.
@Override
@SideOnly(Side.CLIENT)
public boolean renderStatic(Vec3i loc, RenderHelper renderer, RenderBlocks renderBlocks, int pass) {
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);
boolean renderFully = shouldRenderFully();
if (this instanceof RestrictionTube) {
IIcon icon = IconSupplier.restrictionTubeSide;
renderer.renderBox(new Vec3dCube(0.25, 0.25, 0.25, 0.75, 0.75, 0.75), icon);
}
double addedThickness = getAddedThickness();
double wireSize = getSize() / 16D;
double frameSeparation = 6 / 16D - addedThickness - addedThickness - 0.001;
double frameThickness = 1 / 16D + addedThickness;
if (pass == 0) {
if (this instanceof RestrictionTube) {
IIcon icon = IconSupplier.restrictionTubeSide;
renderer.renderBox(new Vec3dCube(0.25, 0.25, 0.25, 0.75, 0.75, 0.75), icon);
}
if (renderFully) {
renderer.setColor(getColorMultiplier());
renderFrame(renderer, wireSize, frameSeparation, frameThickness, true, true, true, true, true, true, down, up, west, east, north, south, true, getFrameIcon(), getFrameColorMultiplier());
renderer.setColor(0xFFFFFF);
} else {
boolean isInWorld = getParent() != null;
renderer.setColor(getFrameColorMultiplier());
// Frame
renderFrame(renderer, wireSize, frameSeparation, frameThickness, down, up, west, east, north, south, isInWorld, getFrameIcon(), getFrameColorMultiplier());
}
// Tube coloring
{
Vec3dCube side = new Vec3dCube(0.25 + 5 / 128D, 0, 0.25 - addedThickness, 0.25 + 9 / 128D + addedThickness, 0.25, 0.25 + 2 / 128D);
Vec3dCube side2 = new Vec3dCube(0.25 - addedThickness, 0, 0.25 + 5 / 128D, 0.25 + 2 / 128D, 0.25, 0.25 + 9 / 128D + addedThickness);
Vec3dCube side3 = new Vec3dCube(0.25 - addedThickness, 0.25 - addedThickness, 0.25 + 5 / 128D, 0.25 + 2 / 128D, 0.25 + 4 / 128D, 0.25 + 59 / 128D);
Vec3dCube side4 = new Vec3dCube(0.25 + 5 / 128D, 0.25 - addedThickness, 0.25 + 5 / 128D, 0.25 + 9 / 128D + addedThickness, 0.25 + 2 / 128D, 0.25 + 56 / 128D);
Vec3dCube side5 = new Vec3dCube(0.25 + 5 / 128D, 0.25 - addedThickness, 0.25 - 1 / 128D, 0.25 + 9 / 128D + addedThickness, 0.25 + 2 / 128D, 0.25 + 65 / 128D);
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
TubeColor c = color[d.ordinal()];
if (c != TubeColor.NONE) {
try {
renderer.setColor(MinecraftColor.values()[15 - c.ordinal()].getHex());
if (connections[d.ordinal()]) {
for (int i = 0; i < 4; i++) {
renderer.renderBox(side.clone().rotate(0, i * 90, 0, Vec3d.center).rotate(d, Vec3d.center), IconSupplier.pneumaticTubeColoring);
renderer.renderBox(side2.clone().rotate(0, i * 90, 0, Vec3d.center).rotate(d, Vec3d.center), IconSupplier.pneumaticTubeColoring);
if (renderFully)
renderer.renderBox(side3.clone().rotate(0, i * 90, 0, Vec3d.center).rotate(d, Vec3d.center), IconSupplier.pneumaticTubeColoring);
}
} else if (renderFully) {
for (int i = 0; i < 4; i++) renderer.renderBox(side4.clone().rotate(0, i * 90, 0, Vec3d.center).rotate(d, Vec3d.center), IconSupplier.pneumaticTubeColoring);
} else {
for (int i = 1; i < 4; i += 2) renderer.renderBox(side5.clone().rotate(0, (i + ((shouldRenderConnection(ForgeDirection.NORTH) || (shouldRenderConnection(ForgeDirection.UP) && (d == ForgeDirection.NORTH || d == ForgeDirection.SOUTH))) ? 1 : 0)) * 90, 0, Vec3d.center).rotate(d, Vec3d.center), IconSupplier.pneumaticTubeColoring);
}
renderer.setColor(0xFFFFFF);
} catch (Exception ex) {
System.out.println("Err on side " + d + ". Color: " + c);
}
}
}
}
if (redwireType != null) {
frameThickness /= 1.5;
frameSeparation -= 1 / 32D;
renderFrame(renderer, wireSize, frameSeparation, frameThickness, renderFully || shouldRenderConnection(ForgeDirection.DOWN), renderFully || shouldRenderConnection(ForgeDirection.UP), renderFully || shouldRenderConnection(ForgeDirection.WEST), renderFully || shouldRenderConnection(ForgeDirection.EAST), renderFully || shouldRenderConnection(ForgeDirection.NORTH), renderFully || shouldRenderConnection(ForgeDirection.SOUTH), redstoneConnections[ForgeDirection.DOWN.ordinal()], redstoneConnections[ForgeDirection.UP.ordinal()], redstoneConnections[ForgeDirection.WEST.ordinal()], redstoneConnections[ForgeDirection.EAST.ordinal()], redstoneConnections[ForgeDirection.NORTH.ordinal()], redstoneConnections[ForgeDirection.SOUTH.ordinal()], getParent() != null && getWorld() != null, IconSupplier.wire, WireHelper.getColorForPowerLevel(redwireType, getPower()));
Vec3dCube c = new Vec3dCube(0.5 - 1 / 56D, 0, 0.2, 0.5 + 1 / 56D, 1 / 32D, 0.8);
renderer.setColor(WireHelper.getColorForPowerLevel(redwireType, getPower()));
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
if (redstoneConnections[d.ordinal()] && !connections[d.ordinal()]) {
renderer.addTransformation(new Rotation(d));
for (int i = 0; i < 2; i++) {
renderer.addTransformation(new Rotation(0, 45 + 90 * i, 0));
renderer.renderBox(c.clone(), IconSupplier.wire);
renderer.removeTransformation();
}
renderer.removeTransformation();
}
}
renderer.setColor(0xFFFFFF);
}
} else {
IIcon glass = this instanceof MagTube ? IconSupplier.magTubeGlass : IconSupplier.pneumaticTubeGlass;
IIcon glass2 = this instanceof MagTube ? IconSupplier.magTubeGlass2 : IconSupplier.pneumaticTubeGlass2;
if (!(this instanceof RestrictionTube)) {
renderer.setRenderSides(!down, !up, !west, !east, !north, !south);
if (renderFully) {
renderer.renderBox(new Vec3dCube(4.5 / 16D, 4.5 / 16D, 4.5 / 16D, 11.5 / 16D, 11.5 / 16D, 11.5 / 16D), glass);
} else {
boolean ud = west || east;
boolean we = north || south;
boolean ns = west || east;
renderer.setTextureRotations(ud ? 1 : 0, ud ? 1 : 0, we ? 1 : 0, we ? 1 : 0, ns ? 1 : 0, ns ? 1 : 0);
renderer.renderBox(new Vec3dCube(4.5 / 16D, 4.5 / 16D, 4.5 / 16D, 11.5 / 16D, 11.5 / 16D, 11.5 / 16D), glass2);
}
renderer.resetRenderedSides();
renderer.resetTextureRotations();
}
Vec3dCube c = new Vec3dCube(4.5 / 16D, 0, 4.5 / 16D, 11.5 / 16D, 4.5 / 16D, 11.5 / 16D);
if (renderFully) {
boolean ud = west || east;
boolean we = north || south;
boolean ns = west || east;
renderer.setTextureRotations(ud ? 1 : 0, ud ? 1 : 0, we ? 1 : 0, we ? 1 : 0, ns ? 1 : 0, ns ? 1 : 0);
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
if (shouldRenderConnection(d)) {
renderer.setRenderSide(d, false);
renderer.setRenderSide(d.getOpposite(), false);
renderer.renderBox(c.clone().rotate(d, Vec3d.center), glass);
renderer.resetRenderedSides();
}
}
} else {
boolean ud = west || east;
boolean we = north || south;
boolean ns = west || east;
renderer.setTextureRotations(ud ? 1 : 0, ud ? 1 : 0, we ? 1 : 0, we ? 1 : 0, ns ? 1 : 0, ns ? 1 : 0);
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
if (shouldRenderConnection(d)) {
renderer.setRenderSide(d, false);
renderer.setRenderSide(d.getOpposite(), false);
renderer.renderBox(c.clone().rotate(d, Vec3d.center), glass2);
renderer.resetRenderedSides();
}
}
}
}
return true;
}
use of uk.co.qmunity.lib.transform.Rotation in project BluePower by Qmunity.
the class PneumaticTubeOpaque method renderStatic.
@Override
@SideOnly(Side.CLIENT)
public boolean renderStatic(Vec3i loc, RenderHelper renderer, RenderBlocks renderBlocks, int pass) {
if (pass == 0) {
boolean renderFully = false;
int count = 0;
for (int i = 0; i < 6; i++) {
if (connections[i] || redstoneConnections[i])
count++;
if (i % 2 == 0 && connections[i] != connections[i + 1])
renderFully = true;
}
renderFully |= count > 2 || count == 0;
IIcon icon = this instanceof RestrictionTubeOpaque ? (renderFully ? IconSupplier.restrictionTubeNodeOpaque : IconSupplier.restrictionTubeSideOpaque) : renderFully ? IconSupplier.pneumaticTubeOpaqueNode : IconSupplier.pneumaticTubeOpaqueSide;
if (shouldRenderConnection(ForgeDirection.EAST) || shouldRenderConnection(ForgeDirection.WEST))
renderer.setTextureRotations(1, 1, 0, 0, 1, 1);
if (shouldRenderConnection(ForgeDirection.NORTH) || shouldRenderConnection(ForgeDirection.SOUTH))
renderer.setTextureRotations(0, 0, 1, 1, 0, 0);
renderer.renderBox(new Vec3dCube(0.25, 0.25, 0.25, 0.75, 0.75, 0.75), icon);
renderer.resetTextureRotations();
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
if (shouldRenderConnection(d)) {
renderer.addTransformation(new Rotation(d));
renderer.renderBox(new Vec3dCube(0.25, 0, 0.25, 0.75, 0.25, 0.75), IconSupplier.pneumaticTubeOpaqueNode, null, icon, icon, icon, icon);
renderer.removeTransformation();
}
}
if (getRedwireType() != null) {
double wireSize = getSize() / 16D;
double frameSeparation = 6 / 16D - (wireSize - 2 / 16D);
double frameThickness = 1 / 16D;
frameThickness /= 1.5;
frameSeparation -= 1 / 32D;
renderFrame(renderer, wireSize, frameSeparation, frameThickness, renderFully || shouldRenderConnection(ForgeDirection.DOWN), renderFully || shouldRenderConnection(ForgeDirection.UP), renderFully || shouldRenderConnection(ForgeDirection.WEST), renderFully || shouldRenderConnection(ForgeDirection.EAST), renderFully || shouldRenderConnection(ForgeDirection.NORTH), renderFully || shouldRenderConnection(ForgeDirection.SOUTH), redstoneConnections[ForgeDirection.DOWN.ordinal()], redstoneConnections[ForgeDirection.UP.ordinal()], redstoneConnections[ForgeDirection.WEST.ordinal()], redstoneConnections[ForgeDirection.EAST.ordinal()], redstoneConnections[ForgeDirection.NORTH.ordinal()], redstoneConnections[ForgeDirection.SOUTH.ordinal()], getParent() != null && getWorld() != null, IconSupplier.wire, WireHelper.getColorForPowerLevel(getRedwireType(), getPower()));
}
// Tube coloring
{
Vec3dCube side = new Vec3dCube(0.25 + 5 / 128D, 0, 0.25 - 1 / 128D, 0.25 + 9 / 128D, 0.25, 0.25 + 2 / 128D);
Vec3dCube side2 = new Vec3dCube(0.25 - 1 / 128D, 0, 0.25 + 5 / 128D, 0.25 + 2 / 128D, 0.25, 0.25 + 9 / 128D);
Vec3dCube side3 = new Vec3dCube(0.25 - 1 / 128D, 0.25 - 1 / 128D, 0.25 + 5 / 128D, 0.25 + 2 / 128D, 0.25 + 2 / 128D, 0.25 + 59 / 128D);
Vec3dCube side4 = new Vec3dCube(0.25 + 5 / 128D, 0.25 - 1 / 128D, 0.25 + 5 / 128D, 0.25 + 9 / 128D, 0.25 + 2 / 128D, 0.25 + 56 / 128D);
Vec3dCube side5 = new Vec3dCube(0.25 + 5 / 128D, 0.25 - 1 / 128D, 0.25 - 1 / 128D, 0.25 + 9 / 128D, 0.25 + 2 / 128D, 0.25 + 65 / 128D);
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
TubeColor c = color[d.ordinal()];
if (c != TubeColor.NONE) {
try {
renderer.setColor(MinecraftColor.values()[15 - c.ordinal()].getHex());
if (connections[d.ordinal()]) {
for (int i = 0; i < 4; i++) {
renderer.renderBox(side.clone().rotate(0, i * 90, 0, Vec3d.center).rotate(d, Vec3d.center), IconSupplier.pneumaticTubeColoring);
renderer.renderBox(side2.clone().rotate(0, i * 90, 0, Vec3d.center).rotate(d, Vec3d.center), IconSupplier.pneumaticTubeColoring);
if (renderFully)
renderer.renderBox(side3.clone().rotate(0, i * 90, 0, Vec3d.center).rotate(d, Vec3d.center), IconSupplier.pneumaticTubeColoring);
}
} else if (renderFully) {
for (int i = 0; i < 4; i++) renderer.renderBox(side4.clone().rotate(0, i * 90, 0, Vec3d.center).rotate(d, Vec3d.center), IconSupplier.pneumaticTubeColoring);
} else {
for (int i = 1; i < 4; i += 2) renderer.renderBox(side5.clone().rotate(0, (i + ((shouldRenderConnection(ForgeDirection.NORTH) || (shouldRenderConnection(ForgeDirection.UP) && (d == ForgeDirection.NORTH || d == ForgeDirection.SOUTH))) ? 1 : 0)) * 90, 0, Vec3d.center).rotate(d, Vec3d.center), IconSupplier.pneumaticTubeColoring);
}
renderer.setColor(0xFFFFFF);
} catch (Exception ex) {
System.out.println("Err on side " + d + ". Color: " + c);
}
}
}
}
}
return true;
}
Aggregations