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

The following examples show how to use net.minecraft.client.renderer.Tessellator#addVertex() . 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: Render.java    From mapwriter with MIT License 7 votes vote down vote up
public static void drawCircleBorder(double x, double y, double r, double width) {
	GL11.glEnable(GL11.GL_BLEND);
       GL11.glDisable(GL11.GL_TEXTURE_2D);
       GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	Tessellator tes = Tessellator.instance;
       tes.startDrawing(GL11.GL_TRIANGLE_STRIP);
       // for some the circle is only drawn if theta is decreasing rather than ascending
       double end = Math.PI * 2.0;
       double incr = end / circleSteps;
       double r2 = r + width;
       for (double theta = -incr; theta < end; theta += incr) {
       	tes.addVertex(x + (r * Math.cos(-theta)), y + (r * Math.sin(-theta)), zDepth);
       	tes.addVertex(x + (r2 * Math.cos(-theta)), y + (r2 * Math.sin(-theta)), zDepth);
       }
       tes.draw();
       GL11.glEnable(GL11.GL_TEXTURE_2D);
       GL11.glDisable(GL11.GL_BLEND);
}
 
Example 2
Source File: RenderBlockArrows.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
private void drawArrow(float progress){
    double arrowBaseWidth = 0.4D;
    double arrowBaseLength = 0.8D;
    double arrowLength = 1.5D;
    double arrowWidth = 0.7D;
    double scale = 0.1D;
    GL11.glPushMatrix();
    GL11.glScaled(scale, scale, scale);
    GL11.glTranslatef(0, progress * 4, 0);
    Tessellator tess = Tessellator.instance;
    tess.startDrawing(GL11.GL_LINE_STRIP);
    tess.addVertex(-arrowBaseWidth, -arrowLength * 0.5D, 0);
    tess.addVertex(-arrowBaseWidth, -arrowLength * 0.5D + arrowBaseLength, 0);
    tess.addVertex(-arrowWidth, -arrowLength * 0.5D + arrowBaseLength, 0);
    tess.addVertex(0, arrowLength * 0.5D, 0);
    tess.addVertex(arrowWidth, -arrowLength * 0.5D + arrowBaseLength, 0);
    tess.addVertex(arrowBaseWidth, -arrowLength * 0.5D + arrowBaseLength, 0);
    tess.addVertex(arrowBaseWidth, -arrowLength * 0.5D, 0);
    tess.draw();
    GL11.glPopMatrix();
}
 
