Skip to content
Clexus edited this page Jan 21, 2025 · 1 revision

配置文件中有一个叫做 components 的部分, 代表的就是原版的物品组件. 因为通过命令编辑太过复杂,所以请直接在文件中编辑.

注意: 要在服务器运行的时候编辑文件, 你需要在 config.yml 中将 fs_lock 设置为 false

有关物品组件的更多信息见

样例配置(也是所有支持的组件)

components:
  banner_patterns:
    layer_1:
      color: black
      pattern: base
    layer_2:
      color: yellow
      pattern: creeper
  consumable:
    animation: eat
    consume_seconds: 1.6
    has_consume_particles: true
    on_consume_effects:
      effect_1:
        type: "apply_effects"
        effects:
          effect_1:
            id: "speed"
            amplifier: 1
            duration: 100
            probability: 0.8
          effect_2:
            id: "strength"
            amplifier: 10
            duration: 100
            probability: 1
      effect_2:
        type: "clear_all_effects"
  can_place_on:
    - grass_block
    - stone
  can_break:
    - stone
  damage_resistance: "in_fire"
  death_protection:
    death_effects:
      effect_1:
        type: "apply_effects"
        effects:
          speed_boost:
            id: "speed"
            amplifier: 1
            duration: 300
            probability: 0.7
          regeneration_boost:
            id: "regeneration"
            amplifier: 2
            duration: 400
            probability: 0.5
      effect_2:
        type: "clear_all_effects"
      effect_3:
        type: "play_sound"
        sound: "entity.player.burp"
      effect_4:
        type: "remove_effects"
        effects:
          - "speed"
          - "strength"
      effect_5:
        type: "teleport_randomly"
        diameter: 20.0
  dyed_color: "255,255,255"
  enchantable: 5
  enchantment_glint_override: true
  equippable:
    slot: chest
    allowed_entites:
    - player
    asset_id: "grass_block"
    camera_overlay: "example:example"
    damage_on_hurt: true
    equip_sound: "entity.player.death"
    swappable: true
  food:
    can_always_eat: true
    nutrition: 10
    saturation: 10
  glider: true
  hide_addtional_tooltip: true
  hide_tooltip: true
  intangible_projectile: true
  max_damage: 500
  max_stack_size: 1
  rarity: epic
  tool:
    damage_per_block: 5
    default_mining_speed: 5
    rules:
    - blocks: "minecraft:stone"
      speed: 2.0
      correct_for_drops: true
    - blocks:
        - "minecraft:dirt"
        - "minecraft:gravel"
      speed: 120
      correct_for_drops: false
    - blocks: "minecraft:diamond_ore"
      speed: 3.0
      correct_for_drops: true
  tooltip_style: "example:example"
  trim:
    material: diamond
    pattern: bolt
  use_cooldown:
    seconds: 5
    cooldown_group: "example:example"
  use_remainder: "rpgitem-id"

只有几个地方需要注意:

  • dyed_color: 用RGB颜色格式

  • max_damagemax_stack_size: 物品不能同时拥有 max_damagemax_stack_size 组件, 如果你设置了 max_damage, 你就不能设置 max_stack_size, 或者设置其值为 1, 如果你设置了 max_stack_size, 你就不能设置 max_damage, 无论其值为何.

  • effect_1,layer_1: 这些都是ID, 你不需要让它们叫 effect_x 或者 layer_x, 想叫啥都行, 只要不重复就行.

  • 删除组件: 有些组件在物品上默认存在, 比如盔甲上就有 equippable 组件, 如果你想删除这些组件,你可以像下面这样设置:

    equippable:
      unset: true
    hide_tooltip:
      unset: true

    该方法对所有组件都有效.

Clone this wiki locally