From d5fd2c97e9c251a40526ea5c26d5cd4937fbf4f1 Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 23 May 2026 16:18:50 +0000 Subject: [PATCH] jei_hides: use .concat instead of array-spread (Rhino compat). 0.21.0 -> 0.21.1. KubeJS uses Rhino as its JS engine, which doesn't support array-spread syntax (`[...a, ...b]`). The line `[...WAYSTONE_ITEMS, ...COIN_ITEMS] .forEach(...)` threw EvaluatorException: syntax error at jei_hides.js:46 on client launch, surfacing the KubeJS client script errors dialog. Fix: use Array.prototype.concat() which is universal JS. Also extracted the hide-quietly helper into a named function for readability. --- .../kubejs/client_scripts/jei_hides.js | 17 +++++++++++------ pack/pack.lock.json | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/pack/overrides/kubejs/client_scripts/jei_hides.js b/pack/overrides/kubejs/client_scripts/jei_hides.js index eb6db8d..637a36e 100644 --- a/pack/overrides/kubejs/client_scripts/jei_hides.js +++ b/pack/overrides/kubejs/client_scripts/jei_hides.js @@ -42,12 +42,17 @@ const COIN_ITEMS = [ 'numismatics:sun', ]; +// Some IDs may not exist (e.g. base 'waystones:sharestone' isn't +// registered if only colored variants are). Swallow per-item failures +// so one bad id doesn't break the whole pass. +function hideQuietly(event, id) { + try { event.hide(id); } catch (e) {} +} + JEIEvents.hideItems(event => { - [...WAYSTONE_ITEMS, ...COIN_ITEMS].forEach(id => { - try { event.hide(id); } catch (e) { - // Some IDs may not exist (e.g. base 'waystones:sharestone' isn't - // registered if only colored variants are). Swallow per-item - // failures so one bad id doesn't break the whole pass. - } + // KubeJS uses Rhino, which doesn't support array-spread syntax + // (`[...a, ...b]`). Use .concat() for cross-engine safety. + WAYSTONE_ITEMS.concat(COIN_ITEMS).forEach(function(id) { + hideQuietly(event, id); }); }); diff --git a/pack/pack.lock.json b/pack/pack.lock.json index 156fb6e..fe54bab 100644 --- a/pack/pack.lock.json +++ b/pack/pack.lock.json @@ -1,7 +1,7 @@ { "$schema": "Brass-and-Sigil pack.lock.json - generated, do not edit by hand unless you know what you are doing", "name": "Brass and Sigil", - "version": "0.21.0", + "version": "0.21.1", "minecraft": "1.21.1", "loader": { "type": "neoforge", -- 2.52.0