improvements

This commit is contained in:
2026-09-28 23:01:07 +02:00
parent 27a42a076b
commit 3206b1b3f1
2 changed files with 18 additions and 3 deletions
+7 -2
View File
@@ -3951,6 +3951,12 @@
return results;
}
function propItemOptions(items, search) {
const query = String(search || '').trim().toLowerCase();
return { '': 'Select a matching item...', ...Object.fromEntries(items
.filter((id) => id.toLowerCase().includes(query)).map((id) => [id, id])) };
}
function propJson(source, path) {
const content = source.read(path);
return content ? JSON.parse(content.toString('utf8').replace(/^\uFEFF/, '')) : null;
@@ -4388,8 +4394,7 @@
item_search: { label: 'Search available items', type: 'text', value: '', placeholder: 'Search by item ID',
condition: (result) => result.mode === 'item' && !!state.items.length },
item_choice: { label: 'Choose item', type: 'select', value: '',
options: () => ({ '': 'Select a matching item...', ...Object.fromEntries(state.items
.filter((id) => id.includes(state.search.toLowerCase())).slice(0, 100).map((id) => [id, id])) }),
options: () => propItemOptions(state.items, state.search),
condition: (result) => result.mode === 'item' && !!state.items.length },
_manual: { type: 'info', text: '### Manual texture fallback\nFor items with a special renderer, choose a PNG to preview an extruded sprite. This does not change the in-game model.',
condition: (result) => result.mode === 'item' },