diff options
| author | Lorenz <ESs95s3P5z8Pheb> | 2022-07-08 16:12:55 +0200 |
|---|---|---|
| committer | Lorenz <ESs95s3P5z8Pheb> | 2022-07-08 16:12:55 +0200 |
| commit | 8b010e26f2c70f53b2d288c4348caf8638f20093 (patch) | |
| tree | 9245b4eed7f410f1c168688a77eeda6bfd55c994 /src/main/java/com/thatgravyboat/skyblockhud/textures/Textures.java | |
| parent | c8b5138a20b12abb22567928b3c1485636a888e0 (diff) | |
| download | SkyHanni-8b010e26f2c70f53b2d288c4348caf8638f20093.tar.gz SkyHanni-8b010e26f2c70f53b2d288c4348caf8638f20093.tar.bz2 SkyHanni-8b010e26f2c70f53b2d288c4348caf8638f20093.zip | |
code cleanup
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud/textures/Textures.java')
| -rw-r--r-- | src/main/java/com/thatgravyboat/skyblockhud/textures/Textures.java | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/textures/Textures.java b/src/main/java/com/thatgravyboat/skyblockhud/textures/Textures.java deleted file mode 100644 index bddc76339..000000000 --- a/src/main/java/com/thatgravyboat/skyblockhud/textures/Textures.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.thatgravyboat.skyblockhud.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 at.lorenz.mod.LorenzMod; -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); - } -} |
