diff --git a/DOC.py b/DOC.py index 69e6f08..dd7ad58 100644 --- a/DOC.py +++ b/DOC.py @@ -1,4 +1,4 @@ -from os import name +import os import getpass def DOC(): @@ -67,4 +67,4 @@ def DOC(): counter += 1 - doc.close() + doc.close() \ No newline at end of file diff --git a/FUNC.py b/FUNC.py new file mode 100644 index 0000000..d91aa27 --- /dev/null +++ b/FUNC.py @@ -0,0 +1,48 @@ +import os +import getpass + +def FUN(): + + funconfig = open("C:/Users/" + getpass.getuser() + "/AppData/Roaming/Totems+/funconfig.txt", "r") + funconfigread = funconfig.readlines() + funconfig.close() + + worldLocation = funconfigread[0] + nameList = funconfigread[1] + + worldLocation = worldLocation.replace('\n','') + nameList = nameList.split(';') + + print(nameList) + + os.mkdir(worldLocation + "/datapacks/Totems+ CMD/data/totemsplus") + os.mkdir(worldLocation + "/datapacks/Totems+ CMD/data/totemsplus/functions") + + mcfunction = open(worldLocation + '/datapacks/Totems+ CMD/data/totemsplus/functions/totemload.mcfunction', 'x') + mcfunction.close() + + mcfunction = open(worldLocation + '/datapacks/Totems+ CMD/data/totemsplus/functions/totemload.mcfunction', 'a') + + counter = 0 + + while len(nameList) != counter + 1: + + mcfunction.write('give @s minecraft:totem_of_undying{CustomModelData:' + str(910340 + counter) +'} 1\n') + + counter += 1 + + mcfunction.close() + + counter = 0 + + while len(nameList) != counter + 1: + + mcfunction = open(worldLocation + '/datapacks/Totems+ CMD/data/totemsplus/functions/summon' + nameList[counter] + '.mcfunction', 'x') + mcfunction.close() + + mcfunction = open(worldLocation + '/datapacks/Totems+ CMD/data/totemsplus/functions/summon' + nameList[counter] + '.mcfunction', 'a') + + mcfunction.write('give @s minecraft:totem_of_undying{CustomModelData:' + str(910340 + counter) +'} 1\n') + mcfunction.close() + + counter += 1 \ No newline at end of file diff --git a/MCCMD.py b/MCCMD.py index 9e43586..2989eae 100644 --- a/MCCMD.py +++ b/MCCMD.py @@ -5,6 +5,7 @@ from tkinter.constants import S import PySimpleGUI as sg from DOC import DOC +from FUNC import FUN # defines the CMD function def CMD(): @@ -54,7 +55,7 @@ def CMD(): ], [ sg.Checkbox('Documentation', default=True, disabled=True, key='documentation',tooltip='Generates a custom documentation file!'), - sg.Checkbox('TotemLoad Function', default=True, disabled=True, key='totemload',tooltip='Generates a totem load function to summon all your totems!') + sg.Checkbox('Functions', default=True, disabled=True, key='functions',tooltip='Generates functions to access all your totems!') ], [ sg.Button('Next', disabled=True, key='next'), @@ -105,7 +106,7 @@ def CMD(): window.Element('itemWeight').update(disabled=False) window.Element('next').update(disabled=False) window.Element('documentation').update(disabled=False) - window.Element('totemload').update(disabled=False) + window.Element('functions').update(disabled=False) window.Element('in-game').update(disabled=False) window.Element('lore').update(disabled=False) window.Element('loreCheck').update(disabled=False) @@ -470,25 +471,27 @@ def CMD(): DOC() - if values['totemload'] == True: + if values['functions'] == True: - os.mkdir(worldLocation + "/datapacks/Totems+ CMD/data/totemsplus") - os.mkdir(worldLocation + "/datapacks/Totems+ CMD/data/totemsplus/functions") + file_exists = os.path.exists('C:/Users/' + getpass.getuser() + '/AppData/Roaming/Totems+/funconfig.txt') - mcfunction = open(worldLocation + '/datapacks/Totems+ CMD/data/totemsplus/functions/totemload.mcfunction', 'x') - mcfunction.close() + if file_exists == True: + + os.remove("C:/Users/" + getpass.getuser() + "/AppData/Roaming/Totems+/funconfig.txt") - mcfunction = open(worldLocation + '/datapacks/Totems+ CMD/data/totemsplus/functions/totemload.mcfunction', 'a') - - counter = 0 - - while len(nameList) != counter: + funconfig = open('C:/Users/' + getpass.getuser() + '/AppData/Roaming/Totems+/funconfig.txt', 'x') + funconfig.close() - mcfunction.write('give @s minecraft:totem_of_undying{CustomModelData:' + str(910340 + counter) +'} 1\n') + funconfig = open("C:/Users/" + getpass.getuser() + "/AppData/Roaming/Totems+/funconfig.txt", "a") + funconfig.write(worldLocation) + funconfig.write('\n') - counter += 1 + for i in nameList: + funconfig.write(i) + funconfig.write(';') + funconfig.close() - mcfunction.close() + FUN() os.remove("C:/Users/" + getpass.getuser() + "/AppData/Roaming/Totems+/cmdconfig.txt") diff --git a/__pycache__/DOC.cpython-310.pyc b/__pycache__/DOC.cpython-310.pyc index 646ceb2..22c8f56 100644 Binary files a/__pycache__/DOC.cpython-310.pyc and b/__pycache__/DOC.cpython-310.pyc differ diff --git a/__pycache__/FUNC.cpython-310.pyc b/__pycache__/FUNC.cpython-310.pyc new file mode 100644 index 0000000..257c76c Binary files /dev/null and b/__pycache__/FUNC.cpython-310.pyc differ diff --git a/__pycache__/MCCMD.cpython-310.pyc b/__pycache__/MCCMD.cpython-310.pyc index ef76d25..75ae342 100644 Binary files a/__pycache__/MCCMD.cpython-310.pyc and b/__pycache__/MCCMD.cpython-310.pyc differ diff --git a/__pycache__/OFCIT.cpython-310.pyc b/__pycache__/OFCIT.cpython-310.pyc index bde2783..6bbc248 100644 Binary files a/__pycache__/OFCIT.cpython-310.pyc and b/__pycache__/OFCIT.cpython-310.pyc differ