Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/minecraft/net/minecraft/src/FontRenderer.java b/src/minecraft/net/minecraft/src/FontRenderer.java
- index 70a5f3f..93033c1 100644
- --- a/src/minecraft/net/minecraft/src/FontRenderer.java
- +++ b/src/minecraft/net/minecraft/src/FontRenderer.java
- @@ -45,17 +45,7 @@ public class FontRenderer
- */
- private boolean bidiFlag;
- - /** Used to specify new red value for the current color. */
- - private float red;
- -
- - /** Used to specify new blue value for the current color. */
- - private float blue;
- -
- - /** Used to specify new green value for the current color. */
- - private float green;
- -
- - /** Used to speify new alpha value for the current color. */
- - private float alpha;
- + private int defaultColor;
- FontRenderer()
- {
- @@ -180,7 +170,7 @@ public class FontRenderer
- /**
- * Pick how to render a single character and return the width used.
- */
- - private float renderCharAtPos(int par1, char par2, boolean par3)
- + private float renderCharAtPos(int par1, char par2, boolean par3, int color)
- {
- if (par2 == ' ')
- {
- @@ -189,18 +179,18 @@ public class FontRenderer
- if (par1 > 0 && !unicodeFlag)
- {
- - return renderDefaultChar(par1 + 32, par3);
- + return renderDefaultChar(par1 + 32, par3, color);
- }
- else
- {
- - return renderUnicodeChar(par2, par3);
- + return renderUnicodeChar(par2, par3, color);
- }
- }
- /**
- * Render a single character with the default.png font at current (posX,posY) location...
- */
- - private float renderDefaultChar(int par1, boolean par2)
- + private float renderDefaultChar(int par1, boolean par2, int color)
- {
- float f = (par1 % 16) * 8;
- float f1 = (par1 / 16) * 8;
- @@ -213,16 +203,14 @@ public class FontRenderer
- }
- float f3 = (float)charWidth[par1] - 0.01F;
- - GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
- - GL11.glTexCoord2f(f / 128F, f1 / 128F);
- - GL11.glVertex3f(posX + f2, posY, 0.0F);
- - GL11.glTexCoord2f(f / 128F, (f1 + 7.99F) / 128F);
- - GL11.glVertex3f(posX - f2, posY + 7.99F, 0.0F);
- - GL11.glTexCoord2f((f + f3) / 128F, f1 / 128F);
- - GL11.glVertex3f(posX + f3 + f2, posY, 0.0F);
- - GL11.glTexCoord2f((f + f3) / 128F, (f1 + 7.99F) / 128F);
- - GL11.glVertex3f((posX + f3) - f2, posY + 7.99F, 0.0F);
- - GL11.glEnd();
- + Tessellator tess = Tessellator.instance;
- + tess.startDrawing(GL11.GL_TRIANGLE_STRIP);
- + tess.setColorRGBA(color >> 16 & 0xff, color >> 8 & 0xff, color & 0xff, color >> 24 & 0xff);
- + tess.addVertexWithUV(posX + f2, posY, 0.0F, f / 128F, f1 / 128F);
- + tess.addVertexWithUV(posX - f2, posY + 7.99F, 0.0F, f / 128F, (f1 + 7.99F) / 128F);
- + tess.addVertexWithUV(posX + f3 + f2, posY, 0.0F, (f + f3) / 128F, f1 / 128F);
- + tess.addVertexWithUV(posX + f3 - f2, posY + 7.99F, 0.0F, (f + f3) / 128F, (f1 + 7.99F) / 128F);
- + tess.draw();
- return (float)charWidth[par1];
- }
- @@ -253,7 +241,7 @@ public class FontRenderer
- /**
- * Render a single Unicode character at current (posX,posY) location using one of the /font/glyph_XX.png files...
- */
- - private float renderUnicodeChar(char par1, boolean par2)
- + private float renderUnicodeChar(char par1, boolean par2, int color)
- {
- if (glyphWidth[par1] == 0)
- {
- @@ -281,16 +269,14 @@ public class FontRenderer
- float f3 = ((par1 & 0xff) / 16) * 16;
- float f4 = f1 - f - 0.02F;
- float f5 = par2 ? 1.0F : 0.0F;
- - GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
- - GL11.glTexCoord2f(f2 / 256F, f3 / 256F);
- - GL11.glVertex3f(posX + f5, posY, 0.0F);
- - GL11.glTexCoord2f(f2 / 256F, (f3 + 15.98F) / 256F);
- - GL11.glVertex3f(posX - f5, posY + 7.99F, 0.0F);
- - GL11.glTexCoord2f((f2 + f4) / 256F, f3 / 256F);
- - GL11.glVertex3f(posX + f4 / 2.0F + f5, posY, 0.0F);
- - GL11.glTexCoord2f((f2 + f4) / 256F, (f3 + 15.98F) / 256F);
- - GL11.glVertex3f((posX + f4 / 2.0F) - f5, posY + 7.99F, 0.0F);
- - GL11.glEnd();
- + Tessellator tess = Tessellator.instance;
- + tess.startDrawing(GL11.GL_TRIANGLE_STRIP);
- + tess.setColorRGBA(color >> 16 & 0xff, color >> 8 & 0xff, color & 0xff, color >> 24 & 0xff);
- + tess.addVertexWithUV(posX + f5, posY, 0.0F, f2 / 256F, f3 / 256F);
- + tess.addVertexWithUV(posX - f5, posY + 7.99F, 0.0F, f2 / 256F, (f3 + 15.98F) / 256F);
- + tess.addVertexWithUV(posX + f5 + f4 / 2.0F, posY, 0.0F, (f2 + f4) / 256F, f3 / 256F);
- + tess.addVertexWithUV(posX - f5 + f4 / 2.0F, posY + 7.99F, 0.0F, (f2 + f4) / 256F, (f3 + 15.98F) / 256F);
- + tess.draw();
- return (f1 - f) / 2.0F + 1.0F;
- }
- @@ -411,7 +397,7 @@ public class FontRenderer
- /**
- * Render a single line string at the current (posX,posY) and update posX
- */
- - private void renderStringAtPos(String par1Str, boolean par2)
- + private void renderStringAtPos(String par1Str, int color, boolean par2)
- {
- boolean flag = false;
- boolean flag1 = false;
- @@ -445,8 +431,7 @@ public class FontRenderer
- j += 16;
- }
- - int l = colorCode[j];
- - GL11.glColor3f((float)(l >> 16) / 255F, (float)(l >> 8 & 0xff) / 255F, (float)(l & 0xff) / 255F);
- + color = colorCode[j] & 0xffffff | color & 0xff000000;
- }
- else if (j == 16)
- {
- @@ -475,7 +460,7 @@ public class FontRenderer
- flag4 = false;
- flag3 = false;
- flag2 = false;
- - GL11.glColor4f(red, blue, green, alpha);
- + color = defaultColor;
- }
- i++;
- @@ -497,12 +482,12 @@ public class FontRenderer
- k = i1;
- }
- - float f = renderCharAtPos(k, c, flag2);
- + float f = renderCharAtPos(k, c, flag2, color);
- if (flag1)
- {
- posX++;
- - renderCharAtPos(k, c, flag2);
- + renderCharAtPos(k, c, flag2, color);
- posX--;
- f++;
- }
- @@ -512,6 +497,7 @@ public class FontRenderer
- Tessellator tessellator = Tessellator.instance;
- GL11.glDisable(GL11.GL_TEXTURE_2D);
- tessellator.startDrawingQuads();
- + tessellator.setColorRGBA(color >> 16 & 0xff, color >> 8 & 0xff, color & 0xff, color >> 24 & 0xff);
- tessellator.addVertex(posX, posY + (float)(FONT_HEIGHT / 2), 0.0D);
- tessellator.addVertex(posX + f, posY + (float)(FONT_HEIGHT / 2), 0.0D);
- tessellator.addVertex(posX + f, (posY + (float)(FONT_HEIGHT / 2)) - 1.0F, 0.0D);
- @@ -525,6 +511,7 @@ public class FontRenderer
- Tessellator tessellator1 = Tessellator.instance;
- GL11.glDisable(GL11.GL_TEXTURE_2D);
- tessellator1.startDrawingQuads();
- + tessellator1.setColorRGBA(color >> 16 & 0xff, color >> 8 & 0xff, color & 0xff, color >> 24 & 0xff);
- int j1 = flag3 ? -1 : 0;
- tessellator1.addVertex(posX + (float)j1, posY + (float)FONT_HEIGHT, 0.0D);
- tessellator1.addVertex(posX + f, posY + (float)FONT_HEIGHT, 0.0D);
- @@ -554,14 +541,10 @@ public class FontRenderer
- par4 = (par4 & 0xfcfcfc) >> 2 | par4 & 0xff000000;
- }
- - red = (float)(par4 >> 16 & 0xff) / 255F;
- - blue = (float)(par4 >> 8 & 0xff) / 255F;
- - green = (float)(par4 & 0xff) / 255F;
- - alpha = (float)(par4 >> 24 & 0xff) / 255F;
- - GL11.glColor4f(red, blue, green, alpha);
- + defaultColor = par4;
- posX = par2;
- posY = par3;
- - renderStringAtPos(par1Str, par5);
- + renderStringAtPos(par1Str, par4, par5);
- return (int)posX;
- }
- else
Add Comment
Please, Sign In to add comment