Scanner -> BufferedReader

This commit is contained in:
Anuken
2024-06-13 21:59:28 -04:00
parent d8e5818a45
commit a39b05ffc2
2 changed files with 12 additions and 8 deletions

View File

@@ -24,7 +24,7 @@ import mindustry.ctype.*;
import mindustry.game.*; import mindustry.game.*;
import mindustry.gen.*; import mindustry.gen.*;
import java.util.*; import java.io.*;
public class Fonts{ public class Fonts{
private static final String mainFont = "fonts/font.woff"; private static final String mainFont = "fonts/font.woff";
@@ -117,9 +117,9 @@ public class Fonts{
Texture uitex = Core.atlas.find("logo").texture; Texture uitex = Core.atlas.find("logo").texture;
int size = (int)(Fonts.def.getData().lineHeight/Fonts.def.getData().scaleY); int size = (int)(Fonts.def.getData().lineHeight/Fonts.def.getData().scaleY);
try(Scanner scan = new Scanner(Core.files.internal("icons/icons.properties").read(512))){ try(var reader = Core.files.internal("icons/icons.properties").reader(Vars.bufferSize)){
while(scan.hasNextLine()){ String line;
String line = scan.nextLine(); while((line = reader.readLine()) != null){
String[] split = line.split("="); String[] split = line.split("=");
String[] nametex = split[1].split("\\|"); String[] nametex = split[1].split("\\|");
String character = split[0], texture = nametex[1]; String character = split[0], texture = nametex[1];
@@ -154,6 +154,8 @@ public class Fonts{
glyph.page = 0; glyph.page = 0;
fonts.each(f -> f.getData().setGlyph(ch, glyph)); fonts.each(f -> f.getData().setGlyph(ch, glyph));
} }
}catch(IOException e){
throw new RuntimeException(e);
} }
stringIcons.put("alphachan", stringIcons.get("alphaaaa")); stringIcons.put("alphachan", stringIcons.get("alphaaaa"));
@@ -177,9 +179,9 @@ public class Fonts{
} }
public static void loadContentIconsHeadless(){ public static void loadContentIconsHeadless(){
try(Scanner scan = new Scanner(Core.files.internal("icons/icons.properties").read(512))){ try(var reader = Core.files.internal("icons/icons.properties").reader(Vars.bufferSize)){
while(scan.hasNextLine()){ String line;
String line = scan.nextLine(); while((line = reader.readLine()) != null){
String[] split = line.split("="); String[] split = line.split("=");
String[] nametex = split[1].split("\\|"); String[] nametex = split[1].split("\\|");
String character = split[0]; String character = split[0];
@@ -188,6 +190,8 @@ public class Fonts{
unicodeIcons.put(nametex[0], ch); unicodeIcons.put(nametex[0], ch);
stringIcons.put(nametex[0], ((char)ch) + ""); stringIcons.put(nametex[0], ((char)ch) + "");
} }
}catch(IOException e){
throw new RuntimeException(e);
} }
stringIcons.put("alphachan", stringIcons.get("alphaaaa")); stringIcons.put("alphachan", stringIcons.get("alphaaaa"));

View File

@@ -25,4 +25,4 @@ org.gradle.caching=true
#used for slow jitpack builds; TODO see if this actually works #used for slow jitpack builds; TODO see if this actually works
org.gradle.internal.http.socketTimeout=100000 org.gradle.internal.http.socketTimeout=100000
org.gradle.internal.http.connectionTimeout=100000 org.gradle.internal.http.connectionTimeout=100000
archash=7138ef8769 archash=98900b203b