Custom Fences
FORMAT VERSION 1.26.40
This tutorial assumes a good understanding of block visuals and block permutations. Check out the block visuals guide before starting.
In this tutorial, you'll learn how to create your own fence blocks with connection and multi-box collisions.

Features:
- Connects with adjacent blocks in each cardinal direction.
- Multi-box collisions that are 1.5 blocks tall, preventing most entities from jumping over the fence.
- Able to be used as fuel in a furnace.
Initial Block JSON
There are quite a few components listed here. Here's what is important for fences specifically:
- The
minecraft:connectiontrait enables theminecraft:connection_north,minecraft:connection_south,minecraft:connection_westandminecraft:connection_eaststates which indicate in which directions the fence should form a connection. - The
minecraft:has_fence_connectionstag tells vanilla wooden fences that they can connect to the block. - The
minecraft:connection_rulecomponent is used to prevent bars, glass panes and walls from connecting to the block.
Note that the block description does not have the menu_category parameter as that will be defined in the item JSON instead in a later step.
{
"format_version": "1.26.40",
"minecraft:block": {
"description": {
"identifier": "wiki:custom_fence",
"traits": {
"minecraft:connection": {
"enabled_states": ["minecraft:cardinal_connections"]
}
}
},
"components": {
"minecraft:tags": [
"minecraft:has_fence_connections",
"minecraft:is_axe_item_destructible"
],
"minecraft:destructible_by_explosion": {
"explosion_resistance": 15
},
"minecraft:destructible_by_mining": {
"seconds_to_destroy": 2
},
"minecraft:destruction_particles": {
"particle_count": 48
},
"minecraft:flammable": {
"catch_chance_modifier": 5,
"destroy_chance_modifier": 20,
"lava_flammable": "always"
},
"minecraft:connection_rule": {
"accepts_connections_from": "only_fences"
},
"minecraft:support": {
"shape": "fence"
},
// Prevents snow from accumulating above the fence
"minecraft:precipitation_interactions": {
"precipitation_behavior": "obstruct_rain"
},
// Allows the fence to be waterlogged
"minecraft:liquid_detection": {
"detection_rules": [
{
"liquid_type": "water",
"can_contain_liquid": true
}
]
},
// Allows leads to be attached to the fence
"minecraft:leashable": {
"offset": [0, 12, 0]
},
"minecraft:selection_box": {
"origin": [-2, 0, -2],
"size": [4, 16, 4]
},
"minecraft:collision_box": {
"origin": [-2, 0, -2],
"size": [4, 24, 4]
}
}
}
}Fence Model
You might have noticed that fences use two distinct models: one when carried in the inventory depicting two posts and a different model when placed which only has one post.
This means that we'll have to create two models for our custom fence, where one is applied to the block and the other is applied to the block item.
Block Model
In this example, our block model will contain all of the fence rails (the horizontal parts of the fence). Each pair of rails in each direction is contained within a separate bone. This will allow us to conditionally show/hide the rails based on the block's permutation using bone_visibility.

