方块

需要配置的部分

一个完整的方块配置包含以下部分:

  • 行为

方块行为
  • 设置

方块设置
  • 状态

方块状态
  • 战利品

战利品系统

完整配置预览

这是使用模板系统的简化版本,包括需要配置的部分。

blocks:
  default:palm_log:
    behavior:
      type: strippable_block
      stripped: default:stripped_palm_log
    loot:
      template: loot_table:normal
      arguments:
        item: default:palm_log
    settings:
      template: block_settings:log
      overrides:
        item: default:palm_log
    states:
      template: states:log
      arguments:
        base_block: note_block
        texture_top_path: minecraft:block/custom/palm_log_top
        texture_side_path: minecraft:block/custom/palm_log
        model_vertical_path: minecraft:block/custom/palm_log
        model_horizontal_path: minecraft:block/custom/palm_log_horizontal
        vanilla_id:
          type: self_increase_int
          from: 0
          to: 2
        internal_id:
          type: self_increase_int
          from: 0
          to: 2

如果不使用模板会发生什么?那么这个方块的配置文件将如下所示:

blocks:
  default:palm_log:
    behavior:
      type: strippable_block
      stripped: default:stripped_palm_log
    loot:
      pools:
        - rolls: 1
          conditions:
            - type: survives_explosion
          entries:
            - type: item
              item: "default:palm_log"
    settings:
      hardness: 2.0
      resistance: 2.0
      push-reaction: NORMAL
      replaceable: false
      burnable: true
      burn-chance: 5
      fire-spread-chance: 5
      is-redstone-conductor: true
      is-suffocating: true
      instrument: BASS
      can-occlude: true
      item: default:palm_log
      tags:
        - minecraft:mineable/axe
        - minecraft:logs_that_burn
        - minecraft:logs
        - minecraft:completes_find_tree_tutorial
      sounds:
        break: minecraft:block.wood.break
        step: minecraft:block.wood.step
        place: minecraft:block.wood.place
        hit: minecraft:block.wood.hit
        fall: minecraft:block.wood.fall
    states:
      properties:
        axis:
          type: axis
          default: y
      appearances:
        axisY:
          state: "note_block:0"
          model:
            path: "minecraft:block/custom/stripped_palm_log"
            generation:
              parent: "minecraft:block/cube_column"
              textures:
                "end": "minecraft:block/custom/palm_log_top"
                "side": "minecraft:block/custom/palm_log"
        axisX:
          state: "note_block:1"
          model:
            x: 90
            y: 90
            path: "minecraft:block/custom/stripped_palm_log_horizontal"
            generation:
              parent: "minecraft:block/cube_column_horizontal"
              textures:
                "end": "minecraft:block/custom/palm_log_top"
                "side": "minecraft:block/custom/palm_log"
        axisZ:
          state: "note_block:2"
          model:
            x: 90
            path: "minecraft:block/custom/stripped_palm_log_horizontal"
            generation:
              parent: "minecraft:block/cube_column_horizontal"
              textures:
                "end": "minecraft:block/custom/palm_log_top"
                "side": "minecraft:block/custom/palm_log"
      variants:
        axis=x:
          appearance: axisX
          id: 0
        axis=y:
          appearance: axisY
          id: 1
        axis=z:
          appearance: axisZ
          id: 2

如果您还没有学会如何使用模板系统,请务必马上学习

模板 [必读]

最后更新于

这有帮助吗?