1
0
Fork 0

fix unused armor slots showing up in gui

This commit is contained in:
Sen 2025-08-22 00:48:09 +02:00
parent 906517479f
commit ae0b11272d
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
4 changed files with 4 additions and 5 deletions

View file

@ -1287,7 +1287,7 @@ public class Client implements IThreadListener {
int xPos = xoff * scale; int xPos = xoff * scale;
for(int index = 0; index < size; ++index) { for(int index = 0; index < size; ++index) {
ItemStack itemstack = this.player.getStackInSlot(index); ItemStack itemstack = this.player.getStackInSlot(index);
if(itemstack != null && (width >= 20 || index == selected)) { if(itemstack != null && (width >= 17 || index == selected)) {
GuiContainer.renderItemOverlay(itemstack, GuiContainer.renderItemOverlay(itemstack,
xPos, by, null, index == this.player.getSelectedIndex() ? this.controller.getUseCooldown() : 0, this.controller.getUseCooldownMax(), scale); xPos, by, null, index == this.player.getSelectedIndex() ? this.controller.getUseCooldown() : 0, this.controller.getUseCooldownMax(), scale);
} }

View file

@ -302,6 +302,7 @@ public abstract class GuiContainer extends Gui
if(this.inventorySlots != null) { if(this.inventorySlots != null) {
for (int i1 = 0; i1 < this.inventorySlots.inventorySlots.size(); ++i1) { for (int i1 = 0; i1 < this.inventorySlots.inventorySlots.size(); ++i1) {
Slot slot = this.inventorySlots.inventorySlots.get(i1); Slot slot = this.inventorySlots.inventorySlots.get(i1);
if(slot.getTexture() == null || !slot.getTexture().isEmpty())
this.slot(slot.xDisplayPosition - 1, slot.yDisplayPosition - 1, 18, 18, slot); this.slot(slot.xDisplayPosition - 1, slot.yDisplayPosition - 1, 18, 18, slot);
} }
} }

View file

@ -101,9 +101,7 @@ public abstract class Window {
GLFWImage img = GLFWImage.create(); GLFWImage img = GLFWImage.create();
img.width(w); img.width(w);
img.height(h); img.height(h);
// java.nio.ByteBuffer pbuf = ;
img.pixels(BufferUtils.createByteBuffer(icon.length).put(icon).rewind()); img.pixels(BufferUtils.createByteBuffer(icon.length).put(icon).rewind());
// img.pixels(icon.length / 4);
GLFWImage.Buffer buf = GLFWImage.create(1).put(img).rewind(); GLFWImage.Buffer buf = GLFWImage.create(1).put(img).rewind();
glfwSetWindowIcon(window, buf); glfwSetWindowIcon(window, buf);
} }

View file

@ -47,7 +47,7 @@ public class ContainerPlayer extends Container {
return stack != null && stack.getItem() instanceof ItemArmor armor && armor.getArmorType().canUseInSlot(ContainerPlayer.this.thePlayer, type); return stack != null && stack.getItem() instanceof ItemArmor armor && armor.getArmorType().canUseInSlot(ContainerPlayer.this.thePlayer, type);
} }
public String getTexture() { 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()) : "";
} }
}); });
} }