-
Notifications
You must be signed in to change notification settings - Fork 61
/
itemmodels.py
29 lines (23 loc) · 965 Bytes
/
itemmodels.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
import os
from shutil import copyfile
location = os.path.join(os.path.dirname(__file__), "src/main/resources/assets/cyberware/models/item/template.json")
template = open(location, "r")
read = template.read()
def createModel(line):
text = read.replace("{{name}}", line)
location2 = os.path.join(os.path.dirname(__file__), "src/main/resources/assets/cyberware/models/item/" + line + ".json")
index = open(location2, "w")
index.write(text)
index.close()
templateimg = os.path.join(os.path.dirname(__file__), "src/main/resources/assets/cyberware/textures/items/template.png")
destimg = os.path.join(os.path.dirname(__file__), "src/main/resources/assets/cyberware/textures/items/" + line + ".png")
copyfile(templateimg, destimg)
with open('todo.txt') as f:
for line in f:
index = line.find("cyberware:")
if index == -1:
filename = line.strip()
else:
filename = line[index + len("cyberware:"):].strip()
createModel(filename)
template.close()