Skip to content

Commit

Permalink
v0.8.3
Browse files Browse the repository at this point in the history
fixed #13 More functions to come in the future for #7 #8 #10 #11 structure built for these in the future
  • Loading branch information
ben-wals committed Jul 22, 2022
1 parent fc0232a commit cc74bec
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 17 deletions.
4 changes: 2 additions & 2 deletions DOC.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from os import name
import os
import getpass

def DOC():
Expand Down Expand Up @@ -67,4 +67,4 @@ def DOC():

counter += 1

doc.close()
doc.close()
48 changes: 48 additions & 0 deletions FUNC.py
Original file line number Diff line number Diff line change
@@ -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
33 changes: 18 additions & 15 deletions MCCMD.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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'),
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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")

Expand Down
Binary file modified __pycache__/DOC.cpython-310.pyc
Binary file not shown.
Binary file added __pycache__/FUNC.cpython-310.pyc
Binary file not shown.
Binary file modified __pycache__/MCCMD.cpython-310.pyc
Binary file not shown.
Binary file modified __pycache__/OFCIT.cpython-310.pyc
Binary file not shown.

0 comments on commit cc74bec

Please sign in to comment.