Block Geometry JSON
{
"format_version": "1.26.40",
"minecraft:geometry": [
{
"description": {
"identifier": "geometry.custom_fence",
"texture_width": 16,
"texture_height": 16
},
"bones": [
{
"name": "post",
"pivot": [0, 0, 0],
"cubes": [
{
"origin": [-2, 0, -2],
"size": [4, 16, 4],
"uv": {
"north": { "uv": [6, 0], "uv_size": [4, 16] },
"east": { "uv": [6, 0], "uv_size": [4, 16] },
"south": { "uv": [6, 0], "uv_size": [4, 16] },
"west": { "uv": [6, 0], "uv_size": [4, 16] },
"up": { "uv": [10, 10], "uv_size": [-4, -4] },
"down": { "uv": [10, 10], "uv_size": [-4, -4] }
}
}
]
},
{
"name": "north_rails",
"pivot": [0, 0, 0],
"cubes": [
{
"origin": [-1, 12, -8],
"size": [2, 3, 6],
"uv": {
"north": { "uv": [7, 1], "uv_size": [2, 3] },
"east": { "uv": [10, 1], "uv_size": [6, 3] },
"west": { "uv": [0, 1], "uv_size": [6, 3] },
"up": { "uv": [9, 6], "uv_size": [-2, -6] },
"down": { "uv": [9, 16], "uv_size": [-2, -6] }
}
},
{
"origin": [-1, 6, -8],
"size": [2, 3, 6],
"uv": {
"north": { "uv": [7, 7], "uv_size": [2, 3] },
"east": { "uv": [10, 7], "uv_size": [6, 3] },
"west": { "uv": [0, 7], "uv_size": [6, 3] },
"up": { "uv": [9, 6], "uv_size": [-2, -6] },
"down": { "uv": [9, 16], "uv_size": [-2, -6] }
}
}
]
},
{
"name": "south_rails",
"pivot": [0, 0, 0],
"cubes": [
{
"origin": [-1, 12, 2],
"size": [2, 3, 6],
"uv": {
"east": { "uv": [0, 1], "uv_size": [6, 3] },
"south": { "uv": [7, 1], "uv_size": [2, 3] },
"west": { "uv": [10, 1], "uv_size": [6, 3] },
"up": { "uv": [9, 16], "uv_size": [-2, -6] },
"down": { "uv": [9, 6], "uv_size": [-2, -6] }
}
},
{
"origin": [-1, 6, 2],
"size": [2, 3, 6],
"uv": {
"east": { "uv": [0, 7], "uv_size": [6, 3] },
"south": { "uv": [7, 7], "uv_size": [2, 3] },
"west": { "uv": [10, 7], "uv_size": [6, 3] },
"up": { "uv": [9, 16], "uv_size": [-2, -6] },
"down": { "uv": [9, 6], "uv_size": [-2, -6] }
}
}
]
},
{
"name": "west_rails",
"pivot": [0, 0, 0],
"cubes": [
{
"origin": [2, 12, -1],
"size": [6, 3, 2],
"uv": {
"north": { "uv": [10, 1], "uv_size": [6, 3] },
"south": { "uv": [0, 1], "uv_size": [6, 3] },
"west": { "uv": [7, 1], "uv_size": [2, 3] },
"up": { "uv": [6, 9], "uv_size": [-6, -2] },
"down": { "uv": [6, 9], "uv_size": [-6, -2] }
}
},
{
"origin": [2, 6, -1],
"size": [6, 3, 2],
"uv": {
"north": { "uv": [10, 7], "uv_size": [6, 3] },
"south": { "uv": [0, 7], "uv_size": [6, 3] },
"west": { "uv": [7, 7], "uv_size": [2, 3] },
"up": { "uv": [6, 9], "uv_size": [-6, -2] },
"down": { "uv": [6, 9], "uv_size": [-6, -2] }
}
}
]
},
{
"name": "east_rails",
"pivot": [0, 0, 0],
"cubes": [
{
"origin": [-8, 12, -1],
"size": [6, 3, 2],
"uv": {
"north": { "uv": [0, 1], "uv_size": [6, 3] },
"east": { "uv": [7, 1], "uv_size": [2, 3] },
"south": { "uv": [10, 1], "uv_size": [6, 3] },
"up": { "uv": [16, 9], "uv_size": [-6, -2] },
"down": { "uv": [16, 9], "uv_size": [-6, -2] }
}
},
{
"origin": [-8, 6, -1],
"size": [6, 3, 2],
"uv": {
"north": { "uv": [0, 7], "uv_size": [6, 3] },
"east": { "uv": [7, 7], "uv_size": [2, 3] },
"south": { "uv": [10, 7], "uv_size": [6, 3] },
"up": { "uv": [16, 9], "uv_size": [-6, -2] },
"down": { "uv": [16, 9], "uv_size": [-6, -2] }
}
}
]
}
]
}
]
}Block Culling Rules JSON
{
"format_version": "1.21.80",
"minecraft:block_culling_rules": {
"description": {
"identifier": "wiki:culling.custom_fence"
},
"rules": [
// Post
{
"direction": "down",
"geometry_part": {
"bone": "post",
"cube": 0,
"face": "down"
}
},
{
"direction": "up",
"geometry_part": {
"bone": "post",
"cube": 0,
"face": "up"
}
},
// North rails
{
"direction": "north",
"geometry_part": {
"bone": "north_rails",
"cube": 0,
"face": "north"
}
},
{
"direction": "north",
"geometry_part": {
"bone": "north_rails",
"cube": 1,
"face": "north"
}
},
// South rails
{
"direction": "south",
"geometry_part": {
"bone": "south_rails",
"cube": 0,
"face": "south"
}
},
{
"direction": "south",
"geometry_part": {
"bone": "south_rails",
"cube": 1,
"face": "south"
}
},
// West rails
{
"direction": "west",
"geometry_part": {
"bone": "west_rails",
"cube": 0,
"face": "west"
}
},
{
"direction": "west",
"geometry_part": {
"bone": "west_rails",
"cube": 1,
"face": "west"
}
},
// East rails
{
"direction": "east",
"geometry_part": {
"bone": "east_rails",
"cube": 0,
"face": "east"
}
},
{
"direction": "east",
"geometry_part": {
"bone": "east_rails",
"cube": 1,
"face": "east"
}
}
]
}
}Item Model
In contrast, the bones in the item model are not necessary and have just been used to organize the cubes.

