-
Notifications
You must be signed in to change notification settings - Fork 5
/
EnchantmentGenerator.py
40 lines (39 loc) · 1.26 KB
/
EnchantmentGenerator.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
from tkinter import Tk
def askCopyClip(nbt):
if input('COPY TEXT TO CLIPBOARD? (Y\\N) >').lower() != 'n':
r = Tk()
r.withdraw()
r.clipboard_clear()
r.clipboard_append(nbt)
r.update()
r.destroy()
def generateEnch(id_, lvl):
return '{id:'+id_+'s,lvl:'+lvl+'s}'
def generateEnchs(enchs):
ench = '{ench:['
for i in enchs:
ench = ench + i + ','
ench = ench.split(',')
del(ench[-1])
ench = ','.join(ench)
ench = ench + ']}'
return ench
print ('PRESS CTRL+C WHEN YOU ARE FINISHED ENTERING ENCHANTMENTS. ENCHANTING AN ITEM WITH THIS WILL DELETE EVERY OTHER ITEM.')
print ('YOU CAN FIND A LIST OF ENCHANTMENT IDS AT https://minecraftbedrock.fandom.com/wiki/Enchanting/List_of_Enchantments')
enchs = []
while True:
try:
id_ = input('ENTER ENCHANTMENT ID >')
lvl = input('ENTER ENCHANTMENT LEVEL >')
try:
int(lvl)
except:
print ('INCORRECT VALUE FOR LEVEL. SETTING TO 1')
lvl = '1'
enchs.append(generateEnch(id_, lvl))
except KeyboardInterrupt:
break
nbt = generateEnchs(enchs)
print ('TO ENCHANT AN ITEM, USE [.nbt write] WHILE HOLDING ANY ITEM')
print (nbt)
askCopyClip(nbt)