-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreference_lists.py
More file actions
79 lines (70 loc) · 2.47 KB
/
Copy pathreference_lists.py
File metadata and controls
79 lines (70 loc) · 2.47 KB
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
import os
cubyzListofItems = []
cubyzBlockList = []
def refreshCubyzItemList(cubyzPath):
cubyzListofItems = []
pathSearching = cubyzPath + "/assets/cubyz/items"
with os.scandir(pathSearching) as list:
for thing in list:
if thing.is_file():
if thing.name == "_migrations.zig.zon": continue
cubyzListofItems.append(thing)
elif thing.is_dir():
if thing.name == "textures": continue
searchThroughChildren(thing.path, cubyzListofItems)
else:
print("Error in getting item list: found a weird filetype")
pathSearching = cubyzPath + "/assets/cubyz/blocks"
with os.scandir(pathSearching) as list:
for thing in list:
if thing.is_file():
if thing.name == "_migrations.zig.zon": continue
cubyzListofItems.append(thing)
elif thing.is_dir():
if thing.name == "textures": continue
searchThroughChildren(thing.path, cubyzListofItems)
else:
print("Error in getting item from blocks list: found a weird filetype")
def refreshCubyzBlockList(cubyzPath):
cubyzBlockList = []
pathSearching = cubyzPath + "/assets/cubyz/items"
with os.scandir(pathSearching) as list:
for thing in list:
if thing.is_file():
if thing.name == "_migrations.zig.zon": continue
if thing.name == "_defaults.zig.zon": continue
cubyzListofItems.append(thing)
elif thing.is_dir():
if thing.name == "textures": continue
searchThroughChildren(thing.path, cubyzBlockList)
else:
print("Error in getting item list: found a weird filetype")
pathSearching = cubyzPath + "/assets/cubyz/blocks"
with os.scandir(pathSearching) as list:
for thing in list:
if thing.is_file():
if thing.name == "_migrations.zig.zon": continue
if thing.name == "_defaults.zig.zon": continue
cubyzBlockList.append(thing)
elif thing.is_dir():
if thing.name == "textures": continue
searchThroughChildren(thing.path, cubyzListofItems)
else:
print("Error in getting item from blocks list: found a weird filetype")
def searchThroughChildren(path, listToAppendTo):
with os.scandir(path) as list:
for thing in list:
if thing.is_file():
if thing.name == "_defaults.zig.zon": continue
listToAppendTo.append(thing)
elif thing.is_dir():
searchThroughChildren(thing.path, listToAppendTo)
else:
print("Error in getting child list: found a weird filetype")
def RefreshAllLists(cubyzPath):
refreshCubyzItemList(cubyzPath)
refreshCubyzBlockList(cubyzPath)
def getItemList():
return cubyzListofItems
def getBlockList():
return cubyzBlockList