Example 3
Source File: RenderRing.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@SideOnly(Side.CLIENT)
public void renderInterpolated(RenderProgressingLine lastTickLine, float partialTick, float rotationYaw, float rotationPitch){
    GL11.glPushMatrix();
    double renderProgress = getInter(progress, lastTickLine.progress, partialTick);
    GL11.glTranslated((getInter(endX, lastTickLine.endX, partialTick) - startX) * renderProgress, (getInter(endY, lastTickLine.endY, partialTick) - startY) * renderProgress, (getInter(endZ, lastTickLine.endZ, partialTick) - startZ) * renderProgress);
    GL11.glRotatef(rotationYaw, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(rotationPitch, 0.0F, 0.0F, 1.0F);
    Tessellator tess = Tessellator.instance;
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    tess.startDrawing(GL11.GL_LINE_LOOP);
    tess.setColorOpaque_I(color);
    double size = 5 / 16D;
    for(int i = 0; i < PneumaticCraftUtils.circlePoints; i++) {
        tess.addVertex(0, PneumaticCraftUtils.sin[i] * size, PneumaticCraftUtils.cos[i] * size);
    }
    tess.draw();
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
    GL11.glPopMatrix();
}
 
Example 4
Source File: ModelVacuumPump.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
private void drawPlusAndMinus(){
    double scale = 0.05D;
    GL11.glPushMatrix();
    GL11.glTranslated(0.26D, 13.95D / 16D, 0);
    GL11.glRotated(90, 1, 0, 0);
    GL11.glScaled(scale, scale, scale);
    GL11.glColor4d(0, 1, 0, 1);
    Tessellator tess = Tessellator.instance;
    tess.startDrawing(GL11.GL_LINES);
    tess.addVertex(-1, 0, 0);
    tess.addVertex(1, 0, 0);
    tess.addVertex(0, -1, 0);
    tess.addVertex(0, 1, 0);
    tess.draw();
    GL11.glTranslated(-0.52D / scale, 0, 0);
    GL11.glColor4d(1, 0, 0, 1);
    tess.startDrawing(GL11.GL_LINES);
    tess.addVertex(-1, 0, 0);
    tess.addVertex(1, 0, 0);
    tess.draw();
    GL11.glPopMatrix();
}
 
Example 5
Source File: GuiTextField.java    From ehacks-pro with GNU General Public License v3.0 6 votes vote down vote up
private void drawCursorVertical(int par1, int par2, int par3, int par4) {
    int var5;
    if (par1 < par3) {
        var5 = par1;
        par1 = par3;
        par3 = var5;
    }
    if (par2 < par4) {
        var5 = par2;
        par2 = par4;
        par4 = var5;
    }
    Tessellator var6 = Tessellator.instance;
    GL11.glColor4f(0.0f, 0.0f, 255.0f, 255.0f);
    GL11.glDisable(3553);
    GL11.glEnable(3058);
    GL11.glLogicOp(5387);
    var6.startDrawingQuads();
    var6.addVertex(par1, par4, 0.0);
    var6.addVertex(par3, par4, 0.0);
    var6.addVertex(par3, par2, 0.0);
    var6.addVertex(par1, par2, 0.0);
    var6.draw();
    GL11.glDisable(3058);
    GL11.glEnable(3553);
}
 
Example 6
Source File: GuiRadioButton.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
private void drawCircle(int x, int y, int radius, int color){
    Tessellator t = Tessellator.instance;
    float f = (color >> 24 & 255) / 255.0F;
    float f1 = (color >> 16 & 255) / 255.0F;
    float f2 = (color >> 8 & 255) / 255.0F;
    float f3 = (color & 255) / 255.0F;
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(f1, f2, f3, f);
    t.startDrawing(GL11.GL_TRIANGLE_FAN);
    int points = 20;
    for(int i = 0; i < points; i++) {
        double sin = Math.sin((double)i / points * Math.PI * 2);
        double cos = Math.cos((double)i / points * Math.PI * 2);
        t.addVertex(x + sin * radius, y + cos * radius, zLevel);
    }
    t.draw();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
}
 
Example 7
Source File: Render.java    From mapwriter with MIT License 5 votes vote down vote up
public static void drawTriangle(double x1, double y1, double x2, double y2, double x3, double y3) {
       GL11.glEnable(GL11.GL_BLEND);
       GL11.glDisable(GL11.GL_TEXTURE_2D);
       GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
       Tessellator tes = Tessellator.instance;
       tes.startDrawing(GL11.GL_TRIANGLES);
       tes.addVertex(x1, y1, zDepth);
       tes.addVertex(x2, y2, zDepth);
       tes.addVertex(x3, y3, zDepth);
       tes.draw();
       GL11.glEnable(GL11.GL_TEXTURE_2D);
       GL11.glDisable(GL11.GL_BLEND);
}
 
Example 8
Source File: Render.java    From mapwriter with MIT License 5 votes vote down vote up
public static void drawRect(double x, double y, double w, double h) {
	GL11.glEnable(GL11.GL_BLEND);
       GL11.glDisable(GL11.GL_TEXTURE_2D);
       GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	Tessellator tes = Tessellator.instance;
       tes.startDrawingQuads();
       tes.addVertex(x + w, y,     zDepth);
       tes.addVertex(x,     y,     zDepth);
	tes.addVertex(x,     y + h, zDepth);
	tes.addVertex(x + w, y + h, zDepth);
       tes.draw();
       GL11.glEnable(GL11.GL_TEXTURE_2D);
       GL11.glDisable(GL11.GL_BLEND);
}
 
Example 9
Source File: RenderElevatorCaller.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f){
    TileEntityElevatorCaller tile = (TileEntityElevatorCaller)tileentity;
    Tessellator tess = Tessellator.instance;
    GL11.glPushMatrix();
    GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
    GL11.glScalef(1.0F, -1F, -1F);
    // GL11.glRotated(180, 0, 0, 1);
    PneumaticCraftUtils.rotateMatrixByMetadata(tileentity.getBlockMetadata());
    GL11.glTranslatef(-1, 0, -1);

    for(TileEntityElevatorCaller.ElevatorButton button : tile.getFloors()) {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_LIGHTING);
        tess.startDrawingQuads();
        tess.setColorRGBA_F(button.red, button.green, button.blue, 1F);
        tess.addVertex(button.posX + 0.5D, button.posY + 0.5D, 0.499D);
        tess.addVertex(button.posX + 0.5D, button.posY + button.height + 0.5D, 0.499D);
        tess.addVertex(button.posX + button.width + 0.5D, button.posY + button.height + 0.5D, 0.499D);
        tess.addVertex(button.posX + button.width + 0.5D, button.posY + 0.5D, 0.499D);
        tess.draw();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_LIGHTING);

        GL11.glPushMatrix();
        GL11.glTranslated(button.posX + 0.5D, button.posY + 0.5D, 0.498);
        GL11.glTranslated(button.width / 2, button.height / 2, 0);
        float textScale = Math.min((float)button.width / 10F, (float)button.height / 10F);
        GL11.glScalef(textScale, textScale, textScale);
        func_147498_b().drawString(button.buttonText, -func_147498_b().getStringWidth(button.buttonText) / 2, -func_147498_b().FONT_HEIGHT / 2, 0xFF000000);
        GL11.glPopMatrix();
    }
    GL11.glPopMatrix();
}
 
