Don't use names for item suggestions
This commit is contained in:
+6
-6
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user