Item Geometry JSON
{
"format_version": "1.26.40",
"minecraft:geometry": [
{
"description": {
"identifier": "geometry.custom_fence_carried",
"texture_width": 16,
"texture_height": 16
},
"item_display_transforms": {
"gui": {
"fit_to_frame": false
},
"fixed": {
"rotation": [0, -90, 0]
},
"shelf": {
"rotation": [0, -90, 0]
}
},
"bones": [
{
"name": "posts",
"pivot": [0, 0, 0],
"cubes": [
{
"origin": [-2, 0, 4],
"size": [4, 16, 4],
"uv": {
"north": { "uv": [6, 0], "uv_size": [4, 16] },
"east": { "uv": [0, 0], "uv_size": [4, 16] },
"south": { "uv": [6, 0], "uv_size": [4, 16] },
"west": { "uv": [12, 0], "uv_size": [4, 16] },
"up": { "uv": [10, 16], "uv_size": [-4, -4] },
"down": { "uv": [10, 4], "uv_size": [-4, -4] }
}
},
{
"origin": [-2, 0, -8],
"size": [4, 16, 4],
"uv": {
"north": { "uv": [6, 0], "uv_size": [4, 16] },
"east": { "uv": [12, 0], "uv_size": [4, 16] },
"south": { "uv": [6, 0], "uv_size": [4, 16] },
"west": { "uv": [0, 0], "uv_size": [4, 16] },
"up": { "uv": [10, 4], "uv_size": [-4, -4] },
"down": { "uv": [10, 16], "uv_size": [-4, -4] }
}
}
]
},
{
"name": "rails",
"pivot": [0, 0, 0],
"cubes": [
{
"origin": [-1, 12, -10],
"size": [2, 3, 2],
"uv": {
"north": { "uv": [0, 1], "uv_size": [2, 3] },
"east": { "uv": [0, 1], "uv_size": [2, 3] },
"west": { "uv": [0, 1], "uv_size": [2, 3] },
"up": { "uv": [9, 16], "uv_size": [-2, -2] },
"down": { "uv": [9, 16], "uv_size": [-2, -2] }
}
},
{
"origin": [-1, 12, -4],
"size": [2, 3, 8],
"uv": {
"east": { "uv": [4, 1], "uv_size": [8, 3] },
"west": { "uv": [4, 1], "uv_size": [8, 3] },
"up": { "uv": [9, 12], "uv_size": [-2, -8] },
"down": { "uv": [9, 12], "uv_size": [-2, -8] }
}
},
{
"origin": [-1, 12, 8],
"size": [2, 3, 2],
"uv": {
"east": { "uv": [14, 1], "uv_size": [2, 3] },
"south": { "uv": [14, 1], "uv_size": [2, 3] },
"west": { "uv": [14, 1], "uv_size": [2, 3] },
"up": { "uv": [9, 2], "uv_size": [-2, -2] },
"down": { "uv": [9, 2], "uv_size": [-2, -2] }
}
},
{
"origin": [-1, 6, -10],
"size": [2, 3, 2],
"uv": {
"north": { "uv": [0, 7], "uv_size": [2, 3] },
"east": { "uv": [0, 7], "uv_size": [2, 3] },
"west": { "uv": [0, 7], "uv_size": [2, 3] },
"up": { "uv": [9, 16], "uv_size": [-2, -2] },
"down": { "uv": [9, 16], "uv_size": [-2, -2] }
}
},
{
"origin": [-1, 6, -4],
"size": [2, 3, 8],
"uv": {
"east": { "uv": [4, 7], "uv_size": [8, 3] },
"west": { "uv": [4, 7], "uv_size": [8, 3] },
"up": { "uv": [9, 12], "uv_size": [-2, -8] },
"down": { "uv": [9, 12], "uv_size": [-2, -8] }
}
},
{
"origin": [-1, 6, 8],
"size": [2, 3, 2],
"uv": {
"east": { "uv": [14, 7], "uv_size": [2, 3] },
"south": { "uv": [14, 7], "uv_size": [2, 3] },
"west": { "uv": [14, 7], "uv_size": [2, 3] },
"up": { "uv": [9, 2], "uv_size": [-2, -2] },
"down": { "uv": [9, 2], "uv_size": [-2, -2] }
}
}
]
}
]
}
]
}Applying Geometry & Textures
"minecraft:geometry": {
"identifier": "geometry.custom_fence",
"culling": "wiki:culling.custom_fence",
"bone_visibility": {
"north_rails": "q.block_state('minecraft:connection_north')",
"south_rails": "q.block_state('minecraft:connection_south')",
"west_rails": "q.block_state('minecraft:connection_west')",
"east_rails": "q.block_state('minecraft:connection_east')"
}
}In this example, we will simply be applying a custom wooden planks texture to our fence, although you might instead like to create a special model and texture for your fence like bamboo fences have in vanilla.
"minecraft:material_instances": {
"*": {
"texture": "wiki:custom_planks"
}
}Item Visual
Next, we can use the minecraft:item_visual component to apply the item model to the block item:
"minecraft:item_visual": {
"geometry": "geometry.custom_fence_carried",
"material_instances": {
"*": {
"texture": "wiki:custom_planks"
}
}
}Collision & Selection Boxes
Unlike geometry bones, collision and selection boxes cannot be individually enabled/disabled based on block states. This means we'll have to manually list the components for each block permutation making use of the permutations array.
"permutations": [
// Single connection
{
"condition": "q.block_state('minecraft:connection_north')",
"components": {
"minecraft:selection_box": {
"origin": [-2, 0, -8],
"size": [4, 16, 10]
},
"minecraft:collision_box": {
"origin": [-2, 0, -8],
"size": [4, 24, 10]
}
}
},
{
"condition": "q.block_state('minecraft:connection_south')",
"components": {
"minecraft:selection_box": {
"origin": [-2, 0, -2],
"size": [4, 16, 10]
},
"minecraft:collision_box": {
"origin": [-2, 0, -2],
"size": [4, 24, 10]
}
}
},
{
"condition": "q.block_state('minecraft:connection_west')",
"components": {
"minecraft:selection_box": {
"origin": [-2, 0, -2],
"size": [10, 16, 4]
},
"minecraft:collision_box": {
"origin": [-2, 0, -2],
"size": [10, 24, 4]
}
}
},
{
"condition": "q.block_state('minecraft:connection_east')",
"components": {
"minecraft:selection_box": {
"origin": [-8, 0, -2],
"size": [10, 16, 4]
},
"minecraft:collision_box": {
"origin": [-8, 0, -2],
"size": [10, 24, 4]
}
}
},
// Two connections (axis-aligned)
{
"condition": "q.block_state('minecraft:connection_north') && q.block_state('minecraft:connection_south')",
"components": {
"minecraft:selection_box": {
"origin": [-2, 0, -8],
"size": [4, 16, 16]
},
"minecraft:collision_box": {
"origin": [-2, 0, -8],
"size": [4, 24, 16]
}
}
},
{
"condition": "q.block_state('minecraft:connection_west') && q.block_state('minecraft:connection_east')",
"components": {
"minecraft:selection_box": {
"origin": [-8, 0, -2],
"size": [16, 16, 4]
},
"minecraft:collision_box": {
"origin": [-8, 0, -2],
"size": [16, 24, 4]
}
}
},
// Two connections (corner)
{
"condition": "q.block_state('minecraft:connection_north') && q.block_state('minecraft:connection_west')",
"components": {
"minecraft:selection_box": {
"origin": [-2, 0, -8],
"size": [10, 16, 10]
},
"minecraft:collision_box": [
{ "origin": [-2, 0, -8], "size": [4, 24, 10] },
{ "origin": [2, 0, -2], "size": [6, 24, 4] }
]
}
},
{
"condition": "q.block_state('minecraft:connection_north') && q.block_state('minecraft:connection_east')",
"components": {
"minecraft:selection_box": {
"origin": [-8, 0, -8],
"size": [10, 16, 10]
},
"minecraft:collision_box": [
{ "origin": [-2, 0, -8], "size": [4, 24, 10] },
{ "origin": [-8, 0, -2], "size": [6, 24, 4] }
]
}
},
{
"condition": "q.block_state('minecraft:connection_south') && q.block_state('minecraft:connection_west')",
"components": {
"minecraft:selection_box": {
"origin": [-2, 0, -2],
"size": [10, 16, 10]
},
"minecraft:collision_box": [
{ "origin": [-2, 0, -2], "size": [4, 24, 10] },
{ "origin": [2, 0, -2], "size": [6, 24, 4] }
]
}
},
{
"condition": "q.block_state('minecraft:connection_south') && q.block_state('minecraft:connection_east')",
"components": {
"minecraft:selection_box": {
"origin": [-8, 0, -2],
"size": [10, 16, 10]
},
"minecraft:collision_box": [
{ "origin": [-2, 0, -2], "size": [4, 24, 10] },
{ "origin": [-8, 0, -2], "size": [6, 24, 4] }
]
}
},
// Three connections
{
"condition": "q.block_state('minecraft:connection_north') && q.block_state('minecraft:connection_south') && q.block_state('minecraft:connection_west')",
"components": {
"minecraft:selection_box": {
"origin": [-2, 0, -8],
"size": [10, 16, 16]
},
"minecraft:collision_box": [
{ "origin": [-2, 0, -8], "size": [4, 24, 16] },
{ "origin": [2, 0, -2], "size": [6, 24, 4] }
]
}
},
{
"condition": "q.block_state('minecraft:connection_north') && q.block_state('minecraft:connection_south') && q.block_state('minecraft:connection_east')",
"components": {
"minecraft:selection_box": {
"origin": [-8, 0, -8],
"size": [10, 16, 16]
},
"minecraft:collision_box": [
{ "origin": [-2, 0, -8], "size": [4, 24, 16] },
{ "origin": [-8, 0, -2], "size": [6, 24, 4] }
]
}
},
{
"condition": "q.block_state('minecraft:connection_north') && q.block_state('minecraft:connection_west') && q.block_state('minecraft:connection_east')",
"components": {
"minecraft:selection_box": {
"origin": [-8, 0, -8],
"size": [16, 16, 10]
},
"minecraft:collision_box": [
{ "origin": [-8, 0, -2], "size": [16, 24, 4] },
{ "origin": [-2, 0, -8], "size": [4, 24, 6] }
]
}
},
{
"condition": "q.block_state('minecraft:connection_south') && q.block_state('minecraft:connection_west') && q.block_state('minecraft:connection_east')",
"components": {
"minecraft:selection_box": {
"origin": [-8, 0, -2],
"size": [16, 16, 10]
},
"minecraft:collision_box": [
{ "origin": [-8, 0, -2], "size": [16, 24, 4] },
{ "origin": [-2, 0, 2], "size": [4, 24, 6] }
]
}
},
// Four connections
{
"condition": "q.block_state('minecraft:connection_north') && q.block_state('minecraft:connection_south') && q.block_state('minecraft:connection_west') && q.block_state('minecraft:connection_east')",
"components": {
"minecraft:selection_box": {
"origin": [-8, 0, -8],
"size": [16, 16, 16]
},
"minecraft:collision_box": [
{ "origin": [-2, 0, -8], "size": [4, 24, 16] },
{ "origin": [-8, 0, -2], "size": [16, 24, 4] }
]
}
}
]Final Block JSON
Example Custom Fence Block JSON
{
"format_version": "1.26.40",
"minecraft:block": {
"description": {
"identifier": "wiki:custom_fence",
"traits": {
"minecraft:connection": {
"enabled_states": ["minecraft:cardinal_connections"]
}
}
},
"components": {
"minecraft:tags": [
"minecraft:has_fence_connections",
"minecraft:is_axe_item_destructible"
],
"minecraft:destructible_by_explosion": {
"explosion_resistance": 15
},
"minecraft:destructible_by_mining": {
"seconds_to_destroy": 2
},
"minecraft:destruction_particles": {
"particle_count": 48
},
"minecraft:flammable": {
"catch_chance_modifier": 5,
"destroy_chance_modifier": 20,
"lava_flammable": "always"
},
"minecraft:connection_rule": {
"accepts_connections_from": "only_fences"
},
"minecraft:support": {
"shape": "fence"
},
"minecraft:geometry": {
"identifier": "geometry.custom_fence",
"culling": "wiki:culling.custom_fence",
"bone_visibility": {
"north_rails": "q.block_state('minecraft:connection_north')",
"south_rails": "q.block_state('minecraft:connection_south')",
"west_rails": "q.block_state('minecraft:connection_west')",
"east_rails": "q.block_state('minecraft:connection_east')"
}
},
"minecraft:material_instances": {
"*": {
"texture": "wiki:custom_planks"
}
},
// Item icon
"minecraft:item_visual": {
"geometry": "geometry.custom_fence_carried",
"material_instances": {
"*": {
"texture": "wiki:custom_planks"
}
}
},
// Prevents snow from accumulating above the fence
"minecraft:precipitation_interactions": {
"precipitation_behavior": "obstruct_rain"
},
// Allows the fence to be waterlogged
"minecraft:liquid_detection": {
"detection_rules": [
{
"liquid_type": "water",
"can_contain_liquid": true
}
]
},
// Allows leads to be attached to the fence
"minecraft:leashable": {
"offset": [0, 12, 0]
},
"minecraft:instrument_sound": {
"up": "note.bassattack"
},
"minecraft:selection_box": {
"origin": [-2, 0, -2],
"size": [4, 16, 4]
},
"minecraft:collision_box": {
"origin": [-2, 0, -2],
"size": [4, 24, 4]
}
},
"permutations": [
// Single connection
{
"condition": "q.block_state('minecraft:connection_north')",
"components": {
"minecraft:selection_box": {
"origin": [-2, 0, -8],
"size": [4, 16, 10]
},
"minecraft:collision_box": {
"origin": [-2, 0, -8],
"size": [4, 24, 10]
}
}
},
{
"condition": "q.block_state('minecraft:connection_south')",
"components": {
"minecraft:selection_box": {
"origin": [-2, 0, -2],
"size": [4, 16, 10]
},
"minecraft:collision_box": {
"origin": [-2, 0, -2],
"size": [4, 24, 10]
}
}
},
{
"condition": "q.block_state('minecraft:connection_west')",
"components": {
"minecraft:selection_box": {
"origin": [-2, 0, -2],
"size": [10, 16, 4]
},
"minecraft:collision_box": {
"origin": [-2, 0, -2],
"size": [10, 24, 4]
}
}
},
{
"condition": "q.block_state('minecraft:connection_east')",
"components": {
"minecraft:selection_box": {
"origin": [-8, 0, -2],
"size": [10, 16, 4]
},
"minecraft:collision_box": {
"origin": [-8, 0, -2],
"size": [10, 24, 4]
}
}
},
// Two connections (axis-aligned)
{
"condition": "q.block_state('minecraft:connection_north') && q.block_state('minecraft:connection_south')",
"components": {
"minecraft:selection_box": {
"origin": [-2, 0, -8],
"size": [4, 16, 16]
},
"minecraft:collision_box": {
"origin": [-2, 0, -8],
"size": [4, 24, 16]
}
}
},
{
"condition": "q.block_state('minecraft:connection_west') && q.block_state('minecraft:connection_east')",
"components": {
"minecraft:selection_box": {
"origin": [-8, 0, -2],
"size": [16, 16, 4]
},
"minecraft:collision_box": {
"origin": [-8, 0, -2],
"size": [16, 24, 4]
}
}
},
// Two connections (corner)
{
"condition": "q.block_state('minecraft:connection_north') && q.block_state('minecraft:connection_west')",
"components": {
"minecraft:selection_box": {
"origin": [-2, 0, -8],
"size": [10, 16, 10]
},
"minecraft:collision_box": [
{ "origin": [-2, 0, -8], "size": [4, 24, 10] },
{ "origin": [2, 0, -2], "size": [6, 24, 4] }
]
}
},
{
"condition": "q.block_state('minecraft:connection_north') && q.block_state('minecraft:connection_east')",
"components": {
"minecraft:selection_box": {
"origin": [-8, 0, -8],
"size": [10, 16, 10]
},
"minecraft:collision_box": [
{ "origin": [-2, 0, -8], "size": [4, 24, 10] },
{ "origin": [-8, 0, -2], "size": [6, 24, 4] }
]
}
},
{
"condition": "q.block_state('minecraft:connection_south') && q.block_state('minecraft:connection_west')",
"components": {
"minecraft:selection_box": {
"origin": [-2, 0, -2],
"size": [10, 16, 10]
},
"minecraft:collision_box": [
{ "origin": [-2, 0, -2], "size": [4, 24, 10] },
{ "origin": [2, 0, -2], "size": [6, 24, 4] }
]
}
},
{
"condition": "q.block_state('minecraft:connection_south') && q.block_state('minecraft:connection_east')",
"components": {
"minecraft:selection_box": {
"origin": [-8, 0, -2],
"size": [10, 16, 10]
},
"minecraft:collision_box": [
{ "origin": [-2, 0, -2], "size": [4, 24, 10] },
{ "origin": [-8, 0, -2], "size": [6, 24, 4] }
]
}
},
// Three connections
{
"condition": "q.block_state('minecraft:connection_north') && q.block_state('minecraft:connection_south') && q.block_state('minecraft:connection_west')",
"components": {
"minecraft:selection_box": {
"origin": [-2, 0, -8],
"size": [10, 16, 16]
},
"minecraft:collision_box": [
{ "origin": [-2, 0, -8], "size": [4, 24, 16] },
{ "origin": [2, 0, -2], "size": [6, 24, 4] }
]
}
},
{
"condition": "q.block_state('minecraft:connection_north') && q.block_state('minecraft:connection_south') && q.block_state('minecraft:connection_east')",
"components": {
"minecraft:selection_box": {
"origin": [-8, 0, -8],
"size": [10, 16, 16]
},
"minecraft:collision_box": [
{ "origin": [-2, 0, -8], "size": [4, 24, 16] },
{ "origin": [-8, 0, -2], "size": [6, 24, 4] }
]
}
},
{
"condition": "q.block_state('minecraft:connection_north') && q.block_state('minecraft:connection_west') && q.block_state('minecraft:connection_east')",
"components": {
"minecraft:selection_box": {
"origin": [-8, 0, -8],
"size": [16, 16, 10]
},
"minecraft:collision_box": [
{ "origin": [-8, 0, -2], "size": [16, 24, 4] },
{ "origin": [-2, 0, -8], "size": [4, 24, 6] }
]
}
},
{
"condition": "q.block_state('minecraft:connection_south') && q.block_state('minecraft:connection_west') && q.block_state('minecraft:connection_east')",
"components": {
"minecraft:selection_box": {
"origin": [-8, 0, -2],
"size": [16, 16, 10]
},
"minecraft:collision_box": [
{ "origin": [-8, 0, -2], "size": [16, 24, 4] },
{ "origin": [-2, 0, 2], "size": [4, 24, 6] }
]
}
},
// Four connections
{
"condition": "q.block_state('minecraft:connection_north') && q.block_state('minecraft:connection_south') && q.block_state('minecraft:connection_west') && q.block_state('minecraft:connection_east')",
"components": {
"minecraft:selection_box": {
"origin": [-8, 0, -8],
"size": [16, 16, 16]
},
"minecraft:collision_box": [
{ "origin": [-2, 0, -8], "size": [4, 24, 16] },
{ "origin": [-8, 0, -2], "size": [16, 24, 4] }
]
}
}
]
}
}Item JSON
Since our fence is made of wood, it should be able to be used as fuel in furnaces. Therefore, we need to add the minecraft:fuel component to the fence by replacing its block item as shown below:
{
"format_version": "1.26.40",
"minecraft:item": {
"description": {
"identifier": "wiki:custom_fence",
"menu_category": {
"category": "construction",
"group": "minecraft:itemGroup.name.fence"
}
},
"components": {
"minecraft:block_placer": {
"block": "wiki:custom_fence",
"aligned_placement": true,
"replace_block_item": true
},
"minecraft:fuel": {
"duration": 3
}
}
}
}Contributors
Edit Custom Fences 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
