Skip to content

Instantly share code, notes, and snippets.

@thvortex
Created March 17, 2012 21:02
Show Gist options
  • Save thvortex/2065253 to your computer and use it in GitHub Desktop.
Save thvortex/2065253 to your computer and use it in GitHub Desktop.
Fix for fading chat messages
diff --git a/src/minecraft/net/minecraft/src/FontRenderer.java b/src/minecraft/net/minecraft/src/FontRenderer.java
index a10060d..966f08b 100644
--- a/src/minecraft/net/minecraft/src/FontRenderer.java
+++ b/src/minecraft/net/minecraft/src/FontRenderer.java
@@ -154,7 +154,7 @@ public class FontRenderer
/**
* Render a single character with the default.png font at current (posX,posY) location.
*/
- private void renderDefaultChar(int par1)
+ private void renderDefaultChar(int par1, int color)
{
float f = (par1 % 16) * 8;
float f1 = (par1 / 16) * 8;
@@ -206,7 +206,7 @@ public class FontRenderer
/**
* Render a single Unicode character at current (posX,posY) location using one of the /font/glyph_XX.png files.
*/
- private void renderUnicodeChar(char par1)
+ private void renderUnicodeChar(char par1, int color)
{
if (glyphWidth[par1] == 0)
{
@@ -362,7 +362,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;
@@ -392,8 +392,8 @@ public class FontRenderer
j += 16;
}
- int l = colorCode[j];
- GL11.glColor3f((float)(l >> 16) / 255F, (float)(l >> 8 & 0xff) / 255F, (float)(l & 0xff) / 255F);
+ int l = colorCode[j] & 0xffffff | color & 0xff000000;;
+ GL11.glColor4f((float)(l >> 16 & 0xff) / 255F, (float)(l >> 8 & 0xff) / 255F, (float)(l & 0xff) / 255F, (float)(l >> 24 & 0xff) / 255F);
}
i++;
@@ -423,11 +423,11 @@ public class FontRenderer
if (k > 0 && !unicodeFlag)
{
- renderDefaultChar(k + 32);
+ renderDefaultChar(k + 32, color);
}
else
{
- renderUnicodeChar(c);
+ renderUnicodeChar(c, color);
}
}
}
@@ -441,7 +441,7 @@ public class FontRenderer
{
boundTextureName = 0;
- if ((par4 & 0xfc000000) == 0)
+ if ((par4 & 0xff000000) == 0)
{
par4 |= 0xff000000;
}
@@ -454,7 +454,7 @@ public class FontRenderer
GL11.glColor4f((float)(par4 >> 16 & 0xff) / 255F, (float)(par4 >> 8 & 0xff) / 255F, (float)(par4 & 0xff) / 255F, (float)(par4 >> 24 & 0xff) / 255F);
posX = par2;
posY = par3;
- renderStringAtPos(par1Str, par5);
+ renderStringAtPos(par1Str, par4, par5);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment