diff --git a/src/main/java/nuparu/tinyinv/client/gui/InGameOverlayHelper.java b/src/main/java/nuparu/tinyinv/client/gui/InGameOverlayHelper.java index 89a0fce..c79d04d 100644 --- a/src/main/java/nuparu/tinyinv/client/gui/InGameOverlayHelper.java +++ b/src/main/java/nuparu/tinyinv/client/gui/InGameOverlayHelper.java @@ -117,9 +117,11 @@ private static void renderHotbarGraphics(GuiGraphics guiGraphics, int hotbarStar int totalSlots = 0; int row = 1; Alignment alignment = ClientConfig.hotbarAlignment.get(); + int numberOfRows = (int) Math.ceil((double) slots / slotsPerRow); + int check = (numberOfRows >= 2) ? 0 : 10 * (9 - slots); while (totalSlots < slots) { int slotsInRow = Math.min(slots - totalSlots, slotsPerRow); - int left = alignment == Alignment.LEFT ? hotbarStart : (alignment == Alignment.CENTER ? middle - (hotbarRowWidth(slotsInRow) / 2) : hotbarEnd - hotbarRowWidth(slotsInRow)); + int left = alignment == Alignment.LEFT ? hotbarStart - check : (alignment == Alignment.CENTER ? middle - (hotbarRowWidth(slotsInRow) / 2) : hotbarEnd - hotbarRowWidth(slotsInRow) + check); int top = screenHeight - 1 - (HOTBAR_SLOT_HEIGHT - 1) * (row); renderHotbarRow(guiGraphics, totalSlots, slotsInRow, left, top); totalSlots += slotsInRow; @@ -152,9 +154,11 @@ private static int renderHotbarItems(GuiGraphics guiGraphics, int hotbarStart, i int row = 1; Alignment alignment = ClientConfig.hotbarAlignment.get(); Order order = ClientConfig.hotbarRowOrder.get(); + int numberOfRows = (int) Math.ceil((double) slots / slotsPerRow); + int check = (numberOfRows >= 2) ? 0 : 10 * (9 - slots); while (totalSlots < slots) { int slotsInRow = Math.min(slots - totalSlots, slotsPerRow); - int left = alignment == Alignment.LEFT ? hotbarStart : (alignment == Alignment.CENTER ? middle - (hotbarRowWidth(slotsInRow) / 2) : hotbarEnd - hotbarRowWidth(slotsInRow)); + int left = alignment == Alignment.LEFT ? hotbarStart - check : (alignment == Alignment.CENTER ? middle - (hotbarRowWidth(slotsInRow) / 2) : hotbarEnd - hotbarRowWidth(slotsInRow) + check); int top = screenHeight - 1 - (HOTBAR_SLOT_HEIGHT - 1) * (row); l += renderHotbarItemsRow(guiGraphics, order == Order.NORMAL ? totalSlots : slots - totalSlots - slotsInRow, slotsInRow, left, top, partialTicks, player); totalSlots += slotsInRow; @@ -170,7 +174,7 @@ public static int renderHotbarItemsRow(GuiGraphics guiGraphics, int from, int am int k1 = top + 3; int normalized = SlotUtils.normalizeSlotId(from + slot); if(normalized == player.getInventory().selected){ - guiGraphics.blit(Textures.WIDGETS_LOCATION, j1 - 4, k1 - 4, 0, 22, 24, 23); + guiGraphics.blit(Textures.WIDGETS_LOCATION, j1 - 4, k1 - 4, 0, 22, 24, 24); } renderSlot(guiGraphics, j1, k1, partialTicks, player, player.getInventory().items.get(normalized), l++); }