From ae0b11272d0bf522cdfe17d08857157fafbacb28 Mon Sep 17 00:00:00 2001 From: Sen Date: Fri, 22 Aug 2025 00:48:09 +0200 Subject: [PATCH] fix unused armor slots showing up in gui --- client/src/main/java/client/Client.java | 2 +- client/src/main/java/client/gui/container/GuiContainer.java | 3 ++- client/src/main/java/client/window/Window.java | 2 -- common/src/main/java/common/inventory/ContainerPlayer.java | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/client/src/main/java/client/Client.java b/client/src/main/java/client/Client.java index 41a20344..f2d8ac9c 100755 --- a/client/src/main/java/client/Client.java +++ b/client/src/main/java/client/Client.java @@ -1287,7 +1287,7 @@ public class Client implements IThreadListener { int xPos = xoff * scale; for(int index = 0; index < size; ++index) { ItemStack itemstack = this.player.getStackInSlot(index); - if(itemstack != null && (width >= 20 || index == selected)) { + if(itemstack != null && (width >= 17 || index == selected)) { GuiContainer.renderItemOverlay(itemstack, xPos, by, null, index == this.player.getSelectedIndex() ? this.controller.getUseCooldown() : 0, this.controller.getUseCooldownMax(), scale); } diff --git a/client/src/main/java/client/gui/container/GuiContainer.java b/client/src/main/java/client/gui/container/GuiContainer.java index 96ed8ed6..7ca5a3fb 100755 --- a/client/src/main/java/client/gui/container/GuiContainer.java +++ b/client/src/main/java/client/gui/container/GuiContainer.java @@ -302,7 +302,8 @@ public abstract class GuiContainer extends Gui if(this.inventorySlots != null) { for (int i1 = 0; i1 < this.inventorySlots.inventorySlots.size(); ++i1) { Slot slot = this.inventorySlots.inventorySlots.get(i1); - this.slot(slot.xDisplayPosition - 1, slot.yDisplayPosition - 1, 18, 18, slot); + if(slot.getTexture() == null || !slot.getTexture().isEmpty()) + this.slot(slot.xDisplayPosition - 1, slot.yDisplayPosition - 1, 18, 18, slot); } } if(this.gm.itemCheat) { diff --git a/client/src/main/java/client/window/Window.java b/client/src/main/java/client/window/Window.java index b29e7a29..d4d6a692 100644 --- a/client/src/main/java/client/window/Window.java +++ b/client/src/main/java/client/window/Window.java @@ -101,9 +101,7 @@ public abstract class Window { GLFWImage img = GLFWImage.create(); img.width(w); img.height(h); -// java.nio.ByteBuffer pbuf = ; img.pixels(BufferUtils.createByteBuffer(icon.length).put(icon).rewind()); -// img.pixels(icon.length / 4); GLFWImage.Buffer buf = GLFWImage.create(1).put(img).rewind(); glfwSetWindowIcon(window, buf); } diff --git a/common/src/main/java/common/inventory/ContainerPlayer.java b/common/src/main/java/common/inventory/ContainerPlayer.java index af4f584a..7599f154 100755 --- a/common/src/main/java/common/inventory/ContainerPlayer.java +++ b/common/src/main/java/common/inventory/ContainerPlayer.java @@ -47,7 +47,7 @@ public class ContainerPlayer extends Container { return stack != null && stack.getItem() instanceof ItemArmor armor && armor.getArmorType().canUseInSlot(ContainerPlayer.this.thePlayer, type); } public String getTexture() { - return ContainerPlayer.this.thePlayer.hasArmorSlot(type) ? (type.isRing() ? "ring" : type.getName()) : null; + return ContainerPlayer.this.thePlayer.hasArmorSlot(type) ? (type.isRing() ? "ring" : type.getName()) : ""; } }); }