use of uk.co.qmunity.lib.vec.Vec3dCube in project BluePower by Qmunity.
the class GateNullCell method renderStatic.
// Rendering
@Override
@SideOnly(Side.CLIENT)
public boolean renderStatic(Vec3i translation, RenderHelper renderer, RenderBlocks renderBlocks, int pass) {
super.renderStatic(translation, renderer, renderBlocks, pass);
double height = 2 / 16D;
IIcon wire = IconSupplier.wire;
if (typeA != null) {
// Flat
renderer.setColor(WireHelper.getColorForPowerLevel(typeA, powerA));
ForgeDirection dir = ForgeDirection.NORTH;
for (int i = 0; i < getRotation(); i++) dir = dir.getRotation(getFace().getOpposite());
dir = new Vec3d(0, 0, 0).add(dir).rotateUndo(getFace(), Vec3d.center).toForgeDirection();
renderer.renderBox(new Vec3dCube(7 / 16D, 2 / 16D, 1 / 16D, 9 / 16D, 2 / 16D + height, 15 / 16D), wire);
renderer.renderBox(new Vec3dCube(7 / 16D, 2 / 16D, 0 / 16D, 9 / 16D, 2 / 16D + (height / (nullcells[dir.ordinal()] ? 1 : 2)), 1 / 16D), wire);
renderer.renderBox(new Vec3dCube(7 / 16D, 2 / 16D, 15 / 16D, 9 / 16D, 2 / 16D + (height / (nullcells[dir.getOpposite().ordinal()] ? 1 : 2)), 16 / 16D), wire);
}
if (typeB != null) {
// Supported
renderer.setColor(WireHelper.getColorForPowerLevel(typeB, powerB));
ForgeDirection dir = ForgeDirection.WEST;
for (int i = 0; i < getRotation(); i++) dir = dir.getRotation(getFace().getOpposite());
dir = new Vec3d(0, 0, 0).add(dir).rotateUndo(getFace(), Vec3d.center).toForgeDirection();
if (!nullcells[dir.ordinal()])
renderer.renderBox(new Vec3dCube(0 / 16D, 2 / 16D, 7 / 16D, 2 / 16D, 10 / 16D, 9 / 16D), wire);
if (!nullcells[dir.getOpposite().ordinal()])
renderer.renderBox(new Vec3dCube(14 / 16D, 2 / 16D, 7 / 16D, 16 / 16D, 10 / 16D, 9 / 16D), wire);
renderer.renderBox(new Vec3dCube(0 / 16D, 10 / 16D, 7 / 16D, 16 / 16D, 12 / 16D, 9 / 16D), wire);
}
renderer.setColor(0xFFFFFF);
renderer.resetTransformations();
return true;
}
use of uk.co.qmunity.lib.vec.Vec3dCube in project BluePower by Qmunity.
the class GateSupported method addBoxes.
protected void addBoxes(List<Vec3dCube> boxes) {
boxes.add(new Vec3dCube(2 / 16D, 2 / 16D, 2 / 16D, 3 / 16D, 10 / 16D, 3 / 16D));
boxes.add(new Vec3dCube(2 / 16D, 2 / 16D, 13 / 16D, 3 / 16D, 10 / 16D, 14 / 16D));
boxes.add(new Vec3dCube(2 / 16D, 9 / 16D, 3 / 16D, 3 / 16D, 10 / 16D, 13 / 16D));
boxes.add(new Vec3dCube(13 / 16D, 2 / 16D, 2 / 16D, 14 / 16D, 10 / 16D, 3 / 16D));
boxes.add(new Vec3dCube(13 / 16D, 2 / 16D, 13 / 16D, 14 / 16D, 10 / 16D, 14 / 16D));
boxes.add(new Vec3dCube(13 / 16D, 9 / 16D, 3 / 16D, 14 / 16D, 10 / 16D, 13 / 16D));
}
use of uk.co.qmunity.lib.vec.Vec3dCube 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;
}
use of uk.co.qmunity.lib.vec.Vec3dCube in project BluePower by Qmunity.
the class PneumaticTube method getTubeBoxes.
protected List<Vec3dCube> getTubeBoxes() {
List<Vec3dCube> aabbs = getOcclusionBoxes();
for (int i = 0; i < 6; i++) {
ForgeDirection d = ForgeDirection.getOrientation(i);
if (connections[i] || redstoneConnections[i] || getDeviceOnSide(d) != null) {
Vec3dCube c = sideBB.clone().rotate(d, Vec3d.center);
aabbs.add(c);
}
}
return aabbs;
}
use of uk.co.qmunity.lib.vec.Vec3dCube in project BluePower by Qmunity.
the class PneumaticTube method onActivated.
/**
* Event called when the part is activated (right clicked)
*
* @param player
* Player that right clicked the part
* @param item
* Item that was used to click it
* @return Whether or not an action occurred
*/
@Override
public boolean onActivated(EntityPlayer player, QMovingObjectPosition mop, ItemStack item) {
if (getWorld() == null)
return false;
if (item != null) {
TubeColor newColor = null;
if (item.getItem() == BPItems.paint_brush && ((ItemDamageableColorableOverlay) BPItems.paint_brush).tryUseItem(item)) {
newColor = TubeColor.values()[item.getItemDamage()];
} else if (item.getItem() == Items.water_bucket || (item.getItem() == BPItems.paint_brush && item.getItemDamage() == 16)) {
newColor = TubeColor.NONE;
}
if (newColor != null) {
if (!getWorld().isRemote) {
List<Vec3dCube> boxes = getTubeBoxes();
Vec3dCube box = mop.getCube();
int face = -1;
if (box.equals(boxes.get(0))) {
face = mop.sideHit;
} else {
face = getSideFromAABBIndex(boxes.indexOf(box));
}
color[face] = newColor;
updateConnections();
getLogic().clearNodeCaches();
notifyUpdate();
}
return true;
}
if (item.getItem() instanceof ItemPart) {
BPPart part = PartManager.getExample(item);
if (redwireType == null && part instanceof PartRedwireFaceUninsulated) {
if (!getWorld().isRemote) {
redwireType = ((IRedwire) part).getRedwireType(ForgeDirection.UNKNOWN);
if (!player.capabilities.isCreativeMode)
item.stackSize--;
// Redstone update
getRedstoneConnectionCache().recalculateConnections();
RedstoneApi.getInstance().getRedstonePropagator(this, ForgeDirection.DOWN).propagate();
updateConnections();
getLogic().clearNodeCaches();
notifyUpdate();
sendUpdatePacket();
}
return true;
}
}
// Removing redwire
if (redwireType != null && item.getItem() instanceof IScrewdriver && player.isSneaking()) {
if (!getWorld().isRemote) {
IOHelper.spawnItemInWorld(getWorld(), PartManager.getPartInfo("wire." + redwireType.getName()).getStack(), getX() + 0.5, getY() + 0.5, getZ() + 0.5);
redwireType = null;
// Redstone update
getRedstoneConnectionCache().recalculateConnections();
RedstoneApi.getInstance().getRedstonePropagator(this, ForgeDirection.DOWN).propagate();
((IScrewdriver) item.getItem()).damage(item, 1, player, false);
updateConnections();
getLogic().clearNodeCaches();
notifyUpdate();
sendUpdatePacket();
}
return true;
}
}
return false;
}
Aggregations