Block

Create a basic block

blocks:
  spirit_log:
    default-state:
      block-state: minecraft:note_block[instrument=bell,note=0,powered=false]
      model:
        path: "minecraft:block/custom/spirit_log"
        generation:
          parent: "minecraft:block/cube_column"
          textures:
            "end": "minecraft:block/custom/spirit_log_top"
            "side": "minecraft:block/custom/spirit_log"

Create a block with variants

blocks:
  spirit_log:
    properties:
      axis:
        type: axis
        default-value: y
    default-state:
      block-state: minecraft:note_block[instrument=bell,note=0,powered=false]
      model:
        path: "minecraft:block/custom/spirit_log"
        generation:
          parent: "minecraft:block/cube_column"
          textures:
            "end": "minecraft:block/custom/spirit_log_top"
            "side": "minecraft:block/custom/spirit_log"
    variants:
      axis=x:
        block-state: minecraft:note_block[instrument=bell,note=1,powered=false]
        properties:
          x: 90
          y: 90
        model:
          path: "minecraft:block/custom/spirit_log_horizontal"
          generation:
            parent: "minecraft:block/cube_column_horizontal"
            textures:
              "end": "minecraft:block/custom/spirit_log_top"
              "side": "minecraft:block/custom/spirit_log"
      axis=z:
        block-state: minecraft:note_block[instrument=bell,note=2,powered=false]
        properties:
          x: 90
        model:
          path: "minecraft:block/custom/spirit_log_horizontal"
          generation:
            parent: "minecraft:block/cube_column_horizontal"
            textures:
              "end": "minecraft:block/custom/spirit_log_top"
              "side": "minecraft:block/custom/spirit_log"

Unlike other plugins, in the design of this plugin, items and blocks are separated. Just like in Minecraft's design, some blocks appear as 2D items in the inventory but become 3D when placed. Some blocks look the same before and after placement, while others, like the End Portal block, do not even have a corresponding item form.

You will notice that in this case, the item is also called spirit_log, but this does not conflict with the spirit_log in the block configs because these two IDs are essentially registered in different registries.

items:
  spirit_log:
    material: paper
    custom-model-data: 1000
    data:
      display-name: "<lang:block.spirit_log>"
    model:
      path: "minecraft:item/custom/spirit_log"
      generation:
        parent: "minecraft:block/custom/spirit_log"
    behavior:
      block-item:
        block: default:spirit_log
        place-logics: axis_block

In this example, we created an item associated with the block, and its model inherits from the block's model, so it appears the same as the block. Here, we utilized the placeable_block behavior, which is one of the default behaviors provided by the plugin, offering a block placement mechanism similar to the vanilla Minecraft system. Of course, there are many other types of mechanisms available, including custom ones registered through the api, to suit various needs.

Last updated