diff options
| author | nextdaydelivery <12willettsh@gmail.com> | 2022-02-21 12:22:02 +0000 |
|---|---|---|
| committer | nextdaydelivery <12willettsh@gmail.com> | 2022-02-21 12:22:02 +0000 |
| commit | 7c0db4bf55b5aa8f56bb7dda3e7b199e652dd5d3 (patch) | |
| tree | 51f684590ee75b7711651a50eea9b39242020e92 /src/main/java/io/polyfrost/oneconfig/themes/textures | |
| parent | dfa65f6236c226eb88f4e3761e10e80e5f37c22b (diff) | |
| download | OneConfig-7c0db4bf55b5aa8f56bb7dda3e7b199e652dd5d3.tar.gz OneConfig-7c0db4bf55b5aa8f56bb7dda3e7b199e652dd5d3.tar.bz2 OneConfig-7c0db4bf55b5aa8f56bb7dda3e7b199e652dd5d3.zip | |
various fixes and button stuff
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/themes/textures')
| -rw-r--r-- | src/main/java/io/polyfrost/oneconfig/themes/textures/TextureManager.java | 38 | ||||
| -rw-r--r-- | src/main/java/io/polyfrost/oneconfig/themes/textures/ThemeElement.java | 2 |
2 files changed, 22 insertions, 18 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/themes/textures/TextureManager.java b/src/main/java/io/polyfrost/oneconfig/themes/textures/TextureManager.java index 5825fb1..9b583ef 100644 --- a/src/main/java/io/polyfrost/oneconfig/themes/textures/TextureManager.java +++ b/src/main/java/io/polyfrost/oneconfig/themes/textures/TextureManager.java @@ -8,6 +8,7 @@ import net.minecraft.client.renderer.texture.DynamicTexture; import net.minecraft.crash.CrashReport; import net.minecraft.util.ReportedException; import net.minecraft.util.ResourceLocation; +import org.jetbrains.annotations.NotNull; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; @@ -15,6 +16,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; +import static io.polyfrost.oneconfig.themes.Themes.activeTheme; import static io.polyfrost.oneconfig.themes.Themes.themeLog; public class TextureManager { @@ -73,26 +75,28 @@ public class TextureManager { * @param width width of the image * @param height height of the image */ - public void draw(ThemeElement element, int x, int y, int width, int height) { - GlStateManager.enableBlend(); - GlStateManager.color(1f, 1f, 1f, 1f); - ResourceLocation location = resources.get(element.ordinal()); - mc.getTextureManager().bindTexture(location); - try { - if(!tickableTextures.isEmpty()) { - for (TickableTexture texture : tickableTextures) { - if (texture.getElement().equals(element)) { - texture.draw(x, y); - } else { - Gui.drawScaledCustomSizeModalRect(x, y, 0, 0, width, height, width, height, width, height); + public void draw(@NotNull ThemeElement element, int x, int y, int width, int height) { + if (activeTheme.isReady()) { + ResourceLocation location = resources.get(element.ordinal()); + mc.getTextureManager().bindTexture(location); + GlStateManager.enableBlend(); + try { + if (!tickableTextures.isEmpty()) { + for (TickableTexture texture : tickableTextures) { + if (texture.getElement().equals(element)) { + texture.draw(x, y); + } else { + Gui.drawScaledCustomSizeModalRect(x, y, 0, 0, width, height, width, height, width, height); + } } + } else { + Gui.drawScaledCustomSizeModalRect(x, y, 0, 0, width, height, width, height, width, height); } - } else { - Gui.drawScaledCustomSizeModalRect(x, y, 0, 0, width, height, width, height, width, height); + GlStateManager.disableBlend(); + GlStateManager.color(1f, 1f, 1f, 1f); + } catch (Exception e) { + themeLog.error("Error occurred drawing texture " + element.name() + ", is theme invalid?", e); } - GlStateManager.disableBlend(); - } catch (Exception e) { - themeLog.error("Error occurred drawing texture " + element.name() + ", is theme invalid?", e); } } } diff --git a/src/main/java/io/polyfrost/oneconfig/themes/textures/ThemeElement.java b/src/main/java/io/polyfrost/oneconfig/themes/textures/ThemeElement.java index 096b2aa..2ab3bc9 100644 --- a/src/main/java/io/polyfrost/oneconfig/themes/textures/ThemeElement.java +++ b/src/main/java/io/polyfrost/oneconfig/themes/textures/ThemeElement.java @@ -31,7 +31,7 @@ public enum ThemeElement { LOGO("textures/logos/logo.png", 128), SMALL_LOGO("textures/logos/logo_small.png", 64), - BUTTON_OFF("textures/window/button_off.png", 758), + BUTTON("textures/window/button.png", 758), BUTTON_HOVER("textures/window/button_hover.png", 758), BUTTON_CLICK("textures/window/button_click.png", 758), |
