Block Traits

PLEASE READ

This page will be part of a rewrite to accomodate for the removal of the Holiday Creator Feature experimental toggle. Expect this page to be rewritten or removed when this happens.

FORMAT & MIN ENGINE VERSION 1.20.60

Before you learn about block traits, you should be confident with block states.

When working with block states, ensure that the min_engine_version in your pack manifest is 1.20.20 or higher.

Applying Traits

Block traits can be used to apply vanilla block states (such as direction) to your custom blocks easily, without the need for events and triggers.

BP/blocks/custom_slab.jsonCopy
json
{
  "format_version": "1.20.60",
  "minecraft:block": {
    "description": {
      "identifier": "wiki:custom_slab",
      "menu_category": {
        "category": "construction",
        "group": "itemGroup.name.slab"
      },
      "traits": {
        "minecraft:placement_position": {
          "enabled_states": ["minecraft:vertical_half"]
        }
      }
    },
    "components": { ... },
    "permutations": [ ... ]
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

This example will set the minecraft:vertical_half block state when placed to either 'top' or 'bottom' - depending on where the player is looking.

Permutations are still required for this state to make a functional difference, with conditions querying

c
q.block_state('minecraft:vertical_half')
1

Placement Direction

Contains information about the player's rotation when the block was placed.

Released from experiment Upcoming Creator Features for format versions 1.20.60 and higher.

May enable the following states:

StateValuesDescription
minecraft:cardinal_direction"south" (default)
"north"
"west"
"east"
Cardinal facing direction of player when placed.
minecraft:facing_direction"down" (default)
"up"
"south"
"north"
"west"
"east"
Overall direction of player when placed.

Additional parameters:

  • y_rotation_offset - This rotation offset only applies to the horizontal state values (north, south, east, west) . Only axis-aligned angles may be specified (e.g. 90, 180, -90).
minecraft:block > description > traitsCopy
json
"minecraft:placement_direction": {
  "enabled_states": ["minecraft:cardinal_direction"],
  "y_rotation_offset": 180
}
1
2
3
4

Placement Position

Contains information about where the player placed the block.

Released from experiment Upcoming Creator Features for format versions 1.20.60 and higher.

May enable the following states:

StateValuesDescription
minecraft:block_face"down" (default)
"up"
"south"
"north"
"west"
"east"
Face on which the block was placed.
minecraft:vertical_half"top"
"bottom" (default)
The vertical half where the block was placed.

This trait has no additional parameters.

minecraft:block > description > traitsCopy
json
"minecraft:placement_position": {
  "enabled_states": [
    "minecraft:block_face",
    "minecraft:vertical_half"
  ]
}
1
2
3
4
5
6

Contributors

QuazChick