From a39b05ffc231cab58e637d51e5e5daab2bc040d5 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 13 Jun 2024 21:59:28 -0400 Subject: [PATCH] Scanner -> BufferedReader --- core/src/mindustry/ui/Fonts.java | 18 +++++++++++------- gradle.properties | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/core/src/mindustry/ui/Fonts.java b/core/src/mindustry/ui/Fonts.java index 29945aa9d2..78da3b7a43 100644 --- a/core/src/mindustry/ui/Fonts.java +++ b/core/src/mindustry/ui/Fonts.java @@ -24,7 +24,7 @@ import mindustry.ctype.*; import mindustry.game.*; import mindustry.gen.*; -import java.util.*; +import java.io.*; public class Fonts{ private static final String mainFont = "fonts/font.woff"; @@ -117,9 +117,9 @@ public class Fonts{ Texture uitex = Core.atlas.find("logo").texture; int size = (int)(Fonts.def.getData().lineHeight/Fonts.def.getData().scaleY); - try(Scanner scan = new Scanner(Core.files.internal("icons/icons.properties").read(512))){ - while(scan.hasNextLine()){ - String line = scan.nextLine(); + try(var reader = Core.files.internal("icons/icons.properties").reader(Vars.bufferSize)){ + String line; + while((line = reader.readLine()) != null){ String[] split = line.split("="); String[] nametex = split[1].split("\\|"); String character = split[0], texture = nametex[1]; @@ -154,6 +154,8 @@ public class Fonts{ glyph.page = 0; fonts.each(f -> f.getData().setGlyph(ch, glyph)); } + }catch(IOException e){ + throw new RuntimeException(e); } stringIcons.put("alphachan", stringIcons.get("alphaaaa")); @@ -177,9 +179,9 @@ public class Fonts{ } public static void loadContentIconsHeadless(){ - try(Scanner scan = new Scanner(Core.files.internal("icons/icons.properties").read(512))){ - while(scan.hasNextLine()){ - String line = scan.nextLine(); + try(var reader = Core.files.internal("icons/icons.properties").reader(Vars.bufferSize)){ + String line; + while((line = reader.readLine()) != null){ String[] split = line.split("="); String[] nametex = split[1].split("\\|"); String character = split[0]; @@ -188,6 +190,8 @@ public class Fonts{ unicodeIcons.put(nametex[0], ch); stringIcons.put(nametex[0], ((char)ch) + ""); } + }catch(IOException e){ + throw new RuntimeException(e); } stringIcons.put("alphachan", stringIcons.get("alphaaaa")); diff --git a/gradle.properties b/gradle.properties index 585e33f06e..2c4907ab1d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -25,4 +25,4 @@ org.gradle.caching=true #used for slow jitpack builds; TODO see if this actually works org.gradle.internal.http.socketTimeout=100000 org.gradle.internal.http.connectionTimeout=100000 -archash=7138ef8769 +archash=98900b203b