mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-20 06:29:41 +00:00
Fix memory leaks by closing streams
This commit is contained in:
1 parent
39e51bc8c2
commit
540508a2be
18 files changed
+96
-60
No files matched your search
@@ -253,19 +253,19 @@ public class GlyphCache {
|
||||
}
|
||||
|
||||
void setCustomFont(ResourceLocation location, int size, boolean antiAlias) throws Exception {
|
||||
InputStream stream = Minecraft.getMinecraft().getResourceManager().getResource(location).getInputStream();
|
||||
try (InputStream stream = Minecraft.getMinecraft().getResourceManager().getResource(location).getInputStream()) {
|
||||
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
Font font = Font.createFont(Font.TRUETYPE_FONT, stream);
|
||||
ge.registerFont(font);
|
||||
font = font.deriveFont(Font.PLAIN, 72);
|
||||
|
||||
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
Font font = Font.createFont(Font.TRUETYPE_FONT, stream);
|
||||
ge.registerFont(font);
|
||||
font = font.deriveFont(Font.PLAIN, 72);
|
||||
usedFonts.clear();
|
||||
usedFonts.add(font);
|
||||
|
||||
usedFonts.clear();
|
||||
usedFonts.add(font);
|
||||
|
||||
fontSize = size;
|
||||
antiAliasEnabled = antiAlias;
|
||||
setRenderingHints();
|
||||
fontSize = size;
|
||||
antiAliasEnabled = antiAlias;
|
||||
setRenderingHints();
|
||||
}
|
||||
}
|
||||
|
||||
int fontHeight(String s) {
|
||||
|
||||
Reference in new issue
Block a user