Example 10
Source File: BeefGuiControlBase.java    From BigReactors with MIT License 5 votes vote down vote up
protected static void drawRect(int xMin, int yMin, int xMax, int yMax, float r, float g, float b, float a)
{
	int temp;

	if (xMax < xMin) {
		temp = xMin;
		xMin = xMax;
		xMax = temp;
	}

	if (yMax < yMin) {
		temp = yMin;
		yMin = yMax;
		yMax = temp;
	}

	Tessellator tessellator = Tessellator.instance;
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glColor4f(r, g, b, a);
	tessellator.startDrawingQuads();
	tessellator.addVertex(xMin, yMax, 0.0D);
	tessellator.addVertex(xMax, yMax, 0.0D);
	tessellator.addVertex(xMax, yMin, 0.0D);
	tessellator.addVertex(xMin, yMin, 0.0D);
	tessellator.draw();
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
}
 
Example 11
Source File: GuiTextField.java    From NBTEdit with GNU General Public License v3.0 5 votes vote down vote up
/**
 * draws the vertical line cursor in the textbox
 */
private void drawCursorVertical(int par1, int par2, int par3, int par4)
{
 int var5;

 if (par1 < par3)
 {
	 var5 = par1;
	 par1 = par3;
	 par3 = var5;
 }

 if (par2 < par4)
 {
	 var5 = par2;
	 par2 = par4;
	 par4 = var5;
 }

 Tessellator var6 = Tessellator.instance;
 GL11.glColor4f(0.0F, 0.0F, 255.0F, 255.0F);
 GL11.glDisable(GL11.GL_TEXTURE_2D);
 GL11.glEnable(GL11.GL_COLOR_LOGIC_OP);
 GL11.glLogicOp(GL11.GL_OR_REVERSE);
 var6.startDrawingQuads();
 var6.addVertex((double)par1, (double)par4, 0.0D);
 var6.addVertex((double)par3, (double)par4, 0.0D);
 var6.addVertex((double)par3, (double)par2, 0.0D);
 var6.addVertex((double)par1, (double)par2, 0.0D);
 var6.draw();
 GL11.glDisable(GL11.GL_COLOR_LOGIC_OP);
 GL11.glEnable(GL11.GL_TEXTURE_2D);
}
 
