From a11a04cc1161a4ed55b85fa9bec877094f1e8e9d Mon Sep 17 00:00:00 2001 From: nextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com> Date: Sat, 23 Apr 2022 13:51:31 +0100 Subject: mod page, pages, and some more stuff --- .../java/io/polyfrost/oneconfig/lwjgl/image/ImageLoader.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/main/java/io/polyfrost/oneconfig/lwjgl/image') diff --git a/src/main/java/io/polyfrost/oneconfig/lwjgl/image/ImageLoader.java b/src/main/java/io/polyfrost/oneconfig/lwjgl/image/ImageLoader.java index 6fbd27f..4a35959 100644 --- a/src/main/java/io/polyfrost/oneconfig/lwjgl/image/ImageLoader.java +++ b/src/main/java/io/polyfrost/oneconfig/lwjgl/image/ImageLoader.java @@ -10,6 +10,7 @@ import org.lwjgl.stb.STBImage; import org.lwjgl.system.MemoryStack; import java.io.BufferedReader; +import java.io.InputStream; import java.io.InputStreamReader; import java.nio.ByteBuffer; import java.nio.CharBuffer; @@ -46,7 +47,16 @@ public class ImageLoader { public boolean loadSVGImage(String fileName) { if(!NSVGImageHashMap.containsKey(fileName)) { try { - CharSequence s = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("oneconfig", fileName)).getInputStream())).readLine(); + InputStream inputStream = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("oneconfig", fileName)).getInputStream(); + StringBuilder resultStringBuilder = new StringBuilder(); + try (BufferedReader br + = new BufferedReader(new InputStreamReader(inputStream))) { + String line; + while ((line = br.readLine()) != null) { + resultStringBuilder.append(line); + } + } + CharSequence s = resultStringBuilder.toString(); System.out.println(s); NSVGImage image = NanoSVG.nsvgParse(s, "px", 96f); NSVGImageHashMap.put(fileName, image); -- cgit