-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnotations.py
63 lines (46 loc) · 1.64 KB
/
notations.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
import globals as G
class Notation:
def __init__(self, name):
self.items = {}
self.name = name
G.notationhandler._addNotation(self)
def notate(self, object, string):
if string not in self.items:
self.addGroup(string)
self.items[string].append(object)
def addGroup(self, string):
self.items[string] = []
def getName(self):
return self.name
class NotationHandler:
def __init__(self):
self.notations = {}
def _addNotation(self, notation):
if type(notation) != Notation:
notation = notation()
self.notations[notation.getName()] = notation
def notate(self, notation, string, obj):
self.notations[notation].notate(obj, string)
def getnotatedobjectsfor(self, notation, string):
if not notation in self.notations:
return []
if not string in self.notations[notation].items:
return []
return self.notations[notation].items[string]
G.notationhandler = NotationHandler()
OREDICT = Notation("oredict")
OREDICT.addGroup("armor:heads")
OREDICT.addGroup("armor:bodys")
OREDICT.addGroup("armor:leggins")
OREDICT.addGroup("armor:foots")
DESTROYGROUP = Notation("destroygroup")
class OreDictItems:
STONE = "minecraft:oredict:stone"
STONEBRICK = "minecraft:oredict:stonebrick"
POLISHED_STONE = "minecraft:oredict:polished_stone"
COBBELSTONE = "minecraft:oredict:cobbelstone"
WOOD_LOG = "minecraft:oredict:wood_log"
WOOD_PLANK = "minecraft:oredict:wood_plank"
DIRT = "minecraft:oredict:dirt"
class DestroyGroupItems:
PICKAXE = "minecraft:destroygroup:pickaxe"