Example 12
Source File: GLUtils.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
public static void drawOutlinedBoundingBox(AltAxisAlignedBB par1AxisAlignedBB) {

        Tessellator var2 = Tessellator.instance;
        var2.startDrawing(3);
        var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ);
        var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ);
        var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ);
        var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ);
        var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ);
        var2.draw();
        var2.startDrawing(3);
        var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ);
        var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ);
        var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ);
        var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ);
        var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ);
        var2.draw();
        var2.startDrawing(1);
        var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ);
        var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ);
        var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ);
        var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ);
        var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ);
        var2.addVertex(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ);
        var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ);
        var2.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ);
        var2.draw();
    }
 
Example 13
Source File: ShowArmor.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
private void drawGradientRect(int p_73733_1_, int p_73733_2_, int p_73733_3_, int p_73733_4_, int p_73733_5_, int p_73733_6_) {
    float f = (p_73733_5_ >> 24 & 255) / 255.0F;
    float f1 = (p_73733_5_ >> 16 & 255) / 255.0F;
    float f2 = (p_73733_5_ >> 8 & 255) / 255.0F;
    float f3 = (p_73733_5_ & 255) / 255.0F;
    float f4 = (p_73733_6_ >> 24 & 255) / 255.0F;
    float f5 = (p_73733_6_ >> 16 & 255) / 255.0F;
    float f6 = (p_73733_6_ >> 8 & 255) / 255.0F;
    float f7 = (p_73733_6_ & 255) / 255.0F;
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    OpenGlHelper.glBlendFunc(770, 771, 1, 0);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();
    tessellator.setColorRGBA_F(f1, f2, f3, f);
    tessellator.addVertex(p_73733_3_, p_73733_2_, 300f);
    tessellator.addVertex(p_73733_1_, p_73733_2_, 300f);
    tessellator.setColorRGBA_F(f5, f6, f7, f4);
    tessellator.addVertex(p_73733_1_, p_73733_4_, 300f);
    tessellator.addVertex(p_73733_3_, p_73733_4_, 300f);
    tessellator.draw();
    GL11.glShadeModel(GL11.GL_FLAT);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
}
 
Example 14
Source File: RenderProgressingLine.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@SideOnly(Side.CLIENT)
public void render(){
    Tessellator tess = Tessellator.instance;
    tess.startDrawing(GL11.GL_LINES);
    tess.addVertex(startX, startY, startZ);
    tess.addVertex(startX + (endX - startX) * progress, startY + (endY - startY) * progress, startZ + (endZ - startZ) * progress);
    tess.draw();
}
 
