Fix Some Selection Logic and Such in the Fullscreen Move Systems

This commit is contained in:
Kam committed 2026-03-09 23:03:53 -04:00
1 parent 248b56ec1f
commit b6b6eb5548
4 files changed
+21 -11

No files matched your search

@@ -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) {
@@ -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
}
}
}
@@ -19,6 +19,7 @@ public class GuiCustomScroll extends GuiScreen {
public static final ResourceLocation resource = new ResourceLocation("customnpcs", "textures/gui/misc.png");
public List<String> list;
public final HashMap<String, Integer> colors = new HashMap<>();
public final HashSet<String> 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;
}
@@ -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);