FontRenderer

This commit is contained in:
RainWarrior committed 2016-03-01 21:08:51 +03:00
1 parent d5c4b1825c
commit d9b69fda65
3 files changed
+26 -37

No files matched your search

@@ -17,6 +17,24 @@
}
private void readFontTexture()
@@ -106,7 +107,7 @@
try
{
- iresource = Minecraft.getMinecraft().getResourceManager().getResource(this.locationFontTexture);
+ iresource = getResource(this.locationFontTexture);
bufferedimage = TextureUtil.readBufferedImage(iresource.getInputStream());
}
catch (IOException ioexception)
@@ -171,7 +172,7 @@
try
{
- iresource = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("font/glyph_sizes.bin"));
+ iresource = getResource(new ResourceLocation("font/glyph_sizes.bin"));
iresource.getInputStream().read(this.glyphWidth);
}
catch (IOException ioexception)
@@ -202,7 +203,7 @@
int i = ch % 16 * 8;
int j = ch / 16 * 8;
@@ -116,9 +134,9 @@
+ renderEngine.bindTexture(location);
+ }
+
+ protected InputStream getResourceInputStream(ResourceLocation location) throws IOException
+ protected IResource getResource(ResourceLocation location) throws IOException
+ {
+ return Minecraft.getMinecraft().getResourceManager().getResource(location).getInputStream();
+ return Minecraft.getMinecraft().getResourceManager().getResource(location);
+ }
+
public int getColorCode(char character)
@@ -1,33 +0,0 @@
++++ REJECTED PATCH 3
try
{
- bufferedimage = TextureUtil.readBufferedImage(Minecraft.getMinecraft().getResourceManager().getResource(this.locationFontTexture).getInputStream());
+ bufferedimage = TextureUtil.readBufferedImage(getResourceInputStream(this.locationFontTexture));
}
catch (IOException ioexception)
{
++++ END PATCH
++++ REJECTED PATCH 4
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)
++++ END PATCH
++++ REJECTED PATCH 13
int j = this.glyphWidth[character] >>> 4;
int k = this.glyphWidth[character] & 15;
- if (k > 7)
- {
- k = 15;
- j = 0;
- }
++k;
return (k - j) / 2 + 1;
++++ END PATCH
@@ -75,9 +75,12 @@ import javax.imageio.stream.ImageInputStream;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.DefaultResourcePack;
import net.minecraft.client.resources.FileResourcePack;
import net.minecraft.client.resources.FolderResourcePack;
import net.minecraft.client.resources.IResource;
import net.minecraft.client.resources.IResourcePack;
import net.minecraft.client.resources.SimpleResource;
import net.minecraft.crash.CrashReport;
import net.minecraft.launchwrapper.Launch;
import net.minecraft.util.ResourceLocation;
@@ -806,9 +809,10 @@ public class SplashProgress
}
@Override
protected InputStream getResourceInputStream(ResourceLocation location) throws IOException
protected IResource getResource(ResourceLocation location) throws IOException
{
return Minecraft.getMinecraft().mcDefaultResourcePack.getInputStream(location);
DefaultResourcePack pack = Minecraft.getMinecraft().mcDefaultResourcePack;
return new SimpleResource(pack.getPackName(), location, pack.getInputStream(location), null, null);
}
}