From b6b6eb554896d075a1ad8fe93ff5bdc4e9424083 Mon Sep 17 00:00:00 2001 From: Kam Date: Mon, 9 Mar 2026 23:03:53 -0400 Subject: [PATCH] Fix Some Selection Logic and Such in the Fullscreen Move Systems --- .../gui/GuiNpcMobSpawnerFullscreen.java | 2 +- .../advanced/SubGuiAbilityVariantSelect.java | 5 +++- .../npcs/client/gui/util/GuiCustomScroll.java | 23 +++++++++++-------- .../gui/util/GuiDirectoryCategorized.java | 2 ++ 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/main/java/noppes/npcs/client/gui/GuiNpcMobSpawnerFullscreen.java b/src/main/java/noppes/npcs/client/gui/GuiNpcMobSpawnerFullscreen.java index 80e0a971f..eabc33fee 100644 --- a/src/main/java/noppes/npcs/client/gui/GuiNpcMobSpawnerFullscreen.java +++ b/src/main/java/noppes/npcs/client/gui/GuiNpcMobSpawnerFullscreen.java @@ -199,7 +199,7 @@ public class GuiNpcMobSpawnerFullscreen extends GuiDirectory implements IGuiData navScroll.setSelected(getNavSelection()); navScroll.scrollY = Math.min(savedNavScroll, Math.max(0, navScroll.maxScrollY)); - // Phase 2: color nav items orange (selectable) or red (current location, not selectable) + // Phase 2: color nav items orange (selectable) or red (current location) if (movePhase == 2) { String currentNav = getNavSelection(); for (String name : navNames) { diff --git a/src/main/java/noppes/npcs/client/gui/advanced/SubGuiAbilityVariantSelect.java b/src/main/java/noppes/npcs/client/gui/advanced/SubGuiAbilityVariantSelect.java index 1c65d0dc6..be7ba5645 100644 --- a/src/main/java/noppes/npcs/client/gui/advanced/SubGuiAbilityVariantSelect.java +++ b/src/main/java/noppes/npcs/client/gui/advanced/SubGuiAbilityVariantSelect.java @@ -88,12 +88,15 @@ public class SubGuiAbilityVariantSelect extends SubGuiInterface implements ICust scroll.setSize(190, 155); // Mark blank separators and group headers as non-interactive colored entries + scroll.nonInteractive.add(""); scroll.colors.put("", 0x000000); if (lastGroup != null) { for (int i = 0; i < variants.size(); i++) { String group = variants.get(i).getGroup(); - if (group != null) + if (group != null) { + scroll.nonInteractive.add(group); scroll.colors.put(group, 0xFFFF00); // Yellow + } } } diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiCustomScroll.java b/src/main/java/noppes/npcs/client/gui/util/GuiCustomScroll.java index f9b3df568..fc8bf30eb 100644 --- a/src/main/java/noppes/npcs/client/gui/util/GuiCustomScroll.java +++ b/src/main/java/noppes/npcs/client/gui/util/GuiCustomScroll.java @@ -19,6 +19,7 @@ public class GuiCustomScroll extends GuiScreen { public static final ResourceLocation resource = new ResourceLocation("customnpcs", "textures/gui/misc.png"); public List list; public final HashMap colors = new HashMap<>(); + public final HashSet nonInteractive = new HashSet<>(); public int id; public int guiLeft = 0; @@ -217,21 +218,25 @@ public class GuiCustomScroll extends GuiScreen { } else text = displayString; - // Entries with a custom color are non-interactive (headers/separators) + // Non-interactive entries (headers/separators) — colored, no hover/selection Integer customColor = colors.get(rawEntry); - if (customColor != null) { + if (nonInteractive.contains(rawEntry)) { if (!text.isEmpty()) - fontRendererObj.drawString(text, j, k, customColor); + fontRendererObj.drawString(text, j, k, customColor != null ? customColor : 0xffffff); } else if ((multipleSelection && selectedList.contains(text)) || (!multipleSelection && selected == i)) { drawVerticalLine(j - 2, k - 4, k + 10, 0xffffffff); drawVerticalLine(j + xSize - 18 + xOffset, k - 4, k + 10, 0xffffffff); drawHorizontalLine(j - 2, j + xSize - 18 + xOffset, k - 3, 0xffffffff); drawHorizontalLine(j - 2, j + xSize - 18 + xOffset, k + 10, 0xffffffff); - fontRendererObj.drawString(text, j, k, 0xffffff); + int selColor = customColor != null ? customColor : 0xffffff; + fontRendererObj.drawString(text, j, k, selColor); } else if (i == hover) { - fontRendererObj.drawString(text, j, k, 0x00ff00); - } else - fontRendererObj.drawString(text, j, k, 0xffffff); + int hoverColor = customColor != null ? customColor : 0x00ff00; + fontRendererObj.drawString(text, j, k, hoverColor); + } else { + int defaultColor = customColor != null ? customColor : 0xffffff; + fontRendererObj.drawString(text, j, k, defaultColor); + } } } @@ -252,8 +257,8 @@ public class GuiCustomScroll extends GuiScreen { continue; } - // Skip non-interactive entries (colored headers/separators) - if (colors.containsKey(list.get(j1))) { + // Skip non-interactive entries (headers/separators) + if (nonInteractive.contains(list.get(j1))) { continue; } diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiDirectoryCategorized.java b/src/main/java/noppes/npcs/client/gui/util/GuiDirectoryCategorized.java index 04717d8ed..e8be1249a 100644 --- a/src/main/java/noppes/npcs/client/gui/util/GuiDirectoryCategorized.java +++ b/src/main/java/noppes/npcs/client/gui/util/GuiDirectoryCategorized.java @@ -245,6 +245,8 @@ public abstract class GuiDirectoryCategorized extends GuiDirectory for (String name : navNames) { catScroll.colors.put(name, name.equals(prevCatName) ? 0xFF5555 : 0xFFAA00); } + } else if (movePhase == 0) { + catScroll.setSelectable(true); } addScroll(catScroll);