Example 15
Source File: SemiBlockRendererLogistics.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
public static void renderOffsetAABB(AxisAlignedBB p_76978_0_, double p_76978_1_, double p_76978_3_, double p_76978_5_){
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();
    tessellator.setTranslation(p_76978_1_, p_76978_3_, p_76978_5_);
    tessellator.setNormal(0.0F, 0.0F, -1.0F);
    tessellator.addVertex(p_76978_0_.minX, p_76978_0_.maxY, p_76978_0_.minZ);
    tessellator.addVertex(p_76978_0_.maxX, p_76978_0_.maxY, p_76978_0_.minZ);
    tessellator.addVertex(p_76978_0_.maxX, p_76978_0_.minY, p_76978_0_.minZ);
    tessellator.addVertex(p_76978_0_.minX, p_76978_0_.minY, p_76978_0_.minZ);
    tessellator.setNormal(0.0F, 0.0F, 1.0F);
    tessellator.addVertex(p_76978_0_.minX, p_76978_0_.minY, p_76978_0_.maxZ);
    tessellator.addVertex(p_76978_0_.maxX, p_76978_0_.minY, p_76978_0_.maxZ);
    tessellator.addVertex(p_76978_0_.maxX, p_76978_0_.maxY, p_76978_0_.maxZ);
    tessellator.addVertex(p_76978_0_.minX, p_76978_0_.maxY, p_76978_0_.maxZ);
    tessellator.setNormal(0.0F, -1.0F, 0.0F);
    tessellator.addVertex(p_76978_0_.minX, p_76978_0_.minY, p_76978_0_.minZ);
    tessellator.addVertex(p_76978_0_.maxX, p_76978_0_.minY, p_76978_0_.minZ);
    tessellator.addVertex(p_76978_0_.maxX, p_76978_0_.minY, p_76978_0_.maxZ);
    tessellator.addVertex(p_76978_0_.minX, p_76978_0_.minY, p_76978_0_.maxZ);
    tessellator.setNormal(0.0F, 1.0F, 0.0F);
    tessellator.addVertex(p_76978_0_.minX, p_76978_0_.maxY, p_76978_0_.maxZ);
    tessellator.addVertex(p_76978_0_.maxX, p_76978_0_.maxY, p_76978_0_.maxZ);
    tessellator.addVertex(p_76978_0_.maxX, p_76978_0_.maxY, p_76978_0_.minZ);
    tessellator.addVertex(p_76978_0_.minX, p_76978_0_.maxY, p_76978_0_.minZ);
    tessellator.setNormal(-1.0F, 0.0F, 0.0F);
    tessellator.addVertex(p_76978_0_.minX, p_76978_0_.minY, p_76978_0_.maxZ);
    tessellator.addVertex(p_76978_0_.minX, p_76978_0_.maxY, p_76978_0_.maxZ);
    tessellator.addVertex(p_76978_0_.minX, p_76978_0_.maxY, p_76978_0_.minZ);
    tessellator.addVertex(p_76978_0_.minX, p_76978_0_.minY, p_76978_0_.minZ);
    tessellator.setNormal(1.0F, 0.0F, 0.0F);
    tessellator.addVertex(p_76978_0_.maxX, p_76978_0_.minY, p_76978_0_.minZ);
    tessellator.addVertex(p_76978_0_.maxX, p_76978_0_.maxY, p_76978_0_.minZ);
    tessellator.addVertex(p_76978_0_.maxX, p_76978_0_.maxY, p_76978_0_.maxZ);
    tessellator.addVertex(p_76978_0_.maxX, p_76978_0_.minY, p_76978_0_.maxZ);
    tessellator.setTranslation(0.0D, 0.0D, 0.0D);
    tessellator.draw();
}
 
