Java Code Examples for net.minecraft.client.renderer.Tessellator#getWorldRenderer()

The following examples show how to use net.minecraft.client.renderer.Tessellator#getWorldRenderer() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomCrosshairGraphics.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void drawLine(final int x1, final int y1, final int x2, final int y2,
                            final Color colour) {
    final Tessellator tessellator = Tessellator.getInstance();
    final WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    GlStateManager.enableBlend();
    GlStateManager.disableTexture2D();
    GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
    GlStateManager
        .color(colour.getRed() / 255.0f, colour.getGreen() / 255.0f, colour.getBlue() / 255.0f,
            colour.getAlpha() / 255.0f);
    worldrenderer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
    worldrenderer.pos(x1, y1, 0.0).endVertex();
    worldrenderer.pos(x2, y2, 0.0).endVertex();
    tessellator.draw();
    GlStateManager.enableTexture2D();
    GlStateManager.disableBlend();
}
 
Example 2
Source File: CustomCrosshairGraphics.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void drawCircle(final double x, final double y, final int radius,
                              final Color colour) {
    final Tessellator tessellator = Tessellator.getInstance();
    final WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    GlStateManager.enableBlend();
    GlStateManager.disableTexture2D();
    GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
    GlStateManager
        .color(colour.getRed() / 255.0f, colour.getGreen() / 255.0f, colour.getBlue() / 255.0f,
            colour.getAlpha() / 255.0f);
    worldrenderer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
    for (int degrees = 0; degrees <= 360; ++degrees) {
        final float radians = (float) (degrees * 0.017453292519943295);
        worldrenderer.pos(x + Math.cos(radians) * radius, y + Math.sin(radians) * radius, 0.0)
            .endVertex();
    }
    tessellator.draw();
    GlStateManager.enableTexture2D();
    GlStateManager.disableBlend();
}
 
Example 3
Source File: Notification.java    From ClientBase with MIT License 5 votes vote down vote up
public static void drawRect(int mode, double left, double top, double right, double bottom, int color) {
    if (left < right) {
        double i = left;
        left = right;
        right = i;
    }

    if (top < bottom) {
        double j = top;
        top = bottom;
        bottom = j;
    }

    float f3 = (float) (color >> 24 & 255) / 255.0F;
    float f = (float) (color >> 16 & 255) / 255.0F;
    float f1 = (float) (color >> 8 & 255) / 255.0F;
    float f2 = (float) (color & 255) / 255.0F;
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    GlStateManager.enableBlend();
    GlStateManager.disableTexture2D();
    GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
    GlStateManager.color(f, f1, f2, f3);
    worldrenderer.begin(mode, DefaultVertexFormats.POSITION);
    worldrenderer.pos(left, bottom, 0.0D).endVertex();
    worldrenderer.pos(right, bottom, 0.0D).endVertex();
    worldrenderer.pos(right, top, 0.0D).endVertex();
    worldrenderer.pos(left, top, 0.0D).endVertex();
    tessellator.draw();
    GlStateManager.enableTexture2D();
    GlStateManager.disableBlend();
}
 
Example 4
Source File: PotionEffects.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void drawTexturedModalRect(int x, int y, int textureX, int textureY, int width, int height) {
    float f = 0.00390625F;
    float f1 = 0.00390625F;
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    worldrenderer.pos(x, y + height, 0).tex((float) (textureX) * f, (float) (textureY + height) * f1).endVertex();
    worldrenderer.pos(x + width, y + height, 0).tex((float) (textureX + width) * f, (float) (textureY + height) * f1).endVertex();
    worldrenderer.pos(x + width, y, 0).tex((float) (textureX + width) * f, (float) (textureY) * f1).endVertex();
    worldrenderer.pos(x, y, 0).tex((float) (textureX) * f, (float) (textureY) * f1).endVertex();
    tessellator.draw();
}
 
