Search in sources :

Example 1 with BoundingBox

use of logisticspipes.utils.math.BoundingBox in project LogisticsPipes by RS485.

the class SideConfigDisplay method renderSelection.

private void renderSelection() {
    if (selection == null) {
        return;
    }
    GL11.glPushMatrix();
    GL11.glShadeModel(GL11.GL_FLAT);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPopMatrix();
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    if (selection.hit.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
        GL11.glEnable(GL11.GL_BLEND);
        OpenGlHelper.glBlendFunc(770, 771, 1, 0);
        GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.4F);
        GL11.glLineWidth(2.0F);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDepthMask(false);
        float f1 = 0.002F;
        Block block = mc.theWorld.getBlock(selection.hit.blockX, selection.hit.blockY, selection.hit.blockZ);
        if (block.getMaterial() != Material.air) {
            if (block instanceof LogisticsBlockGenericPipe) {
                LogisticsBlockGenericPipe.bypassPlayerTrace = cachedLPBlockTrace;
            }
            block.setBlockBoundsBasedOnState(mc.theWorld, selection.hit.blockX, selection.hit.blockY, selection.hit.blockZ);
            double d0 = origin.x - eye.x;
            double d1 = origin.y - eye.y;
            double d2 = origin.z - eye.z;
            RenderGlobal.drawOutlinedBoundingBox(block.getSelectedBoundingBoxFromPool(mc.theWorld, selection.hit.blockX, selection.hit.blockY, selection.hit.blockZ).expand((double) f1, (double) f1, (double) f1).getOffsetBoundingBox(-d0, -d1, -d2), -1);
            if (block instanceof LogisticsBlockGenericPipe) {
                LogisticsBlockGenericPipe.bypassPlayerTrace = null;
            }
        }
        GL11.glDepthMask(true);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_BLEND);
    }
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    BoundingBox bb = new BoundingBox(new DoubleCoordinates(selection.config));
    IIcon icon = Textures.LOGISTICS_SIDE_SELECTION;
    List<Vertex> corners = bb.getCornersWithUvForFace(selection.face, icon.getMinU(), icon.getMaxU(), icon.getMinV(), icon.getMaxV());
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_LIGHTING);
    RenderUtil.bindBlockTexture();
    GL11.glColor3f(1, 1, 1);
    Tessellator.instance.startDrawingQuads();
    Tessellator.instance.setColorOpaque_F(1, 1, 1);
    Vector3d trans = new Vector3d((-origin.x) + eye.x, (-origin.y) + eye.y, (-origin.z) + eye.z);
    Tessellator.instance.setTranslation(trans.x, trans.y, trans.z);
    RenderUtil.addVerticesToTesselator(corners);
    Tessellator.instance.draw();
    Tessellator.instance.setTranslation(0, 0, 0);
}
Also used : Vertex(logisticspipes.utils.math.Vertex) IIcon(net.minecraft.util.IIcon) Vector3d(logisticspipes.utils.math.Vector3d) LogisticsBlockGenericPipe(logisticspipes.pipes.basic.LogisticsBlockGenericPipe) BoundingBox(logisticspipes.utils.math.BoundingBox) Block(net.minecraft.block.Block) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates)

Aggregations

LogisticsBlockGenericPipe (logisticspipes.pipes.basic.LogisticsBlockGenericPipe)1 BoundingBox (logisticspipes.utils.math.BoundingBox)1 Vector3d (logisticspipes.utils.math.Vector3d)1 Vertex (logisticspipes.utils.math.Vertex)1 Block (net.minecraft.block.Block)1 IIcon (net.minecraft.util.IIcon)1 DoubleCoordinates (network.rs485.logisticspipes.world.DoubleCoordinates)1