diff options
author | ThatGravyBoat <ThatGravyBoat@users.noreply.github.com> | 2021-07-18 07:58:09 +0000 |
---|---|---|
committer | GitHub Action <actions@github.com> | 2021-07-18 07:58:09 +0000 |
commit | ccbaac36b14d52f072287775ba55bedb1131beb9 (patch) | |
tree | 92604e6451b48e462abaf4ac4d00cce9f939ab96 /src/main/java/com/thatgravyboat/skyblockhud/textures | |
parent | 5559861e52a788f08bc48946a9aad6dd52b373bf (diff) | |
download | SkyblockHud-Death-Defied-ccbaac36b14d52f072287775ba55bedb1131beb9.tar.gz SkyblockHud-Death-Defied-ccbaac36b14d52f072287775ba55bedb1131beb9.tar.bz2 SkyblockHud-Death-Defied-ccbaac36b14d52f072287775ba55bedb1131beb9.zip |
Prettified Code!
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud/textures')
-rw-r--r-- | src/main/java/com/thatgravyboat/skyblockhud/textures/TextureObject.java | 14 | ||||
-rw-r--r-- | src/main/java/com/thatgravyboat/skyblockhud/textures/Textures.java | 4 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/textures/TextureObject.java b/src/main/java/com/thatgravyboat/skyblockhud/textures/TextureObject.java index 10495f5..3af2ac1 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/textures/TextureObject.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/textures/TextureObject.java @@ -14,24 +14,26 @@ public class TextureObject { public ResourceLocation dungeon = resource("dungeon.png"); public ResourceLocation dialogue = resource("dialogue.png"); - public TextureObject(String displayName){ + 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 -> { + 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){ + private static ResourceLocation resource(String path) { return new ResourceLocation("skyblockhud", path); } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/textures/Textures.java b/src/main/java/com/thatgravyboat/skyblockhud/textures/Textures.java index 61b19b7..871c145 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/textures/Textures.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/textures/Textures.java @@ -16,13 +16,14 @@ 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){ + public static void setTexture(int selected) { if (selected >= styles.size() || selected < 0) { texture = DEFAULT_TEXTURE; SkyblockHud.config.misc.style = 0; @@ -45,5 +46,4 @@ public class Textures implements IResourceManagerReloadListener { } } catch (Exception ignored) {} } - } |