//放入\kubejs\client_scripts中,仅在游戏启动生效一次
onEvent('jei.hide.items', event => {
const NS = 'refinedstorage';
const COLORS = [
'white', 'orange', 'magenta', 'yellow', 'lime', 'pink',
'gray', 'light_gray', 'cyan', 'purple', 'blue', 'brown',
'green', 'red', 'black'
];
let hidden = 0;
const ids = Ingredient.of(`@${NS}`).itemIds; // 所有 RS 物品 ID
ids.forEach(fullId => {
const id = String(fullId); // refinedstorage:purple_grid
if (!id.startsWith(NS + ':')) return;
const path = id.slice(NS.length + 1); // purple_grid
// 判断是否以 “color_” 开头
if (COLORS.some(c => path.startsWith(c + '_'))) {
event.hide(id);
console.info(`[KubeJS] JEI hidden refinedstorage colored item: ${id}`);
hidden++;
}
});
console.info(`[KubeJS] JEI hidden refinedstorage colored items: ${hidden}`);
});
![[1.16.5]使用KubeJS在JEI中隐藏所有RS没用的染色方块-第1张图片](//www.mcmod.cn/static/public/images/loading-colourful.gif)