aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/polyfrost/oneconfig/lwjgl/image
diff options
context:
space:
mode:
authornextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com>2022-04-23 13:51:31 +0100
committernextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com>2022-04-23 13:52:01 +0100
commita11a04cc1161a4ed55b85fa9bec877094f1e8e9d (patch)
tree423c49125b176dbabd72df562bd9b9e5f0397b02 /src/main/java/io/polyfrost/oneconfig/lwjgl/image
parent2b38d2d62391428a7fa40f268a4e65f876dd0e75 (diff)
downloadOneConfig-a11a04cc1161a4ed55b85fa9bec877094f1e8e9d.tar.gz
OneConfig-a11a04cc1161a4ed55b85fa9bec877094f1e8e9d.tar.bz2
OneConfig-a11a04cc1161a4ed55b85fa9bec877094f1e8e9d.zip
mod page, pages, and some more stuff
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/lwjgl/image')
-rw-r--r--src/main/java/io/polyfrost/oneconfig/lwjgl/image/ImageLoader.java12
1 files changed, 11 insertions, 1 deletions
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);