ForgePatch/patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch

156 lines
5.5 KiB
Diff

--- ../src-base/minecraft/net/minecraft/client/gui/FontRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/gui/FontRenderer.java
@@ -57,7 +57,7 @@
this.field_111273_g = p_i1035_2_;
this.field_78298_i = p_i1035_3_;
this.field_78293_l = p_i1035_4_;
- p_i1035_3_.func_110577_a(this.field_111273_g);
+ bindTexture(this.field_111273_g);
for (int i = 0; i < 32; ++i)
{
@@ -97,6 +97,7 @@
public void func_110549_a(IResourceManager p_110549_1_)
{
this.func_111272_d();
+ this.func_98306_d();
}
private void func_111272_d()
@@ -105,7 +106,7 @@
try
{
- bufferedimage = TextureUtil.func_177053_a(Minecraft.func_71410_x().func_110442_L().func_110536_a(this.field_111273_g).func_110527_b());
+ bufferedimage = TextureUtil.func_177053_a(getResourceInputStream(this.field_111273_g));
}
catch (IOException ioexception)
{
@@ -172,7 +173,7 @@
try
{
- inputstream = Minecraft.func_71410_x().func_110442_L().func_110536_a(new ResourceLocation("font/glyph_sizes.bin")).func_110527_b();
+ inputstream = getResourceInputStream(new ResourceLocation("font/glyph_sizes.bin"));
inputstream.read(this.field_78287_e);
}
catch (IOException ioexception)
@@ -195,7 +196,7 @@
float f = (float)(p_78266_1_ % 16 * 8);
float f1 = (float)(p_78266_1_ / 16 * 8);
float f2 = p_78266_2_ ? 1.0F : 0.0F;
- this.field_78298_i.func_110577_a(this.field_111273_g);
+ bindTexture(this.field_111273_g);
float f3 = (float)this.field_78286_d[p_78266_1_] - 0.01F;
GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
GL11.glTexCoord2f(f / 128.0F, f1 / 128.0F);
@@ -222,7 +223,7 @@
private void func_78257_a(int p_78257_1_)
{
- this.field_78298_i.func_110577_a(this.func_111271_a(p_78257_1_));
+ bindTexture(this.func_111271_a(p_78257_1_));
}
protected float func_78277_a(char p_78277_1_, boolean p_78277_2_)
@@ -269,7 +270,7 @@
public int func_175065_a(String p_175065_1_, float p_175065_2_, float p_175065_3_, int p_175065_4_, boolean p_175065_5_)
{
- GlStateManager.func_179141_d();
+ enableAlpha();
this.func_78265_b();
int j;
@@ -341,7 +342,7 @@
k = this.field_78285_g[j];
this.field_78304_r = k;
- GlStateManager.func_179131_c((float)(k >> 16) / 255.0F, (float)(k >> 8 & 255) / 255.0F, (float)(k & 255) / 255.0F, this.field_78305_q);
+ setColor((float)(k >> 16) / 255.0F, (float)(k >> 8 & 255) / 255.0F, (float)(k & 255) / 255.0F, this.field_78305_q);
}
else if (j == 16)
{
@@ -370,7 +371,7 @@
this.field_78299_w = false;
this.field_78300_v = false;
this.field_78301_u = false;
- GlStateManager.func_179131_c(this.field_78291_n, this.field_78292_o, this.field_78306_p, this.field_78305_q);
+ setColor(this.field_78291_n, this.field_78292_o, this.field_78306_p, this.field_78305_q);
}
++i;
@@ -390,7 +391,7 @@
j = k;
}
- float f1 = this.field_78293_l ? 0.5F : 1.0F;
+ float f1 = func_78263_a(c0) / 32f;
boolean flag1 = (c0 == 0 || j == -1 || this.field_78293_l) && p_78255_2_;
if (flag1)
@@ -429,6 +430,15 @@
++f;
}
+ doDraw(f);
+ }
+ }
+ }
+
+ protected void doDraw(float f)
+ {
+ {
+ {
Tessellator tessellator;
WorldRenderer worldrenderer;
@@ -504,7 +514,7 @@
this.field_78292_o = (float)(p_180455_4_ >> 8 & 255) / 255.0F;
this.field_78306_p = (float)(p_180455_4_ & 255) / 255.0F;
this.field_78305_q = (float)(p_180455_4_ >> 24 & 255) / 255.0F;
- GlStateManager.func_179131_c(this.field_78291_n, this.field_78292_o, this.field_78306_p, this.field_78305_q);
+ setColor(this.field_78291_n, this.field_78292_o, this.field_78306_p, this.field_78305_q);
this.field_78295_j = p_180455_2_;
this.field_78296_k = p_180455_3_;
this.func_78255_a(p_180455_1_, p_180455_5_);
@@ -583,11 +593,6 @@
int j = this.field_78287_e[p_78263_1_] >>> 4;
int k = this.field_78287_e[p_78263_1_] & 15;
- if (k > 7)
- {
- k = 15;
- j = 0;
- }
++k;
return (k - j) / 2 + 1;
@@ -842,6 +847,26 @@
return this.field_78294_m;
}
+ protected void setColor(float r, float g, float b, float a)
+ {
+ GlStateManager.func_179131_c(r,g,b,a);
+ }
+
+ protected void enableAlpha()
+ {
+ GlStateManager.func_179141_d();
+ }
+
+ protected void bindTexture(ResourceLocation location)
+ {
+ field_78298_i.func_110577_a(location);
+ }
+
+ protected InputStream getResourceInputStream(ResourceLocation location) throws IOException
+ {
+ return Minecraft.func_71410_x().func_110442_L().func_110536_a(location).func_110527_b();
+ }
+
public int func_175064_b(char p_175064_1_)
{
return this.field_78285_g["0123456789abcdef".indexOf(p_175064_1_)];