aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/thatgravyboat/skyblockhud/textures/TextureObject.java
diff options
context:
space:
mode:
authorLorenz <ESs95s3P5z8Pheb>2022-07-07 00:31:50 +0200
committerLorenz <ESs95s3P5z8Pheb>2022-07-07 00:31:50 +0200
commit99773d6a593c444151503de315f127bea6f74d49 (patch)
tree9ee1ae505e5f82aba62f10c882af85a3acd6e483 /src/main/java/com/thatgravyboat/skyblockhud/textures/TextureObject.java
downloadskyhanni-99773d6a593c444151503de315f127bea6f74d49.tar.gz
skyhanni-99773d6a593c444151503de315f127bea6f74d49.tar.bz2
skyhanni-99773d6a593c444151503de315f127bea6f74d49.zip
init lorenz mod
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud/textures/TextureObject.java')
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/textures/TextureObject.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/textures/TextureObject.java b/src/main/java/com/thatgravyboat/skyblockhud/textures/TextureObject.java
new file mode 100644
index 000000000..6403e18bc
--- /dev/null
+++ b/src/main/java/com/thatgravyboat/skyblockhud/textures/TextureObject.java
@@ -0,0 +1,37 @@
+package com.thatgravyboat.skyblockhud.textures;
+
+import com.google.gson.JsonObject;
+import java.util.Arrays;
+import net.minecraft.util.ResourceLocation;
+
+public class TextureObject {
+
+ public String displayName;
+ public ResourceLocation bars = resource("bars.png");
+ public ResourceLocation mines = resource("mines.png");
+ public ResourceLocation playerStats = resource("playerstats.png");
+ public ResourceLocation stats = resource("stats.png");
+ public ResourceLocation dungeon = resource("dungeon.png");
+ public ResourceLocation dialogue = resource("dialogue.png");
+
+ public TextureObject(String displayName) {
+ this.displayName = displayName;
+ }
+
+ public static TextureObject decode(JsonObject json) {
+ TextureObject textureObject = new TextureObject(json.get("displayName").getAsString());
+ Arrays
+ .stream(textureObject.getClass().getDeclaredFields())
+ .filter(field -> field.getType().equals(ResourceLocation.class))
+ .forEach(field -> {
+ try {
+ field.set(textureObject, new ResourceLocation(json.get(field.getName()).getAsString()));
+ } catch (Exception ignored) {}
+ });
+ return textureObject;
+ }
+
+ private static ResourceLocation resource(String path) {
+ return new ResourceLocation("skyblockhud", path);
+ }
+}