Skip to content

Commit

Permalink
Optimise reload overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
ThexXTURBOXx committed Oct 27, 2024
1 parent d484329 commit f3ebbb2
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import ckathode.weaponmod.item.IItemWeapon;
import ckathode.weaponmod.item.MeleeComponent;
import ckathode.weaponmod.item.RangedComponent;
import com.mojang.blaze3d.platform.Window;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.Minecraft;
Expand All @@ -31,7 +30,6 @@ public static void renderGUIOverlay(GuiGraphics guiGraphics) {
}

private static void renderForHand(InteractionHand hand, Player p, GuiGraphics guiGraphics) {
Minecraft mc = Minecraft.getInstance();
int currentItem = p.getInventory().selected;

IItemWeapon item = null;
Expand Down Expand Up @@ -68,11 +66,10 @@ private static void renderForHand(InteractionHand hand, Player p, GuiGraphics gu
if (!set) return;

HumanoidArm offHandSide = p.getMainArm().getOpposite();
Window window = mc.getWindow();
int x0 = window.getGuiScaledWidth() / 2 + (hand == InteractionHand.OFF_HAND ?
int x0 = guiGraphics.guiWidth() / 2 + (hand == InteractionHand.OFF_HAND ?
(offHandSide == HumanoidArm.LEFT ? -120 : 91)
: -91 - 1 + currentItem * 20);
int y0 = window.getGuiScaledHeight() + 1;
int y0 = guiGraphics.guiHeight() + 1;
int tx = hand == InteractionHand.OFF_HAND ? (offHandSide == HumanoidArm.LEFT ? 24 : 53) : 0;
int width = hand == InteractionHand.OFF_HAND ? 29 : 24;
int height = (int) (f * 24);
Expand Down

0 comments on commit f3ebbb2

Please sign in to comment.