Don't use names for item suggestions

This commit is contained in:
2026-09-27 00:45:00 -03:00
parent 8c7ca92891
commit 52587aabf7
5 changed files with 16 additions and 27 deletions
+6 -6
View File
@@ -342,7 +342,7 @@ export function choice<T extends string>(options: readonly T[]): ArgumentType<T>
}
// an id from a registry. without a namespace it's whichever id has that name, as long as only one does
function registry_id(registry: string, what: string, names: (id: string) => string | undefined): ArgumentType<string> {
function registry_id(registry: string, what: string): ArgumentType<string> {
return {
parse(text) {
if (text.includes(":")) {
@@ -361,15 +361,15 @@ function registry_id(registry: string, what: string, names: (id: string) => stri
return EverythingRegistry.entries(registry)
.map(([id]) => id)
.filter((id) => id !== "bworld:air" && (id.startsWith(partial) || id.split(":")[1].startsWith(partial)))
.map((id) => ({ text: id, tooltip: names(id) }));
.map((id) => ({ text: id }));
},
};
}
export function item(names: (id: string) => string | undefined = () => undefined): ArgumentType<string> {
return registry_id("items", "item", names);
export function item(): ArgumentType<string> {
return registry_id("items", "item");
}
export function block(names: (id: string) => string | undefined = () => undefined): ArgumentType<string> {
return registry_id("blocks", "block", names);
export function block(): ArgumentType<string> {
return registry_id("blocks", "block");
}