Example 5
Source File: AboveHeadRenderer.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void renderName(RenderPlayerEvent event, LevelheadTag tag, EntityPlayer player, double x, double y, double z) {
    FontRenderer fontrenderer = event.getRenderManager().getFontRenderer();
    float f = (float) (1.6F * Levelhead.getInstance().getDisplayManager().getMasterConfig().getFontSize());
    float f1 = 0.016666668F * f;
    GlStateManager.pushMatrix();
    GlStateManager.translate((float) x + 0.0F, (float) y + player.height + 0.5F, (float) z);
    GL11.glNormal3f(0.0F, 1.0F, 0.0F);
    GlStateManager.rotate(-event.getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F);
    GlStateManager.rotate(event.getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F);
    GlStateManager.scale(-f1, -f1, f1);
    GlStateManager.disableLighting();
    GlStateManager.depthMask(false);
    GlStateManager.disableDepth();
    GlStateManager.enableBlend();
    GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    int i = 0;

    int j = fontrenderer.getStringWidth(tag.getString()) / 2;
    GlStateManager.disableTexture2D();
    worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
    worldrenderer.pos(-j - 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
    worldrenderer.pos(-j - 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
    worldrenderer.pos(j + 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
    worldrenderer.pos(j + 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
    tessellator.draw();
    GlStateManager.enableTexture2D();

    renderString(fontrenderer, tag);

    GlStateManager.enableLighting();
    GlStateManager.disableBlend();
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    GlStateManager.popMatrix();
}
 
Example 6
Source File: TabGui.java    From ClientBase with MIT License 5 votes vote down vote up
public static void drawRect(int glFlag, int left, int top, int right, int bottom, int color) {
    if (left < right) {
        int i = left;
        left = right;
        right = i;
    }

    if (top < bottom) {
        int j = top;
        top = bottom;
        bottom = j;
    }

    float f3 = (float) (color >> 24 & 255) / 255.0F;
    float f = (float) (color >> 16 & 255) / 255.0F;
    float f1 = (float) (color >> 8 & 255) / 255.0F;
    float f2 = (float) (color & 255) / 255.0F;
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    GlStateManager.enableBlend();
    GlStateManager.disableTexture2D();
    GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
    GlStateManager.color(f, f1, f2, f3);
    worldrenderer.begin(glFlag, DefaultVertexFormats.POSITION);
    worldrenderer.pos((double) left, (double) bottom, 0.0D).endVertex();
    worldrenderer.pos((double) right, (double) bottom, 0.0D).endVertex();
    worldrenderer.pos((double) right, (double) top, 0.0D).endVertex();
    worldrenderer.pos((double) left, (double) top, 0.0D).endVertex();
    tessellator.draw();
    GlStateManager.enableTexture2D();
    GlStateManager.disableBlend();
}
 
Example 7
Source File: GLUtil.java    From ClientBase with MIT License 5 votes vote down vote up
public static void drawRect(int mode, int left, int top, int right, int bottom, int color) {
    if (left < right) {
        int i = left;
        left = right;
        right = i;
    }

    if (top < bottom) {
        int j = top;
        top = bottom;
        bottom = j;
    }

    float f3 = (float) (color >> 24 & 255) / 255.0F;
    float f = (float) (color >> 16 & 255) / 255.0F;
    float f1 = (float) (color >> 8 & 255) / 255.0F;
    float f2 = (float) (color & 255) / 255.0F;
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    GlStateManager.enableBlend();
    GlStateManager.disableTexture2D();
    GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
    GlStateManager.color(f, f1, f2, f3);
    worldrenderer.begin(mode, DefaultVertexFormats.POSITION);
    worldrenderer.pos(left, bottom, 0.0D).endVertex();
    worldrenderer.pos(right, bottom, 0.0D).endVertex();
    worldrenderer.pos(right, top, 0.0D).endVertex();
    worldrenderer.pos(left, top, 0.0D).endVertex();
    tessellator.draw();
    GlStateManager.enableTexture2D();
    GlStateManager.disableBlend();
}
 
Example 8
Source File: RenderUtil.java    From Minecraft-GUI-API with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static void drawTexturedModalRect(int par1, int par2, int par3, int par4, int par5, int par6) {
	float var7 = 0.00390625F;
	float var8 = 0.00390625F;
	Tessellator var9 = Tessellator.getInstance();
	WorldRenderer var10 = var9.getWorldRenderer();
	var10.startDrawingQuads();
	var10.addVertexWithUV((par1 + 0), (par2 + par6), 0, ((par3 + 0) * var7), ((par4 + par6) * var8));
	var10.addVertexWithUV((par1 + par5), (par2 + par6), 0, ((par3 + par5) * var7), ((par4 + par6) * var8));
	var10.addVertexWithUV((par1 + par5), (par2 + 0), 0, ((par3 + par5) * var7), ((par4 + 0) * var8));
	var10.addVertexWithUV((par1 + 0), (par2 + 0), 0, ((par3 + 0) * var7), ((par4 + 0) * var8));
	var9.draw();
}
 
Example 9
Source File: CustomCrosshairGraphics.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void drawFilledRectangle(int x1, int y1, int x2, int y2, final Color colour) {
    if (x1 < x2) {
        final int tempX = x1;
        x1 = x2;
        x2 = tempX;
    }
    if (y1 < y2) {
        final int tempY = y1;
        y1 = y2;
        y2 = tempY;
    }
    final Tessellator tessellator = Tessellator.getInstance();
    final WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    GlStateManager.enableBlend();
    GlStateManager.disableTexture2D();
    GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
    GlStateManager
        .color(colour.getRed() / 255.0f, colour.getGreen() / 255.0f, colour.getBlue() / 255.0f,
            colour.getAlpha() / 255.0f);
    worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
    worldrenderer.pos(x1, y2, 0.0).endVertex();
    worldrenderer.pos(x2, y2, 0.0).endVertex();
    worldrenderer.pos(x2, y1, 0.0).endVertex();
    worldrenderer.pos(x1, y1, 0.0).endVertex();
    tessellator.draw();
    GlStateManager.enableTexture2D();
    GlStateManager.disableBlend();
}
 
Example 10
Source File: RenderUtils.java    From LiquidBounce with GNU General Public License v3.0 5 votes vote down vote up
public static void drawSelectionBoundingBox(AxisAlignedBB boundingBox) {
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();

    worldrenderer.begin(GL_LINE_STRIP, DefaultVertexFormats.POSITION);

    // Lower Rectangle
    worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex();
    worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).endVertex();
    worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).endVertex();
    worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).endVertex();
    worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex();

    // Upper Rectangle
    worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex();
    worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).endVertex();
    worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).endVertex();
    worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).endVertex();
    worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex();

    // Upper Rectangle
    worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).endVertex();
    worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).endVertex();

    worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).endVertex();
    worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).endVertex();

    worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).endVertex();
    worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).endVertex();

    tessellator.draw();
}
 
