summaryrefslogtreecommitdiff
path: root/src/main/java/com/thatgravyboat/skyblockhud_2/textures
diff options
context:
space:
mode:
authorLorenz <ESs95s3P5z8Pheb>2022-07-14 11:26:34 +0200
committerLorenz <ESs95s3P5z8Pheb>2022-07-14 11:26:34 +0200
commitc65416e03ce0791c4a99e9bdfc18c0fa0863028a (patch)
tree653e7e8bbfce0cb2f25592fd48b531f863c3575e /src/main/java/com/thatgravyboat/skyblockhud_2/textures
parentb2108f37f551fba5cb43f4919d69e5db7bb1e44c (diff)
downloadskyhanni-c65416e03ce0791c4a99e9bdfc18c0fa0863028a.tar.gz
skyhanni-c65416e03ce0791c4a99e9bdfc18c0fa0863028a.tar.bz2
skyhanni-c65416e03ce0791c4a99e9bdfc18c0fa0863028a.zip
remove old sbh/skyblockhud code
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud_2/textures')
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud_2/textures/TextureObject.java37
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud_2/textures/Textures.java56
2 files changed, 0 insertions, 93 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud_2/textures/TextureObject.java b/src/main/java/com/thatgravyboat/skyblockhud_2/textures/TextureObject.java
deleted file mode 100644
index 319afb82c..000000000
--- a/src/main/java/com/thatgravyboat/skyblockhud_2/textures/TextureObject.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.thatgravyboat.skyblockhud_2.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);
- }
-}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud_2/textures/Textures.java b/src/main/java/com/thatgravyboat/skyblockhud_2/textures/Textures.java
deleted file mode 100644
index 4bbadeba8..000000000
--- a/src/main/java/com/thatgravyboat/skyblockhud_2/textures/Textures.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.thatgravyboat.skyblockhud_2.textures;
-
-import com.google.common.collect.Lists;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.nio.charset.StandardCharsets;
-import java.util.List;
-import net.minecraft.client.resources.IResource;
-import net.minecraft.client.resources.IResourceManager;
-import net.minecraft.client.resources.IResourceManagerReloadListener;
-import net.minecraft.util.ResourceLocation;
-
-public class Textures implements IResourceManagerReloadListener {
-
- private static final TextureObject DEFAULT_TEXTURE = new TextureObject("Default");
-
- private static final Gson gson = new GsonBuilder().create();
- public static final List<TextureObject> styles = Lists.newArrayList(DEFAULT_TEXTURE);
- public static TextureObject texture = DEFAULT_TEXTURE;
-
- public static void setTexture(int selected) {
- if (selected >= styles.size() || selected < 0) {
- texture = DEFAULT_TEXTURE;
- // LorenzMod.config.misc.style = 0;
- } else {
- texture = styles.get(selected);
- }
- }
-
- @Override
- public void onResourceManagerReload(IResourceManager resourceManager) {
- styles.clear();
- styles.add(DEFAULT_TEXTURE);
- DEFAULT_TEXTURE.displayName = "Default";
- try {
- ResourceLocation stylesData = new ResourceLocation("skyblockhud:data/styles.json");
-
- for (IResource resource : resourceManager.getAllResources(stylesData)) {
- try (BufferedReader reader = new BufferedReader(new InputStreamReader(resource.getInputStream(), StandardCharsets.UTF_8))) {
- JsonObject jsonObject = gson.fromJson(reader, JsonObject.class);
- for (JsonElement json : jsonObject.getAsJsonArray("styles")) {
- styles.add(TextureObject.decode((JsonObject) json));
- }
- if (DEFAULT_TEXTURE.displayName.equals("Default") && jsonObject.has("defaultDisplayName") && jsonObject.get("defaultDisplayName").isJsonPrimitive()) {
- DEFAULT_TEXTURE.displayName = jsonObject.get("defaultDisplayName").getAsString();
- }
- }
- }
- } catch (Exception ignored) {}
- // if (LorenzMod.config != null) setTexture(LorenzMod.config.misc.style);
- }
-}