-
Notifications
You must be signed in to change notification settings - Fork 1
/
mc_advancement_list.py
41 lines (32 loc) · 1.6 KB
/
mc_advancement_list.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
'''
Gets advancement list from minecraft generated data, to fix a shared advancements datapack.
To generate data, use this command --> java -cp path/to/server.jar net.minecraft.data.Main --server --reports <-- in a terminal
on a minecraft server JAR, then point script to the /generated/ folder
'''
import os
generated_advancement_path = input("Minecraft generated data dump path (use .../generated/ folder): ")
print('\n\n')
# if the path doesnt end in a slash, put one there
if not generated_advancement_path.endswith("/"):
generated_advancement_path += "/"
# adds advancement at the end
generated_advancement_path = generated_advancement_path + 'data/minecraft/advancements/'
# for each advancement folder
for i in os.listdir(generated_advancement_path):
# leave out recepies. i dont think they need to be shared, so they get left out
# if you want to keep them, comment out the next two lines
if i == 'recipes':
continue
# gets list of each advancement in subfolder
advancements_list = os.listdir(generated_advancement_path + i + '\\')
# empty line to separate adv. folders
print()
# for each advancement there is in the folder,
for j in advancements_list:
# delete file extensions
j = j.replace('.json','')
# make advancement path, like "nether/get_wither_skull"
advancement_path = i + '/' + j
# print command
print('execute as @a[advancements={{minecraft:{0}=true}}] run advancement grant @a[advancements={{minecraft:{0}=false}}] only minecraft:{0}'.format(advancement_path))
input('\n\npress ENTER to exit')