Block Orientation
FORMAT VERSION 1.26.0
This tutorial assumes a basic understanding of blocks, including block states and block traits. Check out the blocks guide before starting.
Types of Orientation
- Used by logs and basalt.
- 3 axis-aligned orientations.
- Used by item frames and ladders.
- 6 attachments: down, up, north, south, west and east.
- Used by carved pumpkins and furnaces.
- 4 directions: north, south, west and east.
- Used by dispensers and observers.
- 6 directions: down, up, north, south, west and east.
- Used by banners, conduits, mob heads and signs.
- 16 directions (at 22.5 degree intervals)
Axis Alignment
Block rotation identical to how vanilla logs rotate.
Trait
To set the state which determines the block's attachment, we will use the minecraft:placement_position block trait with the minecraft:block_face state enabled.
The state contains more values than we need for log rotation, so some permutations will look identical.
"description": {
"identifier": "wiki:log_rotation_example",
// Block traits are defined here
"traits": {
"minecraft:placement_position": {
"enabled_states": ["minecraft:block_face"] // Can be used in queries e.g. `q.block_state('minecraft:block_face') == 'north'`
}
}
}Permutations
Rotation makes use of block permutations. Each permutation contains the minecraft:transformation component, which allows for cardinal rotation by checking the minecraft:block_face state and applying an appropriate rotation.
"permutations": [
// X axis
{
"condition": "q.block_state('minecraft:block_face') == 'west' || q.block_state('minecraft:block_face') == 'east'",
"components": {
"minecraft:transformation": { "rotation": [0, 0, 90] }
}
},
// Y axis
{
"condition": "q.block_state('minecraft:block_face') == 'down' || q.block_state('minecraft:block_face') == 'up'",
"components": {
"minecraft:transformation": { "rotation": [0, 0, 0] }
}
},
// Z axis
{
"condition": "q.block_state('minecraft:block_face') == 'north' || q.block_state('minecraft:block_face') == 'south'",
"components": {
"minecraft:transformation": { "rotation": [90, 0, 0] }
}
}
]Cardinal Orientation
Trait
To set the state which determines the block's direction, we will use the minecraft:placement_direction block trait with the minecraft:cardinal_direction state enabled.
"description": {
"identifier": "wiki:cardinal_direction_example",
// Block traits are defined here
"traits": {
"minecraft:placement_direction": {
"enabled_states": ["minecraft:cardinal_direction"], // Can be used in queries e.g. `q.block_state('minecraft:cardinal_direction') == 'north'`
"y_rotation_offset": 180 // Face towards player
}
}
}Permutations
Rotation makes use of block permutations. Each permutation contains the minecraft:transformation component, which allows for cardinal rotation by checking the minecraft:cardinal_direction state and applying an appropriate rotation.
The below rotation values assume that the front of your model is facing north.
"permutations": [
// Facing north
{
"condition": "q.block_state('minecraft:cardinal_direction') == 'north'",
"components": {
"minecraft:transformation": { "rotation": [0, 0, 0] }
}
},
// Facing west
{
"condition": "q.block_state('minecraft:cardinal_direction') == 'west'",
"components": {
"minecraft:transformation": { "rotation": [0, 90, 0] }
}
},
// Facing south
{
"condition": "q.block_state('minecraft:cardinal_direction') == 'south'",
"components": {
"minecraft:transformation": { "rotation": [0, 180, 0] }
}
},
// Facing east
{
"condition": "q.block_state('minecraft:cardinal_direction') == 'east'",
"components": {
"minecraft:transformation": { "rotation": [0, -90, 0] }
}
}
]Facing Orientation
Trait
To set the state which determines the block's direction, we will use the minecraft:placement_direction block trait with the minecraft:facing_direction state enabled.
"description": {
"identifier": "wiki:facing_direction_example",
// Block traits are defined here
"traits": {
"minecraft:placement_direction": {
"y_rotation_offset": 180,
"enabled_states": ["minecraft:facing_direction"] // Can be used in queries e.g. `q.block_state('minecraft:facing_direction') == 'north'`
}
}
}Permutations
Rotation makes use of block permutations. Each permutation contains the minecraft:transformation component, which allows for cardinal rotation by checking the minecraft:facing_direction state and applying an appropriate rotation.
The below rotation values assume that the front of your model is facing north.
"permutations": [
// Facing down
{
"condition": "q.block_state('minecraft:facing_direction') == 'down'",
"components": {
"minecraft:transformation": { "rotation": [90, 0, 0] }
}
},
// Facing up
{
"condition": "q.block_state('minecraft:facing_direction') == 'up'",
"components": {
"minecraft:transformation": { "rotation": [-90, 0, 0] }
}
},
// Facing north
{
"condition": "q.block_state('minecraft:facing_direction') == 'north'",
"components": {
"minecraft:transformation": { "rotation": [0, 0, 0] }
}
},
// Facing west
{
"condition": "q.block_state('minecraft:facing_direction') == 'west'",
"components": {
"minecraft:transformation": { "rotation": [0, 90, 0] }
}
},
// Facing south
{
"condition": "q.block_state('minecraft:facing_direction') == 'south'",
"components": {
"minecraft:transformation": { "rotation": [0, 180, 0] }
}
},
// Facing east
{
"condition": "q.block_state('minecraft:facing_direction') == 'east'",
"components": {
"minecraft:transformation": { "rotation": [0, -90, 0] }
}
}
]Block Face Attachment
Trait
To set the state which determines the block's attachment, we will use the minecraft:placement_position block trait with the minecraft:block_face state enabled.
"description": {
"identifier": "wiki:facing_direction_example",
// Block traits are defined here
"traits": {
"minecraft:placement_position": {
"enabled_states": ["minecraft:block_face"] // Can be used in queries e.g. `q.block_state('minecraft:block_face') == 'north'`
}
}
}Permutations
Rotation makes use of block permutations. Each permutation contains the minecraft:transformation component, which allows for cardinal rotation by checking the minecraft:block_face state and applying an appropriate rotation.
The below rotation values assume that the front of your model is facing north.
"permutations": [
// Facing down
{
"condition": "q.block_state('minecraft:block_face') == 'down'",
"components": {
"minecraft:transformation": { "rotation": [-90, 0, 0] }
}
},
// Facing up
{
"condition": "q.block_state('minecraft:block_face') == 'up'",
"components": {
"minecraft:transformation": { "rotation": [90, 0, 0] }
}
},
// Facing north
{
"condition": "q.block_state('minecraft:block_face') == 'north'",
"components": {
"minecraft:transformation": { "rotation": [0, 0, 0] }
}
},
// Facing west
{
"condition": "q.block_state('minecraft:block_face') == 'west'",
"components": {
"minecraft:transformation": { "rotation": [0, 90, 0] }
}
},
// Facing south
{
"condition": "q.block_state('minecraft:block_face') == 'south'",
"components": {
"minecraft:transformation": { "rotation": [0, 180, 0] }
}
},
// Facing east
{
"condition": "q.block_state('minecraft:block_face') == 'east'",
"components": {
"minecraft:transformation": { "rotation": [0, -90, 0] }
}
}
]Contributors
Edit Block Orientation on GitHubText and image content on this page is licensed under the Creative Commons Attribution 4.0 International License
Code samples on this page are licensed under the MIT License





