From 609200fac7cd24db8a1f6559e40b7e33e3f383bc Mon Sep 17 00:00:00 2001 From: Ranzu <66495944+Ranzuu@users.noreply.github.com> Date: Tue, 3 Mar 2026 01:18:04 +0100 Subject: [PATCH] Added Empty/Unused Slot texture/Quick Docs on old layout (#27) --- .../baubles/client/gui/GuiPlayerExpanded.java | 58 +++++++++++++++++- .../java/baubles/common/BaublesConfig.java | 2 +- .../baubles/common/container/SlotBauble.java | 6 +- .../textures/gui/bauble_background.png | Bin 1320 -> 1763 bytes 4 files changed, 62 insertions(+), 4 deletions(-) diff --git a/src/main/java/baubles/client/gui/GuiPlayerExpanded.java b/src/main/java/baubles/client/gui/GuiPlayerExpanded.java index 557697c..3fbbc30 100644 --- a/src/main/java/baubles/client/gui/GuiPlayerExpanded.java +++ b/src/main/java/baubles/client/gui/GuiPlayerExpanded.java @@ -52,6 +52,12 @@ public class GuiPlayerExpanded extends GuiContainer implements INEIGuiHandler { private static final ResourceLocation creative_inventory_tabs = new ResourceLocation("textures/gui/container/creative_inventory/tabs.png"); private static final boolean hasLwjgl3 = Loader.isModLoaded("lwjgl3ify"); + private static final int UNUSED_SLOT_U = 7; + private static final int UNUSED_SLOT_V = 160; + private static final int UNUSED_SLOT_SIZE = 24; + private static final int UNUSED_SLOT_OFFSET = (UNUSED_SLOT_SIZE - 18) / 2; + private static final int UNUSED_SLOT_SHIFT_X = 2; + private static final int UNUSED_SLOT_SHIFT_Y = 2; /** * x size of the inventory window in pixels. Defined as float, passed as int. @@ -181,13 +187,17 @@ public class GuiPlayerExpanded extends GuiContainer implements INEIGuiHandler { } // Bauble slot backgrounds + this.mc.getTextureManager().bindTexture(useOldGuiRendering ? background : gui_background); for (int slotIndex = 0; slotIndex < BaubleExpandedSlots.slotLimit; slotIndex++) { String slotType = BaubleExpandedSlots.getSlotType(slotIndex); if (!BaublesConfig.showUnusedSlots && slotType.equals(BaubleExpandedSlots.unknownType)) { continue; } + boolean isUnusedSlot = slotType.equals(BaubleExpandedSlots.unknownType); if (useOldGuiRendering) { - drawTexturedModalRect(slotStartX + (slotOffset * (slotIndex / 4)), slotStartY + (slotOffset * (slotIndex % 4)), 200, 0, 18, 18); + int x = slotStartX + (slotOffset * (slotIndex / 4)); + int y = slotStartY + (slotOffset * (slotIndex % 4)); + drawTexturedModalRect(x, y, 200, 0, 18, 18); } else { // Draw the background rect at the slot's actual display position so it // automatically follows scrolling and stays in sync with the item rendering. @@ -195,7 +205,51 @@ public class GuiPlayerExpanded extends GuiContainer implements INEIGuiHandler { if (baubleSlot == null || baubleSlot.yDisplayPosition == -2000) { continue; } - drawTexturedModalRect(guiLeft + baubleSlot.xDisplayPosition, guiTop + baubleSlot.yDisplayPosition, 200, 0, 18, 18); + int x = guiLeft + baubleSlot.xDisplayPosition; + int y = guiTop + baubleSlot.yDisplayPosition; + if (isUnusedSlot) { + drawTexturedModalRect( + x - UNUSED_SLOT_OFFSET + UNUSED_SLOT_SHIFT_X, + y - UNUSED_SLOT_OFFSET + UNUSED_SLOT_SHIFT_Y, + UNUSED_SLOT_U, + UNUSED_SLOT_V, + UNUSED_SLOT_SIZE, + UNUSED_SLOT_SIZE + ); + } else { + drawTexturedModalRect(x, y, 200, 0, 18, 18); + } + } + } + + if (!useOldGuiRendering) { + int activeSlots = BaubleExpandedSlots.slotsCurrentlyUsed(); + int totalRows = (activeSlots + columns - 1) / columns; + int renderedCells = totalRows * columns; + int slotRowOffset = 0; + if (needsScrollBars()) { + int shownRows = 8; + slotRowOffset = (int) (this.currentScroll * (totalRows - shownRows) + 0.5F); + if (slotRowOffset < 0) { + slotRowOffset = 0; + } + } + for (int slotIndex = activeSlots; slotIndex < renderedCells; slotIndex++) { + int row = slotIndex / columns; + int scrolledRow = row - slotRowOffset; + int y = guiTop + 12 + (slotOffset * scrolledRow); + if (y < guiTop + 12 || y > guiTop + 8 * 18) { + continue; + } + int x = guiLeft - 18 - (18 * (slotIndex % columns)); + drawTexturedModalRect( + x - UNUSED_SLOT_OFFSET + UNUSED_SLOT_SHIFT_X, + y - UNUSED_SLOT_OFFSET + UNUSED_SLOT_SHIFT_Y, + UNUSED_SLOT_U, + UNUSED_SLOT_V, + UNUSED_SLOT_SIZE, + UNUSED_SLOT_SIZE + ); } } } diff --git a/src/main/java/baubles/common/BaublesConfig.java b/src/main/java/baubles/common/BaublesConfig.java index 8192dfe..79c22fc 100644 --- a/src/main/java/baubles/common/BaublesConfig.java +++ b/src/main/java/baubles/common/BaublesConfig.java @@ -46,7 +46,7 @@ public class BaublesConfig { //categoryClient useOldGuiButton = config.getBoolean("useOldGuiButton", categoryClient, useOldGuiButton, "Use the old Baubles Button texture and location instead.\n"); - useOldGuiRendering = config.getBoolean("useOldRendering", categoryClient, useOldGuiRendering, "Display the old Bauble GUI instead of the new sidebar.\n"); + useOldGuiRendering = config.getBoolean("useOldRendering", categoryClient, useOldGuiRendering, "Display the old Bauble GUI instead of the new sidebar.\nUsing over 20 slots in old rendering is not supported.\n"); maxColumns = config.getInt("maxColumns", categoryClient, 4, 1, 5, "Maximum number of columns shown in the baubles inventory (1-5).\n" ); diff --git a/src/main/java/baubles/common/container/SlotBauble.java b/src/main/java/baubles/common/container/SlotBauble.java index 68a2f57..0e3a185 100644 --- a/src/main/java/baubles/common/container/SlotBauble.java +++ b/src/main/java/baubles/common/container/SlotBauble.java @@ -5,6 +5,7 @@ import baubles.api.IBauble; import baubles.api.expanded.BaubleExpandedSlots; import baubles.api.expanded.IBaubleExpanded; import baubles.common.Baubles; +import baubles.common.BaublesConfig; import baubles.common.ItemDebugger; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -77,9 +78,12 @@ public class SlotBauble extends Slot { return 1; } - @Override + @Override @SideOnly(Side.CLIENT) public IIcon getBackgroundIconIndex() { + if (!BaublesConfig.useOldGuiRendering && BaubleExpandedSlots.unknownType.equals(slotType)) { + return null; + } return ((ItemDebugger) Baubles.itemDebugger).getBackgroundIconForSlotType(slotType); } diff --git a/src/main/resources/assets/baubles/textures/gui/bauble_background.png b/src/main/resources/assets/baubles/textures/gui/bauble_background.png index 1bca05aa2c760cbc3ce3d1e3e6bf7a0ef255f6b3..df3c33294e66fb649cf4c8540630e8c62474eb33 100644 GIT binary patch literal 1763 zcmc&!c}&w+9Dlzb#TJ;uirOhms!VVmrQnznhZHSh7X?JB=x6~q5VQh=GH9x_utmmD z>n4a|r43@HAPBl_1=2%-MPL*`H{~i72UI!Aky?&I_kQ3qGu`pWl6{kx_xaw(d--Mt z`uokdUSl?z|6Borzj!1|Efe|sWT#CPMFxi9RMsaidim*ftjbxD_ zj3@?U4In_q5-dY3XLElDIr|qFmIGEJ7PE2`VmAZ@M0g*7Cnf_oE9XFr5o0L=bQXWy zf6fX3RGz^D9JHmnZ=fR5xwu%rmeRRc=OD%ig^|%&%OKB95WVnnqf#+#o1{9Jc{oW4 z{X`79PjCu*utOf}z;wuX+)CK3Vr~jWvKe^GMcf+S>^C#NxwG3^hF%>=Uq~li3DHFd z(Q;1}?6~Jdw0U>&aVe-9SlSfw#5RhfFO5{|d4&-U*m`k|IZCUwKCRg=_`aoF zF8BH7ZF@tMY6COozN?yYQ(%4>WB@~Exta9o*E>D_;WU;VH? zX=){I^J3w*0g})5^(XiLQt~kp(kDNsKfXvva%I1_F;2s&uSj`5u%EBs8)I)B3y$s` zs{pE&a==L#AytFxQ|wis!I;0k%lM<5Z=8ARM19~olVR(qXq5-gXe6DhYATv99T{nh zAIVJ=bSMQ%mT48*pyx4{C~5;Li%{yt#+f0CC|hKnb^`GoIwzG{?Vp^)OCIWoiS1H! zvPE8KXfNAEGZk&CZNBU`IF>q5*X26X*Cg3kRaNyIgonF>$gfMfZ-0*W)5BJ>H2pPv zi8XEFk@q_wKJ+Lb4Bnw+De2O6t;sxC@`6F zoO^tMl-W^L`w2(w(|U9Y&Lz{b!^~ZvcWmN9 zlR+>jxW8N#!yH0FhU2#|=ShuIPi*tNQ>RP4g!hYVXsz0{_NkE%%}<&f9XG4na9?~9 zxx&=$4}5>TzFVI>oiVwK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