From 37575faabdc2d8a15b1d3ee5805626b7a7e15b2e Mon Sep 17 00:00:00 2001 From: MachieCodes Date: Wed, 8 Jan 2025 19:07:03 -0600 Subject: [PATCH] "Show Empty" Setting Render barrier icons for slots with no armor --- .../systems/hud/elements/ArmorHud.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/ArmorHud.java b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/ArmorHud.java index eda70a87d3..a3af9010e0 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/ArmorHud.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/ArmorHud.java @@ -41,6 +41,13 @@ public class ArmorHud extends HudElement { .build() ); + private final Setting showEmpty = sgGeneral.add(new BoolSetting.Builder() + .name("show-empty") + .description("Renders barrier icons for empty slots.") + .defaultValue(false) + .build() + ); + // Durability private final Setting durability = sgDurability.add(new EnumSetting.Builder() @@ -122,12 +129,16 @@ private void calculateSize() { public void render(HudRenderer renderer) { double x = this.x; double y = this.y; + double armorX; double armorY; int slot = flipOrder.get() ? 3 : 0; + int emptySlots = 0; + for (int position = 0; position < 4; position++) { ItemStack itemStack = getItem(slot); + if (itemStack.isEmpty()) emptySlots++; if (orientation.get() == Orientation.Vertical) { armorX = x; @@ -163,7 +174,7 @@ public void render(HudRenderer renderer) { else slot++; } - if (background.get()) { + if (background.get() && emptySlots < 4) { renderer.quad(this.x, this.y, getWidth(), getHeight(), backgroundColor.get()); } } @@ -178,7 +189,8 @@ private ItemStack getItem(int i) { }; } - return mc.player.getInventory().getArmorStack(i); + ItemStack stack = mc.player.getInventory().getArmorStack(i); + return stack.isEmpty() && showEmpty.get() ? Items.BARRIER.getDefaultStack() : stack; } private double getScale() {