MC百科社群

标题: Kubejs 求助:将特定模组的所有物品注册名生成一个数组对象 [打印本页]

作者: QQ酱286363    时间: 2024-6-17 01:27
标题: Kubejs 求助:将特定模组的所有物品注册名生成一个数组对象
求助各位大佬,如何选中某个特定模组内的物品,并返回一个数组对象?
Kubejs文档中给出了一个选中特定标签并返回数组对象的实例:
  1. // Add all items from the forge:stone tag to the c:stone tag, unless the id contains diorite
  2.   const stones = event.get('forge:stone').getObjectIds()
  3.   const blacklist = Ingredient.of(/.*diorite.*/)
  4.   stones.forEach(stone => {
  5.     if (!blacklist.test(stone)) event.add('c:stone', stone)
  6.   })
复制代码
我希望对特定模组的物品也进行类似的操作,以便通过函数批量更改配方。例如,将机械动力模组所有物品中,注册名字符串中含有“andesite_alloy”的物品的配方全部删除。
本人 JS 水平有限,望各位大佬见谅!





欢迎光临 MC百科社群 (https://bbs.mcmod.cn/) MC百科|最大的MineCraft中文模组百科