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

153 lines
5.4 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)
{
@@ -107,7 +107,7 @@
try
{
- iresource = Minecraft.func_71410_x().func_110442_L().func_110536_a(this.field_111273_g);
+ iresource = getResource(this.field_111273_g);
bufferedimage = TextureUtil.func_177053_a(iresource.func_110527_b());
}
catch (IOException ioexception)
@@ -172,7 +172,7 @@
try
{
- iresource = Minecraft.func_71410_x().func_110442_L().func_110536_a(new ResourceLocation("font/glyph_sizes.bin"));
+ iresource = getResource(new ResourceLocation("font/glyph_sizes.bin"));
iresource.func_110527_b().read(this.field_78287_e);
}
catch (IOException ioexception)
@@ -187,6 +187,7 @@
private float func_181559_a(char p_181559_1_, boolean p_181559_2_)
{
+ if (p_181559_1_ == 160) return 4.0F; // forge: display nbsp as space. MC-2595
if (p_181559_1_ == ' ')
{
return 4.0F;
@@ -203,7 +204,7 @@
int i = p_78266_1_ % 16 * 8;
int j = p_78266_1_ / 16 * 8;
int k = p_78266_2_ ? 1 : 0;
- this.field_78298_i.func_110577_a(this.field_111273_g);
+ bindTexture(this.field_111273_g);
int l = this.field_78286_d[p_78266_1_];
float f = (float)l - 0.01F;
GlStateManager.func_187447_r(5);
@@ -231,7 +232,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_)
@@ -280,7 +281,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 i;
@@ -350,7 +351,7 @@
int j1 = this.field_78285_g[i1];
this.field_78304_r = j1;
- GlStateManager.func_179131_c((float)(j1 >> 16) / 255.0F, (float)(j1 >> 8 & 255) / 255.0F, (float)(j1 & 255) / 255.0F, this.field_78305_q);
+ setColor((float)(j1 >> 16) / 255.0F, (float)(j1 >> 8 & 255) / 255.0F, (float)(j1 & 255) / 255.0F, this.field_78305_q);
}
else if (i1 == 16)
{
@@ -379,7 +380,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;
@@ -407,7 +408,7 @@
c0 = c1;
}
- float f1 = this.field_78293_l ? 0.5F : 1.0F;
+ float f1 = j == -1 || this.field_78293_l ? 0.5f : 1f;
boolean flag = (c0 == 0 || j == -1 || this.field_78293_l) && p_78255_2_;
if (flag)
@@ -445,7 +446,16 @@
++f;
}
+ doDraw(f);
+ }
+ }
+ }
+ protected void doDraw(float f)
+ {
+ {
+ {
+
if (this.field_78299_w)
{
Tessellator tessellator = Tessellator.func_178181_a();
@@ -518,7 +528,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_);
@@ -576,6 +586,7 @@
public int func_78263_a(char p_78263_1_)
{
+ if (p_78263_1_ == 160) return 4; // forge: display nbsp as space. MC-2595
if (p_78263_1_ == 167)
{
return -1;
@@ -849,6 +860,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 IResource getResource(ResourceLocation location) throws IOException
+ {
+ return Minecraft.func_71410_x().func_110442_L().func_110536_a(location);
+ }
+
public int func_175064_b(char p_175064_1_)
{
int i = "0123456789abcdef".indexOf(p_175064_1_);