Custom Trapdoors
experimental
intermediate
FORMAT & MIN ENGINE VERSION 1.20.30
This tutorial assumes a good understanding of blocks. Check out the blocks guide before starting.
EXPERIMENTAL
Requires Holiday Creator Features
to trigger block events.
Introduction
Making custom trapdoors is an often difficult task to do, but after reading this tutorial you'll understand how they work in case you find any drawbacks during recreating them, and you'll be provided with a template for you to use.
Custom Trapdoor
This will create a vanilla-like custom trapdoor.
{
"format_version": "1.20.30",
"minecraft:block": {
"description": {
"identifier": "wiki:custom_trapdoor",
"menu_category": {
"category": "construction",
"group": "itemGroup.name.trapdoor"
},
"traits": {
"minecraft:placement_position": {
"enabled_states": ["minecraft:vertical_half"]
},
"minecraft:placement_direction": {
"enabled_states": ["minecraft:cardinal_direction"]
}
},
"states": {
"wiki:open": [false, true]
}
},
"permutations": [
// Top Closed
{
"condition": "q.block_state('minecraft:vertical_half') == 'top' && q.block_state('minecraft:cardinal_direction') == 'north' && !q.block_state('wiki:open')",
"components": {
"minecraft:transformation": { "rotation": [0, 0, 180] }
}
},
{
"condition": "q.block_state('minecraft:vertical_half') == 'top' && q.block_state('minecraft:cardinal_direction') == 'south' && !q.block_state('wiki:open')",
"components": {
"minecraft:transformation": { "rotation": [180, 0, 0] }
}
},
{
"condition": "q.block_state('minecraft:vertical_half') == 'top' && q.block_state('minecraft:cardinal_direction') == 'east' && !q.block_state('wiki:open')",
"components": {
"minecraft:transformation": { "rotation": [180, -270, 0] }
}
},
{
"condition": "q.block_state('minecraft:vertical_half') == 'top' && q.block_state('minecraft:cardinal_direction') == 'west' && !q.block_state('wiki:open')",
"components": {
"minecraft:transformation": { "rotation": [180, 270, 0] }
}
},
// Top Open
{
"condition": "q.block_state('minecraft:vertical_half') == 'top' && q.block_state('minecraft:cardinal_direction') == 'north' && q.block_state('wiki:open')",
"components": {
"minecraft:transformation": { "rotation": [-270, 0, 0] }
}
},
{
"condition": "q.block_state('minecraft:vertical_half') == 'top' && q.block_state('minecraft:cardinal_direction') == 'south' && q.block_state('wiki:open')",
"components": {
"minecraft:transformation": { "rotation": [270, 0, -180] }
}
},
{
"condition": "q.block_state('minecraft:vertical_half') == 'top' && q.block_state('minecraft:cardinal_direction') == 'east' && q.block_state('wiki:open')",
"components": {
"minecraft:transformation": { "rotation": [0, 270, 90] }
}
},
{
"condition": "q.block_state('minecraft:vertical_half') == 'top' && q.block_state('minecraft:cardinal_direction') == 'west' && q.block_state('wiki:open')",
"components": {
"minecraft:transformation": {
"rotation": [180, -270, -270]
}
}
},
// Bottom Closed
{
"condition": "q.block_state('minecraft:vertical_half') == 'bottom' && q.block_state('minecraft:cardinal_direction') == 'north' && !q.block_state('wiki:open')",
"components": {
"minecraft:transformation": { "rotation": [0, 0, 0] }
}
},
{
"condition": "q.block_state('minecraft:vertical_half') == 'bottom' && q.block_state('minecraft:cardinal_direction') == 'south' && !q.block_state('wiki:open')",
"components": {
"minecraft:transformation": { "rotation": [0, 180, 0] }
}
},
{
"condition": "q.block_state('minecraft:vertical_half') == 'bottom' && q.block_state('minecraft:cardinal_direction') == 'east' && !q.block_state('wiki:open')",
"components": {
"minecraft:transformation": { "rotation": [0, 270, 0] }
}
},
{
"condition": "q.block_state('minecraft:vertical_half') == 'bottom' && q.block_state('minecraft:cardinal_direction') == 'west' && !q.block_state('wiki:open')",
"components": {
"minecraft:transformation": { "rotation": [0, -270, 0] }
}
},
// Bottom Open
{
"condition": "q.block_state('minecraft:vertical_half') == 'bottom' && q.block_state('minecraft:cardinal_direction') == 'north' && q.block_state('wiki:open')",
"components": {
"minecraft:transformation": { "rotation": [90, 0, 180] }
}
},
{
"condition": "q.block_state('minecraft:vertical_half') == 'bottom' && q.block_state('minecraft:cardinal_direction') == 'south' && q.block_state('wiki:open')",
"components": {
"minecraft:transformation": { "rotation": [270, 0, 0] }
}
},
{
"condition": "q.block_state('minecraft:vertical_half') == 'bottom' && q.block_state('minecraft:cardinal_direction') == 'east' && q.block_state('wiki:open')",
"components": {
"minecraft:transformation": { "rotation": [0, -270, 90] }
}
},
{
"condition": "q.block_state('minecraft:vertical_half') == 'bottom' && q.block_state('minecraft:cardinal_direction') == 'west' && q.block_state('wiki:open')",
"components": {
"minecraft:transformation": { "rotation": [180, 270, -270] }
}
}
],
"components": {
"minecraft:collision_box": {
"origin": [-8, 0, -8],
"size": [16, 3, 16]
},
"minecraft:selection_box": {
"origin": [-8, 0, -8],
"size": [16, 3, 16]
},
"minecraft:geometry": "geometry.trapdoor",
"minecraft:material_instances": {
"*": {
"texture": "spruce_trapdoor",
"render_method": "alpha_test"
}
},
"minecraft:on_interact": {
"event": "wiki:toggle"
}
},
"events": {
"wiki:toggle": {
"sequence": [
{
"set_block_state": {
"wiki:open": "!q.block_state('wiki:open')"
}
},
{
"condition": "q.block_state('wiki:open')",
"run_command": {
"command": "playsound close.wooden_trapdoor @a ~~~ 0.9 0.9"
}
},
{
"condition": "!q.block_state('wiki:open')",
"run_command": {
"command": "playsound open.wooden_trapdoor @a ~~~ 0.9 0.9"
}
}
]
}
}
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
Geometry
This will be the geometry used for your custom trapdoors.
Geometry JSON
{
"format_version": "1.12.0",
"minecraft:geometry": [
{
"description": {
"identifier": "geometry.trapdoor",
"texture_width": 16,
"texture_height": 16,
"visible_bounds_width": 2,
"visible_bounds_height": 1.5,
"visible_bounds_offset": [0, 0.25, 0]
},
"bones": [
{
"name": "trapdoor",
"pivot": [0, 0, 0],
"cubes": [
{
"origin": [-8, 0, -8],
"size": [16, 3, 16],
"uv": {
"north": {"uv": [16, 3], "uv_size": [-16, -3]},
"east": {"uv": [16, 3], "uv_size": [-16, -3]},
"south": {"uv": [16, 3], "uv_size": [-16, -3]},
"west": {"uv": [16, 3], "uv_size": [-16, -3]},
"up": {"uv": [16, 16], "uv_size": [-16, -16]},
"down": {"uv": [0, 0], "uv_size": [16, 16]}
}
}
]
}
]
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
TIP
Vanilla trapdoors have a few issues in the direction of the texture in certain faces and having a height of 2.95 when it should be 3. This block template and geometry fixes both of those issues.