Block

Create a basic block

blocks:
  default:fairy_flower:
    behavior:
      type: bush_block
    settings:
      template: settings:surface_decoration
      overrides:
        item: default:fairy_flower
    loot:
      template: loot_table:normal_block
      params:
        item: default:fairy_flower
    state:
      base: tripwire
      id: 0
      vanilla-state: 0
      models:
        - path: "minecraft:block/custom/fairy_flower_1"
          weight: 100
        - path: "minecraft:block/custom/fairy_flower_2"
          weight: 5
          generation:
            parent: "minecraft:block/custom/fairy_flower_1"
            textures:
              "0": "minecraft:block/custom/fairy_flower_2"
        - path: "minecraft:block/custom/fairy_flower_3"
          weight: 5
          generation:
            parent: "minecraft:block/custom/fairy_flower_1"
            textures:
              "0": "minecraft:block/custom/fairy_flower_3"
        - path: "minecraft:block/custom/fairy_flower_4"
          weight: 5
          generation:
            parent: "minecraft:block/custom/fairy_flower_1"
            textures:
              "0": "minecraft:block/custom/fairy_flower_4"
        - path: "minecraft:block/custom/fairy_flower_5"
          weight: 1
          generation:
            parent: "minecraft:block/custom/fairy_flower_1"
            textures:
              "0": "minecraft:block/custom/fairy_flower_5"

Create a block with variants

blocks:
  default:spirit_log:
    behavior:
      type: falling_block
    loot:
      template: loot_table:normal_block
      params:
        item: default:spirit_log
    settings:
      template: settings:log
      overrides:
        item: default:spirit_log
        map-color: 16
        luminance: 8
    states:
      base: note_block
      properties:
        axis:
          type: axis
          default-value: y
      appearances:
        axisY:
          vanilla-state: 0
          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"
        axisX:
          vanilla-state: 1
          model:
            x: 90
            y: 90
            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"
        axisZ:
          vanilla-state: 2
          model:
            x: 90
            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"
      variants:
        axis=x:
          appearance: axisX
          id: 0
        axis=y:
          appearance: axisY
          id: 1
        axis=z:
          appearance: axisZ
          id: 2

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:
  default: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:
      type: block_item
      block: default:spirit_log

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