-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.py
48 lines (41 loc) · 1.75 KB
/
build.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
out_file = None
mod_name = "lobotomycorp"
block_name = "grid_normal"
def gen_model_block_item():
path = f"src\\main\\resources\\assets\\{mod_name}\\models\\item\\{block_name}.json"
with open(path, "w") as out_file:
out_file.write('{\n')
content = "\t\"parent\": \"%s:block/%s\"\n"%(mod_name,block_name)
out_file.write(content)
out_file.write('}\n')
def gen_model_block():
path = "src\\main\\resources\\assets\\%s\\models\\block\\%s.json"%(mod_name, block_name)
with open(path, "w") as out_file:
out_file.write('{\n')
out_file.write('\t\"parent\": \"block/cube_all\",\n')
out_file.write('\t\"textures\": {\n')
content = "\t\t\"all\": \"%s:blocks/%s\"\n"%(mod_name,block_name)
out_file.write(content)
out_file.write('\t}\n')
out_file.write('}\n')
def gen_block_state():
path = "src\\main\\resources\\assets\\%s\\blockstates\\%s.json"%(mod_name, block_name)
with open(path, "w") as out_file:
out_file.write('{\n')
out_file.write('\t\"variants\": {\n')
content = "\t\t\"normal\": { \"model\": \"%s:%s\" }\n"%(mod_name,block_name)
out_file.write(content)
out_file.write('\t}\n')
out_file.write('}\n')
def gen_block(block_name):
print("Creating:", block_name)
gen_model_block_item()
gen_model_block()
gen_block_state()
def gen_item(type_name, item_name):
print("Creating:", type_name, " ", item_name)
path = "src\\main\\resources\\assets\\%s\\models\\item\\%s.json"%(mod_name, item_name)
with open(path, "w") as out_file:
content = '{"parent": "item/handheld","textures": {"layer0":"%s:items/%s/%s"}}\n'%(mod_name, type_name, item_name)
out_file.write(content)
gen_item("weapon", input())