Example 11
Source File: PlayerOverlay.java    From MediaMod with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Draws a rectangle with a vertical gradient between the specified colors (ARGB format).
 * Args: x1, y1, x2, y2, topColor, bottomColor
 *
 * @author ScottehBoeh
 */
private void drawGradientRect(double left, double top, double right, double bottom, int startColor, int endColor) {
    float f = (float) (startColor >> 24 & 255) / 255.0F;
    float f1 = (float) (startColor >> 16 & 255) / 255.0F;
    float f2 = (float) (startColor >> 8 & 255) / 255.0F;
    float f3 = (float) (startColor & 255) / 255.0F;
    float f4 = (float) (endColor >> 24 & 255) / 255.0F;
    float f5 = (float) (endColor >> 16 & 255) / 255.0F;
    float f6 = (float) (endColor >> 8 & 255) / 255.0F;
    float f7 = (float) (endColor & 255) / 255.0F;
    GlStateManager.disableTexture2D();
    GlStateManager.enableBlend();
    GlStateManager.disableAlpha();
    GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
    GlStateManager.shadeModel(7425);
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
    worldrenderer.pos(right, top, 0).color(f1, f2, f3, f).endVertex();
    worldrenderer.pos(left, top, 0).color(f1, f2, f3, f).endVertex();
    worldrenderer.pos(left, bottom, 0).color(f5, f6, f7, f4).endVertex();
    worldrenderer.pos(right, bottom, 0).color(f5, f6, f7, f4).endVertex();
    tessellator.draw();
    GlStateManager.shadeModel(7424);
    GlStateManager.disableBlend();
    GlStateManager.enableAlpha();
    GlStateManager.enableTexture2D();
}
 
Example 12
Source File: PlayerOverlay.java    From MediaMod with GNU General Public License v3.0 5 votes vote down vote up
public static void drawRect(double left, double top, double right, double bottom, int color) {
    if (left < right) {
        double i = left;
        left = right;
        right = i;
    }

    if (top < bottom) {
        double j = top;
        top = bottom;
        bottom = j;
    }

    float f3 = (float) (color >> 24 & 255) / 255.0F;
    float f = (float) (color >> 16 & 255) / 255.0F;
    float f1 = (float) (color >> 8 & 255) / 255.0F;
    float f2 = (float) (color & 255) / 255.0F;
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    GlStateManager.enableBlend();
    GlStateManager.disableTexture2D();
    GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
    GlStateManager.color(f, f1, f2, f3);
    worldrenderer.begin(7, DefaultVertexFormats.POSITION);
    worldrenderer.pos(left, bottom, 0.0D).endVertex();
    worldrenderer.pos(right, bottom, 0.0D).endVertex();
    worldrenderer.pos(right, top, 0.0D).endVertex();
    worldrenderer.pos(left, top, 0.0D).endVertex();
    tessellator.draw();
    GlStateManager.enableTexture2D();
    GlStateManager.disableBlend();
}
 
