Simplify lobby particle menus

Every menu item now acts on a plain click: slots open their editor with a
use button, entries open their editor, and duplicating is gone. The entry
editor groups settings into labelled rows, numbers and colours get their
own screens instead of relying on right click or Q, and slot names show
the particles per tick used out of the maximum.
This commit is contained in:
2026-10-26 09:48:20 +01:00
parent 98f04451a4
commit b60cdfc88d
8 changed files with 347 additions and 221 deletions
@@ -41,8 +41,9 @@ class Pickers {
private final int BACK = 49;
// Basic designs first, then rewards; locked rewards are shown with their requirement but cannot be picked
void design(Player player, Consumer<ParticleDesign> onPick, Runnable onBack) {
// Basic designs first, then rewards; locked rewards are shown with their requirement but cannot be picked.
// The current design, if any, glows.
void design(Player player, ParticleDesign current, Consumer<ParticleDesign> onPick, Runnable onBack) {
UnlockContext context = new UnlockContext(SteamwarUser.get(player.getUniqueId()));
List<SWListInv.SWListEntry<ParticleDesign>> list = new ArrayList<>();
for (DesignVisibility visibility : List.of(DesignVisibility.BASIC, DesignVisibility.REWARD)) {
@@ -51,18 +52,20 @@ class Pickers {
List<String> lore = new ArrayList<>(requirement(design.getRequirement(), player));
boolean unlocked = design.getRequirement().test(context);
if (!lore.isEmpty()) lore.add("");
lore.add(msg(unlocked ? "PARTICLE_SELECT" : "PARTICLE_LOCKED", player));
list.add(new SWListInv.SWListEntry<>(new SWItem(design.getIcon(), designName(design, player), lore, false, clickType -> {
lore.add(msg(design == current ? "PARTICLE_VALUE_SELECTED" : unlocked ? "PARTICLE_SELECT" : "PARTICLE_LOCKED", player));
list.add(new SWListInv.SWListEntry<>(new SWItem(design.getIcon(), designName(design, player), lore, design == current, clickType -> {
}), unlocked ? design : null));
}
}
open(player, msg("PARTICLE_DESIGN_PICKER", player), list, onPick, onBack);
}
<E> void choice(Player player, ChoiceParameter<E> parameter, Function<E, Material> icon, Consumer<E> onPick, Runnable onBack) {
// Lists every option; the current one glows
<E> void choice(Player player, ChoiceParameter<E> parameter, E current, Function<E, Material> icon, Consumer<E> onPick, Runnable onBack) {
List<SWListInv.SWListEntry<E>> list = new ArrayList<>();
for (E value : parameter.getBuildableValues()) {
list.add(new SWListInv.SWListEntry<>(new SWItem(icon.apply(value), choiceName(parameter, value, player), clickType -> {
List<String> lore = List.of(msg(value == current ? "PARTICLE_VALUE_SELECTED" : "PARTICLE_SELECT", player));
list.add(new SWListInv.SWListEntry<>(new SWItem(icon.apply(value), choiceName(parameter, value, player), lore, value == current, clickType -> {
}), value));
}
open(player, msg("PARTICLE_CHOICE_PICKER", player, name(parameter.getNameKey(), player)), list, onPick, onBack);