-
Notifications
You must be signed in to change notification settings - Fork 5
/
ItemNameLoreGenerator.py
94 lines (93 loc) · 2.82 KB
/
ItemNameLoreGenerator.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
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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()
codes = {
'color:dark_red': '§4',
'color:red': '§c',
'color:gold': '§6',
'color:yellow': '§e',
'color:dark_green': '§2',
'color:green': '§a',
'color:aqua': '§b',
'color:dark_aqua': '§3',
'color:dark_blue': '§1',
'color:blue': '§9',
'color:light_purple': '§d',
'color:dark_purple': '§5',
'color:white': '§f',
'color:gray': '§7',
'color:dark_gray': '§8',
'color:black': '§0',
'format:obfuscated': '§k',
'format:bold': '§l',
'format:strikethrough': '§m',
'format:underline': '§n',
'format:italic': '§o',
'code:reset': '§r',
}
codesInternal = {
'\\cdr\\': 'color:dark_red',
'\\cr\\': 'color:red',
'\\cg\\': 'color:gold',
'\\cy\\': 'color:yellow',
'\\cdg\\': 'color:dark_green',
'\\cg\\': 'color:green',
'\\ca\\': 'color:aqua',
'\\cda\\': 'color:dark_aqua',
'\\cdb\\': 'color:dark_blue',
'\\cb\\': 'color:blue',
'\\clp\\': 'color:light_purple',
'\\cdp\\': 'color:dark_purple',
'\\cw\\': 'color:white',
'\\cg\\': 'color:gray',
'\\cdg\\': 'color:dark_gray',
'\\cb\\': 'color:black',
'\\fo\\': 'format:obfuscated',
'\\fb\\': 'format:bold',
'\\fs\\': 'format:strikethrough',
'\\fu\\': 'format:underline',
'\\fi\\': 'format:italic',
'\\rst\\': 'code:reset',
}
def generate(name, lores):
nbt = 'display:{Lore:['
for i in lores:
nbt = nbt + '"' + i + '",'
#nbt = nbt.split(',')
#del(nbt[-1])
#nbt = ','.join(nbt)
nbt = nbt + '],Name:"'+name+'"}'
nbt = '{' + nbt + '}'
return nbt
if input('PRINT CUSTOM CODES (COLOR \\ FORMAT)? (Y\\N) >').lower() == 'y':
print ('JUST TYPE IN THE CODE TO APPLY THE FORMATTING')
print ('CODE : FORMAT')
for i in codesInternal:
print (i + ' : ' + codesInternal[i])
name = input('ENTER CUSTOM NAME >')
for i in codesInternal:
name = name.replace(i, codesInternal[i])
for i in codes:
name = name.replace(i, codes[i])
lores = []
print ('PRESS CTRL+C WHEN YOU ARE DONE ENTERING LORES')
while True:
try:
lore = input('ENTER LORE >')
for i in codesInternal:
lore = lore.replace(i, codesInternal[i])
for i in codes:
lore = lore.replace(i, codes[i])
lores.append(lore)
except KeyboardInterrupt:
break
nbt = generate(name, lores)
print ('TO SET NAME & LORE OF ITEM, USE [.nbt write] ON THE ITEM YOU WANT TO NAME & LORE')
print (nbt)
askCopyClip(nbt)