diff options
author | Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> | 2023-03-29 15:26:27 -0400 |
---|---|---|
committer | Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> | 2023-03-29 15:26:27 -0400 |
commit | 43edaf777e2f6ae8a9ee004930c6bbfc4bfa1b55 (patch) | |
tree | 9ce511f6ce1e823d894d784f2f61f9ddf7ec7911 /src/main/java/me/xmrvizzy/skyblocker/skyblock/quicknav/QuickNavButton.java | |
parent | 7d491f0351ba8d12f03a79339cea4c2d0d80a45a (diff) | |
download | Skyblocker-43edaf777e2f6ae8a9ee004930c6bbfc4bfa1b55.tar.gz Skyblocker-43edaf777e2f6ae8a9ee004930c6bbfc4bfa1b55.tar.bz2 Skyblocker-43edaf777e2f6ae8a9ee004930c6bbfc4bfa1b55.zip |
Cleaned up code
Diffstat (limited to 'src/main/java/me/xmrvizzy/skyblocker/skyblock/quicknav/QuickNavButton.java')
-rw-r--r-- | src/main/java/me/xmrvizzy/skyblocker/skyblock/quicknav/QuickNavButton.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/quicknav/QuickNavButton.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/quicknav/QuickNavButton.java index ef0f2d06..e31827ab 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/quicknav/QuickNavButton.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/quicknav/QuickNavButton.java @@ -6,6 +6,7 @@ import me.xmrvizzy.skyblocker.mixin.HandledScreenAccessor; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder; @@ -20,7 +21,7 @@ public class QuickNavButton extends ClickableWidget { private static final MinecraftClient CLIENT = MinecraftClient.getInstance(); private static final Identifier BUTTON_TEXTURE = new Identifier("textures/gui/container/creative_inventory/tabs.png"); - private int index; + private final int index; private boolean toggled; private int u; private int v; @@ -37,8 +38,7 @@ public class QuickNavButton extends ClickableWidget { private void updateCoordinates() { Screen screen = MinecraftClient.getInstance().currentScreen; - if (screen instanceof HandledScreen<?>) { - HandledScreen<?> handledScreen = (HandledScreen<?>) screen; + if (screen instanceof HandledScreen<?> handledScreen) { int x = ((HandledScreenAccessor)handledScreen).getX(); int y = ((HandledScreenAccessor)handledScreen).getY(); int w = ((HandledScreenAccessor)handledScreen).getBackgroundWidth(); @@ -71,16 +71,16 @@ public class QuickNavButton extends ClickableWidget { if (!this.toggled) { if (this.index >= 6) // this.drawTexture(matrices, this.x, this.y + 4, this.u, this.v + 4, this.width, this.height - 4); - this.drawTexture(matrices, this.getX(), this.getY() + 4, this.u, this.v + 4, this.width, this.height - 4); + DrawableHelper.drawTexture(matrices, this.getX(), this.getY() + 4, this.u, this.v + 4, this.width, this.height - 4); else // this.drawTexture(matrices, this.x, this.y, this.u, this.v, this.width, this.height - 4); - this.drawTexture(matrices, this.getX(), this.getY() - 2, this.u, this.v, this.width, this.height - 4); + DrawableHelper.drawTexture(matrices, this.getX(), this.getY() - 2, this.u, this.v, this.width, this.height - 4); // } else this.drawTexture(matrices, this.x, this.y, this.u, this.v, this.width, this.height); } else { matrices.push(); //Move the top buttons 2 pixels up if they're selected if (this.index < 6) matrices.translate(0f, -2f, 0f); - this.drawTexture(matrices, this.getX(), this.getY(), this.u, this.v, this.width, this.height); + DrawableHelper.drawTexture(matrices, this.getX(), this.getY(), this.u, this.v, this.width, this.height); matrices.pop(); } // render button icon |