Example 13
Source File: GuiUtils.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void drawGradientRect(int zLevel, int left, int top, int right, int bottom, int startColor, int endColor) {
    float startAlpha = (float) (startColor >> 24 & 255) / 255.0F;
    float startRed = (float) (startColor >> 16 & 255) / 255.0F;
    float startGreen = (float) (startColor >> 8 & 255) / 255.0F;
    float startBlue = (float) (startColor & 255) / 255.0F;
    float endAlpha = (float) (endColor >> 24 & 255) / 255.0F;
    float endRed = (float) (endColor >> 16 & 255) / 255.0F;
    float endGreen = (float) (endColor >> 8 & 255) / 255.0F;
    float endBlue = (float) (endColor & 255) / 255.0F;

    GlStateManager.disableTexture2D();
    GlStateManager.enableBlend();
    GlStateManager.disableAlpha();
    GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
    GlStateManager.shadeModel(GL11.GL_SMOOTH);

    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
    worldrenderer.pos(right, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex();
    worldrenderer.pos(left, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex();
    worldrenderer.pos(left, bottom, zLevel).color(endRed, endGreen, endBlue, endAlpha).endVertex();
    worldrenderer.pos(right, bottom, zLevel).color(endRed, endGreen, endBlue, endAlpha).endVertex();
    tessellator.draw();

    GlStateManager.shadeModel(GL11.GL_FLAT);
    GlStateManager.disableBlend();
    GlStateManager.enableAlpha();
    GlStateManager.enableTexture2D();
}
 
Example 14
Source File: CustomCrosshair.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void drawDebugAxisCrosshair(int screenWidth, int screenHeight) {
    GlStateManager.pushMatrix();
    GlStateManager.translate((float) screenWidth, (float) screenHeight, 0.0f);
    Entity entity = mc.getRenderViewEntity();
    GlStateManager.rotate(
        entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * 1.0f,
        -1.0f, 0.0f, 0.0f);
    GlStateManager
        .rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * 1.0f,
            0.0f, 1.0f, 0.0f);
    GlStateManager.scale(-1.0f, -1.0f, -1.0f);
    GlStateManager.disableTexture2D();
    GlStateManager.depthMask(false);
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    worldrenderer.begin(GL11.GL_CLIENT_PIXEL_STORE_BIT, DefaultVertexFormats.POSITION_COLOR);
    GL11.glLineWidth(2.0f);
    worldrenderer.pos(0.0, 0.0, 0.0).color(255, 0, 0, 255).endVertex();
    worldrenderer.pos(10.0, 0.0, 0.0).color(255, 0, 0, 255).endVertex();
    worldrenderer.pos(0.0, 0.0, 0.0).color(0, 255, 0, 255).endVertex();
    worldrenderer.pos(0.0, 10.0, 0.0).color(0, 255, 0, 255).endVertex();
    worldrenderer.pos(0.0, 0.0, 0.0).color(0, 0, 255, 255).endVertex();
    worldrenderer.pos(0.0, 0.0, 10.0).color(0, 0, 255, 255).endVertex();
    tessellator.draw();
    GL11.glLineWidth(1.0f);
    GlStateManager.depthMask(true);
    GlStateManager.enableTexture2D();
    GlStateManager.popMatrix();
}
 
Example 15
Source File: MixinGuiSlot.java    From LiquidBounce with GNU General Public License v3.0 4 votes vote down vote up
/**
 * @author CCBlueX
 */
@Overwrite
public void drawScreen(int mouseXIn, int mouseYIn, float p_148128_3_) {
    if(this.field_178041_q) {
        this.mouseX = mouseXIn;
        this.mouseY = mouseYIn;
        this.drawBackground();
        int i = this.getScrollBarX();
        int j = i + 6;
        this.bindAmountScrolled();
        GlStateManager.disableLighting();
        GlStateManager.disableFog();
        Tessellator tessellator = Tessellator.getInstance();
        WorldRenderer worldrenderer = tessellator.getWorldRenderer();
        int k = this.left + this.width / 2 - this.getListWidth() / 2 + 2;
        int l = this.top + 4 - (int) this.amountScrolled;
        if(this.hasListHeader) {
            this.drawListHeader(k, l, tessellator);
        }

        this.drawSelectionBox(k, l + 2, mouseXIn, mouseYIn + 2);
        GlStateManager.disableDepth();
        int i1 = 4;

        // ClientCode
        ScaledResolution scaledResolution = new ScaledResolution(mc);
        Gui.drawRect(0, 0, scaledResolution.getScaledWidth(), this.top, Integer.MIN_VALUE);
        Gui.drawRect(0, this.bottom, scaledResolution.getScaledWidth(), this.height, Integer.MIN_VALUE);

        GlStateManager.enableBlend();
        GlStateManager.tryBlendFuncSeparate(770, 771, 0, 1);
        GlStateManager.disableAlpha();
        GlStateManager.shadeModel(7425);
        GlStateManager.disableTexture2D();
        worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
        worldrenderer.pos((double) this.left, (double) (this.top + i1), 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 0).endVertex();
        worldrenderer.pos((double) this.right, (double) (this.top + i1), 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 0).endVertex();
        worldrenderer.pos((double) this.right, (double) this.top, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex();
        worldrenderer.pos((double) this.left, (double) this.top, 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 255).endVertex();
        tessellator.draw();
        worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
        worldrenderer.pos((double) this.left, (double) this.bottom, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex();
        worldrenderer.pos((double) this.right, (double) this.bottom, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
        worldrenderer.pos((double) this.right, (double) (this.bottom - i1), 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 0).endVertex();
        worldrenderer.pos((double) this.left, (double) (this.bottom - i1), 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 0).endVertex();
        tessellator.draw();
        int j1 = this.func_148135_f();
        if(j1 > 0) {
            int k1 = (this.bottom - this.top) * (this.bottom - this.top) / this.getContentHeight();
            k1 = MathHelper.clamp_int(k1, 32, this.bottom - this.top - 8);
            int l1 = (int) this.amountScrolled * (this.bottom - this.top - k1) / j1 + this.top;
            if(l1 < this.top) {
                l1 = this.top;
            }

            worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
            worldrenderer.pos((double) i, (double) this.bottom, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex();
            worldrenderer.pos((double) j, (double) this.bottom, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
            worldrenderer.pos((double) j, (double) this.top, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex();
            worldrenderer.pos((double) i, (double) this.top, 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 255).endVertex();
            tessellator.draw();
            worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
            worldrenderer.pos((double) i, (double) (l1 + k1), 0.0D).tex(0.0D, 1.0D).color(128, 128, 128, 255).endVertex();
            worldrenderer.pos((double) j, (double) (l1 + k1), 0.0D).tex(1.0D, 1.0D).color(128, 128, 128, 255).endVertex();
            worldrenderer.pos((double) j, (double) l1, 0.0D).tex(1.0D, 0.0D).color(128, 128, 128, 255).endVertex();
            worldrenderer.pos((double) i, (double) l1, 0.0D).tex(0.0D, 0.0D).color(128, 128, 128, 255).endVertex();
            tessellator.draw();
            worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
            worldrenderer.pos((double) i, (double) (l1 + k1 - 1), 0.0D).tex(0.0D, 1.0D).color(192, 192, 192, 255).endVertex();
            worldrenderer.pos((double) (j - 1), (double) (l1 + k1 - 1), 0.0D).tex(1.0D, 1.0D).color(192, 192, 192, 255).endVertex();
            worldrenderer.pos((double) (j - 1), (double) l1, 0.0D).tex(1.0D, 0.0D).color(192, 192, 192, 255).endVertex();
            worldrenderer.pos((double) i, (double) l1, 0.0D).tex(0.0D, 0.0D).color(192, 192, 192, 255).endVertex();
            tessellator.draw();
        }

        this.func_148142_b(mouseXIn, mouseYIn);
        GlStateManager.enableTexture2D();
        GlStateManager.shadeModel(7424);
        GlStateManager.enableAlpha();
        GlStateManager.disableBlend();
    }
}
 
Example 16
Source File: RenderUtils.java    From LiquidBounce with GNU General Public License v3.0 4 votes vote down vote up
public static void drawFilledBox(final AxisAlignedBB axisAlignedBB) {
    final Tessellator tessellator = Tessellator.getInstance();
    final WorldRenderer worldRenderer = tessellator.getWorldRenderer();

    worldRenderer.begin(7, DefaultVertexFormats.POSITION);
    worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
    worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
    worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
    worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
    worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
    worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
    worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
    worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();

    worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
    worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
    worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
    worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
    worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
    worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
    worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
    worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();

    worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
    worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
    worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
    worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
    worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
    worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
    worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
    worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();

    worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
    worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
    worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
    worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
    worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
    worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
    worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
    worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();

    worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
    worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
    worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
    worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
    worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
    worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
    worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
    worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();

    worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
    worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
    worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
    worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
    worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ).endVertex();
    worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ).endVertex();
    worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ).endVertex();
    worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ).endVertex();
    tessellator.draw();
}
 
Example 17
Source File: MixinGuiSlot.java    From LiquidBounce with GNU General Public License v3.0 4 votes vote down vote up
/**
 * @author CCBlueX
 */
@Overwrite
public void drawScreen(int mouseXIn, int mouseYIn, float p_148128_3_) {
    if(this.field_178041_q) {
        this.mouseX = mouseXIn;
        this.mouseY = mouseYIn;
        this.drawBackground();
        int i = this.getScrollBarX();
        int j = i + 6;
        this.bindAmountScrolled();
        GlStateManager.disableLighting();
        GlStateManager.disableFog();
        Tessellator tessellator = Tessellator.getInstance();
        WorldRenderer worldrenderer = tessellator.getWorldRenderer();
        int k = this.left + this.width / 2 - this.getListWidth() / 2 + 2;
        int l = this.top + 4 - (int) this.amountScrolled;
        if (this.hasListHeader) {
            this.drawListHeader(k, l, tessellator);
        }

        RenderUtils.makeScissorBox(left, top, right, bottom);

        GL11.glEnable(GL11.GL_SCISSOR_TEST);

        this.drawSelectionBox(k, l + 2, mouseXIn, mouseYIn + 2);

        GL11.glDisable(GL11.GL_SCISSOR_TEST);

        GlStateManager.disableDepth();
        int i1 = 4;

        // ClientCode
        ScaledResolution scaledResolution = new ScaledResolution(mc);
        Gui.drawRect(0, 0, scaledResolution.getScaledWidth(), this.top, Integer.MIN_VALUE);
        Gui.drawRect(0, this.bottom, scaledResolution.getScaledWidth(), this.height, Integer.MIN_VALUE);

        GlStateManager.enableBlend();
        GlStateManager.tryBlendFuncSeparate(770, 771, 0, 1);
        GlStateManager.disableAlpha();
        GlStateManager.shadeModel(7425);
        GlStateManager.disableTexture2D();
        worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
        worldrenderer.pos(this.left, this.top + i1, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 0).endVertex();
        worldrenderer.pos(this.right, this.top + i1, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 0).endVertex();
        worldrenderer.pos(this.right, this.top, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex();
        worldrenderer.pos(this.left, this.top, 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 255).endVertex();
        tessellator.draw();
        worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
        worldrenderer.pos(this.left, this.bottom, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex();
        worldrenderer.pos(this.right, this.bottom, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
        worldrenderer.pos(this.right, this.bottom - i1, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 0).endVertex();
        worldrenderer.pos(this.left, this.bottom - i1, 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 0).endVertex();
        tessellator.draw();
        int j1 = this.func_148135_f();
        if (j1 > 0) {
            int k1 = (this.bottom - this.top) * (this.bottom - this.top) / this.getContentHeight();
            k1 = MathHelper.clamp_int(k1, 32, this.bottom - this.top - 8);
            int l1 = (int) this.amountScrolled * (this.bottom - this.top - k1) / j1 + this.top;
            if (l1 < this.top) {
                l1 = this.top;
            }

            worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
            worldrenderer.pos(i, this.bottom, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex();
            worldrenderer.pos(j, this.bottom, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
            worldrenderer.pos(j, this.top, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex();
            worldrenderer.pos(i, this.top, 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 255).endVertex();
            tessellator.draw();
            worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
            worldrenderer.pos(i, l1 + k1, 0.0D).tex(0.0D, 1.0D).color(128, 128, 128, 255).endVertex();
            worldrenderer.pos(j, l1 + k1, 0.0D).tex(1.0D, 1.0D).color(128, 128, 128, 255).endVertex();
            worldrenderer.pos(j, l1, 0.0D).tex(1.0D, 0.0D).color(128, 128, 128, 255).endVertex();
            worldrenderer.pos(i, l1, 0.0D).tex(0.0D, 0.0D).color(128, 128, 128, 255).endVertex();
            tessellator.draw();
            worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
            worldrenderer.pos(i, l1 + k1 - 1, 0.0D).tex(0.0D, 1.0D).color(192, 192, 192, 255).endVertex();
            worldrenderer.pos(j - 1, l1 + k1 - 1, 0.0D).tex(1.0D, 1.0D).color(192, 192, 192, 255).endVertex();
            worldrenderer.pos(j - 1, l1, 0.0D).tex(1.0D, 0.0D).color(192, 192, 192, 255).endVertex();
            worldrenderer.pos(i, l1, 0.0D).tex(0.0D, 0.0D).color(192, 192, 192, 255).endVertex();
            tessellator.draw();
        }

        this.func_148142_b(mouseXIn, mouseYIn);
        GlStateManager.enableTexture2D();
        GlStateManager.shadeModel(7424);
        GlStateManager.enableAlpha();
        GlStateManager.disableBlend();
    }
}
 
Example 18
Source File: HyperiumRendererLivingEntity.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void renderName(T entity, double x, double y, double z, RenderManager renderManager) {
    if (((IMixinRendererLivingEntity<T>) parent).callCanRenderName(entity)) {

        double d0 = entity.getDistanceSqToEntity(renderManager.livingPlayer);
        float f = entity.isSneaking() ? 32.0F : 64.0F;

        if (d0 < (double) (f * f)) {
            String s = entity.getDisplayName().getFormattedText();
            GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F);

            if (entity.isSneaking() && (Settings.SHOW_OWN_NAME || !entity.equals(Minecraft.getMinecraft().thePlayer))) {
                FontRenderer fontrenderer = renderManager.getFontRenderer();
                GlStateManager.pushMatrix();
                float offset = Utils.INSTANCE.calculateDeadmauEarsOffset(entity);
                GlStateManager.translate((float) x, (float) y + offset + entity.height + 0.5F - (entity.isChild() ? entity.height / 2.0F : 0.0F), (float) z);
                GL11.glNormal3f(0.0F, 1.0F, 0.0F);
                GlStateManager.rotate(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
                GlStateManager.rotate(renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
                GlStateManager.scale(-0.02666667F, -0.02666667F, 0.02666667F);
                GlStateManager.translate(0.0F, 9.374999F, 0.0F);
                GlStateManager.disableLighting();
                GlStateManager.depthMask(false);
                GlStateManager.enableBlend();
                GlStateManager.disableTexture2D();
                GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
                int i = fontrenderer.getStringWidth(s) / 2;
                Tessellator tessellator = Tessellator.getInstance();
                WorldRenderer worldrenderer = tessellator.getWorldRenderer();
                worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
                worldrenderer.pos(-i - 1, -1.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
                worldrenderer.pos(-i - 1, 8.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
                worldrenderer.pos(i + 1, 8.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
                worldrenderer.pos(i + 1, -1.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
                tessellator.draw();
                GlStateManager.enableTexture2D();
                GlStateManager.depthMask(true);
                fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, 0, 553648127);
                GlStateManager.enableLighting();
                GlStateManager.disableBlend();
                GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
                GlStateManager.popMatrix();
            } else {
                ((IMixinRender<T>) parent).callRenderOffsetLivingLabel(entity, x, y - (entity.isChild() ? (double)
                    (entity.height / 2.0F) : 0.0D), z, s, 0.02666667F, d0);
            }
        }
    }
}
 
Example 19
Source File: YeetHandler.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
@InvokeEvent
public void render(RenderEntitiesEvent event) {
    for (Yeet yeet : yeets) {
        RenderManager renderManager = Minecraft.getMinecraft().getRenderManager();
        FontRenderer fontrenderer = renderManager.getFontRenderer();
        float f = 1.6F;
        float f1 = 0.016666668F * f;
        GlStateManager.pushMatrix();
        EntityPlayerSP entity = Minecraft.getMinecraft().thePlayer;
        float partialTicks = event.getPartialTicks();

        double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double) partialTicks;
        double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double) partialTicks;
        double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double) partialTicks;

        EntityPlayer sender = yeet.sender;
        if (sender == null) continue;
        double e0 = yeet.sender.lastTickPosX + (yeet.sender.posX - yeet.sender.lastTickPosX) * (double) partialTicks;
        double e1 = yeet.sender.lastTickPosY + (yeet.sender.posY - yeet.sender.lastTickPosY) * (double) partialTicks;
        double e2 = yeet.sender.lastTickPosZ + (yeet.sender.posZ - yeet.sender.lastTickPosZ) * (double) partialTicks;


        GlStateManager.translate(e0 - d0, e1 - d1, e2 - d2);
        GlStateManager.translate(0, 3, 0);

        GL11.glNormal3f(0.0F, 1.0F, 0.0F);
        GlStateManager.rotate(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F);

        int xMultiplier = 1; // Nametag x rotations should flip in front-facing 3rd person

        if (Minecraft.getMinecraft() != null && Minecraft.getMinecraft().gameSettings != null && Minecraft.getMinecraft().gameSettings.thirdPersonView == 2) {
            xMultiplier = -1;
        }

        GlStateManager.rotate(renderManager.playerViewX * xMultiplier, 1.0F, 0.0F, 0.0F);
        GlStateManager.scale(-f1, -f1, f1);
        GlStateManager.disableLighting();
        GlStateManager.depthMask(false);
        GlStateManager.disableDepth();
        GlStateManager.enableBlend();
        GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
        Tessellator tessellator = Tessellator.getInstance();
        WorldRenderer worldrenderer = tessellator.getWorldRenderer();
        int i = 0;

        String string = "YEET";
        int j = fontrenderer.getStringWidth(string) / 2;
        GlStateManager.disableTexture2D();
        GlStateManager.scale(4, 4, 4);
        worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
        worldrenderer.pos(-j - 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
        worldrenderer.pos(-j - 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
        worldrenderer.pos(j + 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
        worldrenderer.pos(j + 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
        tessellator.draw();
        GlStateManager.enableTexture2D();

        fontrenderer.drawString(string, -j, 0, 16777215, true);
        GlStateManager.enableLighting();
        GlStateManager.disableBlend();
        GlStateManager.depthMask(true);
        GlStateManager.enableDepth();
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        GlStateManager.popMatrix();
    }
}
 
Example 20
Source File: BlockOverlayRender.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void drawFilledBoundingBox(AxisAlignedBB box) {
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldRenderer = tessellator.getWorldRenderer();

    worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
    worldRenderer.pos(box.minX, box.minY, box.minZ).endVertex();
    worldRenderer.pos(box.minX, box.maxY, box.minZ).endVertex();
    worldRenderer.pos(box.maxX, box.minY, box.minZ).endVertex();
    worldRenderer.pos(box.maxX, box.maxY, box.minZ).endVertex();
    worldRenderer.pos(box.maxX, box.minY, box.maxZ).endVertex();
    worldRenderer.pos(box.maxX, box.maxY, box.maxZ).endVertex();
    worldRenderer.pos(box.minX, box.minY, box.maxZ).endVertex();
    worldRenderer.pos(box.minX, box.maxY, box.maxZ).endVertex();
    tessellator.draw();

    worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
    worldRenderer.pos(box.maxX, box.maxY, box.minZ).endVertex();
    worldRenderer.pos(box.maxX, box.minY, box.minZ).endVertex();
    worldRenderer.pos(box.minX, box.maxY, box.minZ).endVertex();
    worldRenderer.pos(box.minX, box.minY, box.minZ).endVertex();
    worldRenderer.pos(box.minX, box.maxY, box.maxZ).endVertex();
    worldRenderer.pos(box.minX, box.minY, box.maxZ).endVertex();
    worldRenderer.pos(box.maxX, box.maxY, box.maxZ).endVertex();
    worldRenderer.pos(box.maxX, box.minY, box.maxZ).endVertex();
    tessellator.draw();

    worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
    worldRenderer.pos(box.minX, box.maxY, box.minZ).endVertex();
    worldRenderer.pos(box.maxX, box.maxY, box.minZ).endVertex();
    worldRenderer.pos(box.maxX, box.maxY, box.maxZ).endVertex();
    worldRenderer.pos(box.minX, box.maxY, box.maxZ).endVertex();
    worldRenderer.pos(box.minX, box.maxY, box.minZ).endVertex();
    worldRenderer.pos(box.minX, box.maxY, box.maxZ).endVertex();
    worldRenderer.pos(box.maxX, box.maxY, box.maxZ).endVertex();
    worldRenderer.pos(box.maxX, box.maxY, box.minZ).endVertex();
    tessellator.draw();

    worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
    worldRenderer.pos(box.minX, box.minY, box.minZ).endVertex();
    worldRenderer.pos(box.maxX, box.minY, box.minZ).endVertex();
    worldRenderer.pos(box.maxX, box.minY, box.maxZ).endVertex();
    worldRenderer.pos(box.minX, box.minY, box.maxZ).endVertex();
    worldRenderer.pos(box.minX, box.minY, box.minZ).endVertex();
    worldRenderer.pos(box.minX, box.minY, box.maxZ).endVertex();
    worldRenderer.pos(box.maxX, box.minY, box.maxZ).endVertex();
    worldRenderer.pos(box.maxX, box.minY, box.minZ).endVertex();
    tessellator.draw();

    worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
    worldRenderer.pos(box.minX, box.minY, box.minZ).endVertex();
    worldRenderer.pos(box.minX, box.maxY, box.minZ).endVertex();
    worldRenderer.pos(box.minX, box.minY, box.maxZ).endVertex();
    worldRenderer.pos(box.minX, box.maxY, box.maxZ).endVertex();
    worldRenderer.pos(box.maxX, box.minY, box.maxZ).endVertex();
    worldRenderer.pos(box.maxX, box.maxY, box.maxZ).endVertex();
    worldRenderer.pos(box.maxX, box.minY, box.minZ).endVertex();
    worldRenderer.pos(box.maxX, box.maxY, box.minZ).endVertex();
    tessellator.draw();

    worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
    worldRenderer.pos(box.minX, box.maxY, box.maxZ).endVertex();
    worldRenderer.pos(box.minX, box.minY, box.maxZ).endVertex();
    worldRenderer.pos(box.minX, box.maxY, box.minZ).endVertex();
    worldRenderer.pos(box.minX, box.minY, box.minZ).endVertex();
    worldRenderer.pos(box.maxX, box.maxY, box.minZ).endVertex();
    worldRenderer.pos(box.maxX, box.minY, box.minZ).endVertex();
    worldRenderer.pos(box.maxX, box.maxY, box.maxZ).endVertex();
    worldRenderer.pos(box.maxX, box.minY, box.maxZ).endVertex();
    tessellator.draw();
}