diff options
author | ThatGravyBoat <thatgravyboat@gmail.com> | 2021-07-21 12:15:27 -0230 |
---|---|---|
committer | ThatGravyBoat <thatgravyboat@gmail.com> | 2021-07-21 12:15:27 -0230 |
commit | 7db7137f5099d8f41be08689a54f704692574f4d (patch) | |
tree | 955436190b6db0bf61ce0cb87088b001c27079bb /src/main/java/com/thatgravyboat/skyblockhud/textures | |
parent | a8ee0a763eca9774895446eac13486a6ee42bdba (diff) | |
download | SkyblockHud-Death-Defied-7db7137f5099d8f41be08689a54f704692574f4d.tar.gz SkyblockHud-Death-Defied-7db7137f5099d8f41be08689a54f704692574f4d.tar.bz2 SkyblockHud-Death-Defied-7db7137f5099d8f41be08689a54f704692574f4d.zip |
Added Crystal Hollows Map, Updated Textures to check all resourcepacks and made it so that only 1 resourcepack can change the defaultName checking in the order in which the texturepacks are in the resourcepack menu.
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud/textures')
-rw-r--r-- | src/main/java/com/thatgravyboat/skyblockhud/textures/Textures.java | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/textures/Textures.java b/src/main/java/com/thatgravyboat/skyblockhud/textures/Textures.java index 8a6eb1d..c80b72f 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/textures/Textures.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/textures/Textures.java @@ -6,14 +6,15 @@ import com.google.gson.GsonBuilder; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.thatgravyboat.skyblockhud.SkyblockHud; +import net.minecraft.client.resources.IResource; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.IResourceManagerReloadListener; +import net.minecraft.util.ResourceLocation; + import java.io.BufferedReader; -import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.List; -import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.resources.IResourceManagerReloadListener; -import net.minecraft.util.ResourceLocation; public class Textures implements IResourceManagerReloadListener { @@ -39,14 +40,16 @@ public class Textures implements IResourceManagerReloadListener { DEFAULT_TEXTURE.displayName = "Default"; try { ResourceLocation stylesData = new ResourceLocation("skyblockhud:data/styles.json"); - InputStream is = resourceManager.getResource(stylesData).getInputStream(); - try (BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) { - JsonObject jsonObject = gson.fromJson(reader, JsonObject.class); - for (JsonElement json : jsonObject.getAsJsonArray("styles")) { - styles.add(TextureObject.decode((JsonObject) json)); - } - if (jsonObject.has("defaultDisplayName") && jsonObject.get("defaultDisplayName").isJsonPrimitive()) { - DEFAULT_TEXTURE.displayName = jsonObject.get("defaultDisplayName").getAsString(); + + 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) {} |