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.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"));