KubeJS 箱子物品

KubeJS 箱子物品

为Chest Curio Item添加了KubeJS兼容性

此模组允许使用 KubeJS 脚本创建一些新的胸甲饰品。

支持的项目类型:

  • 普通饰品
StartupEvents.registry('item', event => {
    event.create('item_id', 'chest_item:item_base')
        .displayName('itemName')
        .maxStackSize(1)
        .addAttribute(
            'minecraft:generic.max_health',
            'chest_item:item_max_health',
            0.2,
            'add_multiplied_base'
        )
        .texture('modid:item/texture')
})
  • 暗影饰品
StartupEvents.registry('item', event => {
    event.create('item_id', 'chest_item:item_black_shadow')
        .displayName('itemName')
        .maxStackSize(1)
       .addAttribute(
            'chest_item:shadow_shield',
            'chest_item:item_shadow_shield',
            4,
            'add_value'
        )
        .texture('modid:item/texture')
  • 强化组件
StartupEvents.registry('item', event => {
    event.create('item_id', 'chest_item:reinforced_item')
        .displayName('itemName')
        .loot(false)  // 是否应将其加入战利品表
        .valueSan(2)  // 理智值
        .addAttribute(
            'minecraft:generic.max_health',
            'chest_item:item_shadow_shield',
            -0.1,
            'add_multiplied_total'
        )
        .maxStackSize(1)
        .texture('modid:item/texture')
})
  • 邪母饰品
StartupEvents.registry('item', event => {
    event.create('item_id', 'chest_item:evil_mother')
        .displayName('itemName')
        .valueSan(-3)  // 理智值
        .maxStackSize(1)
        .texture('modid:item/texture')
})
  • 瓶子(及其关联的信念)
StartupEvents.registry('item', event => {
    event.create('bottle_id', 'chest_item:memory')
        .displayName('bottle')
        .setMemoryString("kubejs","memory_id")
        .maxStackSize(1)
        .texture('modid:item/texture')
})
// 你必须创建一个额外的物品
// 此 ID 必须与上述代码对应
StartupEvents.registry('item', event => {
    event.create('memory_id', 'chest_item:memory_tooltip')
        .displayName('memoryName')
        .setComponent("大号字符")
        .setComponentText("小号字符")
        .setColor(0xffffff)
        .maxStackSize(1)
        .texture('modid:item/texture')
})

此模组还添加了一些谓词方法,用于检查玩家是否装备了相关的饰品、强化组件或信念:

  if (ChestKubeJSHandler.has(player,Item.of('modid:item'))) {
      // 你的具体实现方法
  }
  if (ChestKubeJSHandler.hasReinforced(player,Item.of('modid:item'))){
      // 你的具体实现方法
  }
  if (ChestKubeJSHandler.hasMemory(player, "modid:item")) {
      // 你的具体实现方法
  }