Example 16
Source File: MoCRenderDolphin.java    From mocreaturesdev with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void doRenderLiving(EntityLiving entityliving, double d, double d1, double d2, float f, float f1)
{
    MoCEntityDolphin entitydolphin = (MoCEntityDolphin) entityliving;
    super.doRenderLiving(entitydolphin, d, d1, d2, f, f1);
    boolean flag = MoCreatures.proxy.getDisplayPetName() && !(entitydolphin.getName()).isEmpty();
    boolean flag1 = MoCreatures.proxy.getDisplayPetHealth();
    //boolean flag2 = MoCreatures.proxy.getdisplayPetIcons();
    if (entitydolphin.renderName())
    {
        float f2 = 1.6F;
        float f3 = 0.01666667F * f2;
        float f4 = entitydolphin.getDistanceToEntity(renderManager.livingPlayer);
        if (f4 < 16F)
        {
            String s = "";
            s = (new StringBuilder()).append(s).append(entitydolphin.getName()).toString();
            float f5 = 0.1F;
            FontRenderer fontrenderer = getFontRendererFromRenderManager();
            GL11.glPushMatrix();
            GL11.glTranslatef((float) d + 0.0F, (float) d1 + f5, (float) d2);
            GL11.glNormal3f(0.0F, 1.0F, 0.0F);
            GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
            GL11.glScalef(-f3, -f3, f3);
            GL11.glDisable(2896 /* GL_LIGHTING */);
            Tessellator tessellator = Tessellator.instance;
            byte byte0 = -50;
            if (flag1)
            {
                GL11.glDisable(3553 /* GL_TEXTURE_2D */);
                if (!flag)
                {
                    byte0 += 8;
                }
                tessellator.startDrawingQuads();
                // might break SSP
                float f6 = entitydolphin.getHealth();
                // maxhealth is always 30 for dolphins so we do not need to use a datawatcher
                float f7 = entitydolphin.getMaxHealth();
                float f8 = f6 / f7;
                float f9 = 40F * f8;
                tessellator.setColorRGBA_F(0.7F, 0.0F, 0.0F, 1.0F);
                tessellator.addVertex(-20F + f9, -10 + byte0, 0.0D);
                tessellator.addVertex(-20F + f9, -6 + byte0, 0.0D);
                tessellator.addVertex(20D, -6 + byte0, 0.0D);
                tessellator.addVertex(20D, -10 + byte0, 0.0D);
                tessellator.setColorRGBA_F(0.0F, 0.7F, 0.0F, 1.0F);
                tessellator.addVertex(-20D, -10 + byte0, 0.0D);
                tessellator.addVertex(-20D, -6 + byte0, 0.0D);
                tessellator.addVertex(f9 - 20F, -6 + byte0, 0.0D);
                tessellator.addVertex(f9 - 20F, -10 + byte0, 0.0D);
                tessellator.draw();
                GL11.glEnable(3553 /* GL_TEXTURE_2D */);
            }
            if (flag)
            {
                GL11.glDepthMask(false);
                GL11.glDisable(2929 /* GL_DEPTH_TEST */);
                GL11.glEnable(3042 /* GL_BLEND */);
                GL11.glBlendFunc(770, 771);
                GL11.glDisable(3553 /* GL_TEXTURE_2D */);
                tessellator.startDrawingQuads();
                int i = fontrenderer.getStringWidth(s) / 2;
                tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
                tessellator.addVertex(-i - 1, -1 + byte0, 0.0D);
                tessellator.addVertex(-i - 1, 8 + byte0, 0.0D);
                tessellator.addVertex(i + 1, 8 + byte0, 0.0D);
                tessellator.addVertex(i + 1, -1 + byte0, 0.0D);
                tessellator.draw();
                GL11.glEnable(3553 /* GL_TEXTURE_2D */);
                fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, 0x20ffffff);
                GL11.glEnable(2929 /* GL_DEPTH_TEST */);
                GL11.glDepthMask(true);
                fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, -1);
                GL11.glDisable(3042 /* GL_BLEND */);
                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            }
            GL11.glEnable(2896 /* GL_LIGHTING */);
            GL11.glPopMatrix();
        }
    }
}
 
Example 17
Source File: ClientProxy.java    From NBTEdit with GNU General Public License v3.0 4 votes vote down vote up
private void drawBoundingBox(RenderGlobal r, float f, AxisAlignedBB aabb) {
	if (aabb == null)
		return;

	EntityLivingBase player = Minecraft.getMinecraft().renderViewEntity;

	double var8 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)f;
	double var10 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)f;
	double var12 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)f;

	aabb = aabb.getOffsetBoundingBox(-var8, -var10, -var12);

	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glColor4f(1.0F, 0.0F, 0.0F, .5F);
	GL11.glLineWidth(3.5F);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glDepthMask(false);

	Tessellator var2 = Tessellator.instance;

	var2.startDrawing(3);
	var2.addVertex(aabb.minX, aabb.minY, aabb.minZ);
	var2.addVertex(aabb.maxX, aabb.minY, aabb.minZ);
	var2.addVertex(aabb.maxX, aabb.minY, aabb.maxZ);
	var2.addVertex(aabb.minX, aabb.minY, aabb.maxZ);
	var2.addVertex(aabb.minX, aabb.minY, aabb.minZ);
	var2.draw();
	var2.startDrawing(3);
	var2.addVertex(aabb.minX, aabb.maxY, aabb.minZ);
	var2.addVertex(aabb.maxX, aabb.maxY, aabb.minZ);
	var2.addVertex(aabb.maxX, aabb.maxY, aabb.maxZ);
	var2.addVertex(aabb.minX, aabb.maxY, aabb.maxZ);
	var2.addVertex(aabb.minX, aabb.maxY, aabb.minZ);
	var2.draw();
	var2.startDrawing(1);
	var2.addVertex(aabb.minX, aabb.minY, aabb.minZ);
	var2.addVertex(aabb.minX, aabb.maxY, aabb.minZ);
	var2.addVertex(aabb.maxX, aabb.minY, aabb.minZ);
	var2.addVertex(aabb.maxX, aabb.maxY, aabb.minZ);
	var2.addVertex(aabb.maxX, aabb.minY, aabb.maxZ);
	var2.addVertex(aabb.maxX, aabb.maxY, aabb.maxZ);
	var2.addVertex(aabb.minX, aabb.minY, aabb.maxZ);
	var2.addVertex(aabb.minX, aabb.maxY, aabb.maxZ);
	var2.draw();

	GL11.glDepthMask(true);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);

}
 
