-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
json-gen.py
108 lines (92 loc) · 2.21 KB
/
json-gen.py
1
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
import json
def generate_model_textures(parent: str, **kwargs: str) -> dict:
return {
"parent": parent,
"textures": kwargs,
}
def generate_model_textures_template(parent: str, texture_template: str) -> dict:
return {
"import": {
"parent": {
"parent": parent,
},
"texture": texture_template,
},
"composition": "minecraft:template/parent",
}
STAIR_SUFFIXES = [
"north",
"east",
"south",
"west",
"inner_ne",
"inner_nw",
"inner_se",
"inner_sw",
"outer_ne",
"outer_nw",
"outer_se",
"outer_sw",
"top_north",
"top_east",
"top_south",
"top_west",
"top_inner_ne",
"top_inner_nw",
"top_inner_se",
"top_inner_sw",
"top_outer_ne",
"top_outer_nw",
"top_outer_se",
"top_outer_sw",
]
WALL_SUFFIXES = [
"inventory",
"cross",
"post",
"post_side",
"post_side_cutout_short",
"side_north",
"side_east",
"side_south",
"side_west",
"side_ns",
"side_ew",
]
TALL_WALL_SUFFIXES = [
"post_side_cutout_tall",
"cross_tall",
"side_tall_north",
"side_tall_east",
"side_tall_south",
"side_tall_west",
"side_tall_ns",
"side_tall_ew",
]
TRAPDOOR_SUFFIXES = [
"top",
"bottom",
"open",
]
def main():
model = "copper_trapdoor_"
parent = "copper_trapdoor_"
model_suffixes = TRAPDOOR_SUFFIXES
model_folder = "src/1.20.3/minecraft/models/block/"
parent_model_id_path = "minecraft:block/template/"
for model_suffix in model_suffixes:
model_file = f"{model_folder}{model}{model_suffix}.json"
parent_model_id = f"{parent_model_id_path}{parent}{model_suffix}"
model_data = generate_model_textures(
parent=parent_model_id,
texture="minecraft:block/copper_trapdoor",
)
#model_data = generate_model_textures_template(parent_model_id, "minecraft:template/texture/deepslate_brick_wall");
with open(model_file, "w") as file:
json.dump(model_data, file, indent=4)
print(model_file)
print(parent_model_id)
print(model_data)
print()
if __name__ == "__main__":
main()