mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-25 22:44:32 +00:00
157 lines
5.3 KiB
Diff
157 lines
5.3 KiB
Diff
--- ../src-base/minecraft/net/minecraft/client/gui/FontRenderer.java
|
|
+++ ../src-work/minecraft/net/minecraft/client/gui/FontRenderer.java
|
|
@@ -58,7 +58,7 @@
|
|
this.locationFontTexture = p_i1035_2_;
|
|
this.renderEngine = p_i1035_3_;
|
|
this.unicodeFlag = p_i1035_4_;
|
|
- p_i1035_3_.bindTexture(this.locationFontTexture);
|
|
+ bindTexture(this.locationFontTexture);
|
|
|
|
for (int i = 0; i < 32; ++i)
|
|
{
|
|
@@ -98,6 +98,7 @@
|
|
public void onResourceManagerReload(IResourceManager resourceManager)
|
|
{
|
|
this.readFontTexture();
|
|
+ this.readGlyphSizes();
|
|
}
|
|
|
|
private void readFontTexture()
|
|
@@ -106,7 +107,7 @@
|
|
|
|
try
|
|
{
|
|
- bufferedimage = TextureUtil.readBufferedImage(Minecraft.getMinecraft().getResourceManager().getResource(this.locationFontTexture).getInputStream());
|
|
+ bufferedimage = TextureUtil.readBufferedImage(getResourceInputStream(this.locationFontTexture));
|
|
}
|
|
catch (IOException ioexception)
|
|
{
|
|
@@ -166,7 +167,7 @@
|
|
|
|
try
|
|
{
|
|
- inputstream = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("font/glyph_sizes.bin")).getInputStream();
|
|
+ inputstream = getResourceInputStream(new ResourceLocation("font/glyph_sizes.bin"));
|
|
inputstream.read(this.glyphWidth);
|
|
}
|
|
catch (IOException ioexception)
|
|
@@ -197,7 +198,7 @@
|
|
int i = p_78266_1_ % 16 * 8;
|
|
int j = p_78266_1_ / 16 * 8;
|
|
int k = p_78266_2_ ? 1 : 0;
|
|
- this.renderEngine.bindTexture(this.locationFontTexture);
|
|
+ bindTexture(this.locationFontTexture);
|
|
int l = this.charWidth[p_78266_1_];
|
|
float f = (float)l - 0.01F;
|
|
GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
|
|
@@ -225,7 +226,7 @@
|
|
|
|
private void loadGlyphTexture(int p_78257_1_)
|
|
{
|
|
- this.renderEngine.bindTexture(this.getUnicodePageLocation(p_78257_1_));
|
|
+ bindTexture(this.getUnicodePageLocation(p_78257_1_));
|
|
}
|
|
|
|
protected float renderUnicodeChar(char p_78277_1_, boolean p_78277_2_)
|
|
@@ -272,7 +273,7 @@
|
|
|
|
public int drawString(String p_175065_1_, float p_175065_2_, float p_175065_3_, int p_175065_4_, boolean p_175065_5_)
|
|
{
|
|
- GlStateManager.enableAlpha();
|
|
+ enableAlpha();
|
|
this.resetStyles();
|
|
int i;
|
|
|
|
@@ -342,7 +343,7 @@
|
|
|
|
int j1 = this.colorCode[i1];
|
|
this.textColor = j1;
|
|
- GlStateManager.color((float)(j1 >> 16) / 255.0F, (float)(j1 >> 8 & 255) / 255.0F, (float)(j1 & 255) / 255.0F, this.alpha);
|
|
+ setColor((float)(j1 >> 16) / 255.0F, (float)(j1 >> 8 & 255) / 255.0F, (float)(j1 & 255) / 255.0F, this.alpha);
|
|
}
|
|
else if (i1 == 16)
|
|
{
|
|
@@ -371,7 +372,7 @@
|
|
this.strikethroughStyle = false;
|
|
this.underlineStyle = false;
|
|
this.italicStyle = false;
|
|
- GlStateManager.color(this.red, this.blue, this.green, this.alpha);
|
|
+ setColor(this.red, this.blue, this.green, this.alpha);
|
|
}
|
|
|
|
++i;
|
|
@@ -399,7 +400,7 @@
|
|
c0 = c1;
|
|
}
|
|
|
|
- float f1 = this.unicodeFlag ? 0.5F : 1.0F;
|
|
+ float f1 = getCharWidth(c0) / 32f;
|
|
boolean flag = (c0 == 0 || j == -1 || this.unicodeFlag) && p_78255_2_;
|
|
|
|
if (flag)
|
|
@@ -437,7 +438,16 @@
|
|
|
|
++f;
|
|
}
|
|
+ doDraw(f);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
|
|
+ protected void doDraw(float f)
|
|
+ {
|
|
+ {
|
|
+ {
|
|
+
|
|
if (this.strikethroughStyle)
|
|
{
|
|
Tessellator tessellator = Tessellator.getInstance();
|
|
@@ -510,7 +520,7 @@
|
|
this.blue = (float)(p_180455_4_ >> 8 & 255) / 255.0F;
|
|
this.green = (float)(p_180455_4_ & 255) / 255.0F;
|
|
this.alpha = (float)(p_180455_4_ >> 24 & 255) / 255.0F;
|
|
- GlStateManager.color(this.red, this.blue, this.green, this.alpha);
|
|
+ setColor(this.red, this.blue, this.green, this.alpha);
|
|
this.posX = p_180455_2_;
|
|
this.posY = p_180455_3_;
|
|
this.renderStringAtPos(p_180455_1_, p_180455_5_);
|
|
@@ -589,11 +599,6 @@
|
|
int j = this.glyphWidth[p_78263_1_] >>> 4;
|
|
int k = this.glyphWidth[p_78263_1_] & 15;
|
|
|
|
- if (k > 7)
|
|
- {
|
|
- k = 15;
|
|
- j = 0;
|
|
- }
|
|
|
|
++k;
|
|
return (k - j) / 2 + 1;
|
|
@@ -847,6 +852,26 @@
|
|
return this.bidiFlag;
|
|
}
|
|
|
|
+ protected void setColor(float r, float g, float b, float a)
|
|
+ {
|
|
+ GlStateManager.color(r,g,b,a);
|
|
+ }
|
|
+
|
|
+ protected void enableAlpha()
|
|
+ {
|
|
+ GlStateManager.enableAlpha();
|
|
+ }
|
|
+
|
|
+ protected void bindTexture(ResourceLocation location)
|
|
+ {
|
|
+ renderEngine.bindTexture(location);
|
|
+ }
|
|
+
|
|
+ protected InputStream getResourceInputStream(ResourceLocation location) throws IOException
|
|
+ {
|
|
+ return Minecraft.getMinecraft().getResourceManager().getResource(location).getInputStream();
|
|
+ }
|
|
+
|
|
public int getColorCode(char p_175064_1_)
|
|
{
|
|
return this.colorCode["0123456789abcdef".indexOf(p_175064_1_)];
|