Example 18
Source File: MoCRenderShark.java    From mocreaturesdev with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void doRenderLiving(EntityLiving entityliving, double d, double d1, double d2, float f, float f1)
{
    MoCEntityShark entityshark = (MoCEntityShark) entityliving;
    super.doRenderLiving(entityshark, d, d1, d2, f, f1);
    boolean flag = MoCreatures.proxy.getDisplayPetName() && !(entityshark.getName()).isEmpty();
    boolean flag1 = MoCreatures.proxy.getDisplayPetHealth();
    boolean flag2 = MoCreatures.proxy.getDisplayPetIcons();
    if (entityshark.renderName())
    {
        float f2 = 1.6F;
        float f3 = 0.01666667F * f2;
        float f4 = entityshark.getDistanceToEntity(renderManager.livingPlayer);
        if (f4 < 16F)
        {
            String s = "";
            s = (new StringBuilder()).append(s).append(entityshark.getName()).toString();
            float f5 = 0.1F;
            FontRenderer fontrenderer = getFontRendererFromRenderManager();
            GL11.glPushMatrix();
            GL11.glTranslatef((float) d + 0.0F, (float) d1 + f5, (float) d2);
            GL11.glNormal3f(0.0F, 1.0F, 0.0F);
            GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
            GL11.glScalef(-f3, -f3, f3);
            GL11.glDisable(2896 /* GL_LIGHTING */);
            Tessellator tessellator = Tessellator.instance;
            byte byte0 = -50;
            if (flag1)
            {
                GL11.glDisable(3553 /* GL_TEXTURE_2D */);
                if (!flag)
                {
                    byte0 += 8;
                }
                tessellator.startDrawingQuads();
                // might break SSP
                float f6 = entityshark.getHealth();
                float f7 = entityshark.getMaxHealth();
                float f8 = f6 / f7;
                float f9 = 40F * f8;
                tessellator.setColorRGBA_F(0.7F, 0.0F, 0.0F, 1.0F);
                tessellator.addVertex(-20F + f9, -10 + byte0, 0.0D);
                tessellator.addVertex(-20F + f9, -6 + byte0, 0.0D);
                tessellator.addVertex(20D, -6 + byte0, 0.0D);
                tessellator.addVertex(20D, -10 + byte0, 0.0D);
                tessellator.setColorRGBA_F(0.0F, 0.7F, 0.0F, 1.0F);
                tessellator.addVertex(-20D, -10 + byte0, 0.0D);
                tessellator.addVertex(-20D, -6 + byte0, 0.0D);
                tessellator.addVertex(f9 - 20F, -6 + byte0, 0.0D);
                tessellator.addVertex(f9 - 20F, -10 + byte0, 0.0D);
                tessellator.draw();
                GL11.glEnable(3553 /* GL_TEXTURE_2D */);
            }
            if (flag)
            {
                GL11.glDepthMask(false);
                GL11.glDisable(2929 /* GL_DEPTH_TEST */);
                GL11.glEnable(3042 /* GL_BLEND */);
                GL11.glBlendFunc(770, 771);
                GL11.glDisable(3553 /* GL_TEXTURE_2D */);
                tessellator.startDrawingQuads();
                int i = fontrenderer.getStringWidth(s) / 2;
                tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
                tessellator.addVertex(-i - 1, -1 + byte0, 0.0D);
                tessellator.addVertex(-i - 1, 8 + byte0, 0.0D);
                tessellator.addVertex(i + 1, 8 + byte0, 0.0D);
                tessellator.addVertex(i + 1, -1 + byte0, 0.0D);
                tessellator.draw();
                GL11.glEnable(3553 /* GL_TEXTURE_2D */);
                fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, 0x20ffffff);
                GL11.glEnable(2929 /* GL_DEPTH_TEST */);
                GL11.glDepthMask(true);
                fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, -1);
                GL11.glDisable(3042 /* GL_BLEND */);
                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            }
            GL11.glEnable(2896 /* GL_LIGHTING */);
            GL11.glPopMatrix();
        }
    }
}
 
