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));
}
}
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;
}
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;
}
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();
}
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;
}
Aggregations