Example 19
Source File: GLUtils.java    From ehacks-pro with GNU General Public License v3.0 4 votes vote down vote up
public static void drawBoundingBox(AltAxisAlignedBB axisalignedbb) {

        Tessellator tessellator = Tessellator.instance;
        tessellator.startDrawingQuads();
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ);
        tessellator.draw();
        tessellator.startDrawingQuads();
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ);
        tessellator.draw();
        tessellator.startDrawingQuads();
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ);
        tessellator.draw();
        tessellator.startDrawingQuads();
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ);
        tessellator.draw();
        tessellator.startDrawingQuads();
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ);
        tessellator.draw();
        tessellator.startDrawingQuads();
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ);
        tessellator.addVertex(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ);
        tessellator.draw();
    }
 
Example 20
Source File: RenderCoordWireframe.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
public void render(float partialTicks){
    /*
    Block block = Block.blocksList[world.getBlockId(x, y, z)];
    block.setBlockBoundsBasedOnState(world, x, y, z);
    double minX = block.getBlockBoundsMinX();
    double minY = block.getBlockBoundsMinY();
    double minZ = block.getBlockBoundsMinZ();
    double maxX = minX + (block.getBlockBoundsMaxX() - minX) * progress;
    double maxY = minY + (block.getBlockBoundsMaxY() - minY) * progress;
    double maxZ = minZ + (block.getBlockBoundsMaxX() - minZ) * progress;
    */
    double minX = 0;
    double minY = 0;
    double minZ = 0;
    double maxX = 1;
    double maxY = 1;
    double maxZ = 1;
    float progress = (ticksExisted % 20 + partialTicks) / 20;
    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glLineWidth(1.0F);
    // GL11.glColor4d(0, 1, 1, progress < 0.5F ? progress + 0.5F : 1.5 - progress);
    GL11.glColor4d(0, progress < 0.5F ? progress + 0.5F : 1.5 - progress, 1, 1);
    GL11.glPushMatrix();
    // GL11.glTranslated(-0.5D, -0.5D, -0.5D);
    GL11.glTranslated(x, y, z);
    Tessellator tess = Tessellator.instance;

    tess.startDrawing(GL11.GL_LINES);
    tess.addVertex(minX, minY, minZ);
    tess.addVertex(minX, maxY, minZ);
    tess.addVertex(minX, minY, maxZ);
    tess.addVertex(minX, maxY, maxZ);

    tess.addVertex(maxX, minY, minZ);
    tess.addVertex(maxX, maxY, minZ);
    tess.addVertex(maxX, minY, maxZ);
    tess.addVertex(maxX, maxY, maxZ);

    tess.addVertex(minX, minY, minZ);
    tess.addVertex(maxX, minY, minZ);
    tess.addVertex(minX, minY, maxZ);
    tess.addVertex(maxX, minY, maxZ);

    tess.addVertex(minX, maxY, minZ);
    tess.addVertex(maxX, maxY, minZ);
    tess.addVertex(minX, maxY, maxZ);
    tess.addVertex(maxX, maxY, maxZ);

    tess.addVertex(minX, minY, minZ);
    tess.addVertex(minX, minY, maxZ);
    tess.addVertex(maxX, minY, minZ);
    tess.addVertex(maxX, minY, maxZ);

    tess.addVertex(minX, maxY, minZ);
    tess.addVertex(minX, maxY, maxZ);
    tess.addVertex(maxX, maxY, minZ);
    tess.addVertex(maxX, maxY, maxZ);

    tess.draw();

    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
}