-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathchangemobs.py
126 lines (101 loc) · 3.42 KB
/
changemobs.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# Feel free to modify and use this filter however you wish. If you do,
# please give credit to SethBling.
# http://youtube.com/SethBling
from pymclevel import TAG_List
from pymclevel import TAG_Byte
from pymclevel import TAG_Int
from pymclevel import TAG_Compound
from pymclevel import TAG_Short
from pymclevel import TAG_Double
from pymclevel import TAG_String
displayName = "Change Mob Properties"
Professions = {
"Farmer (brown)": 0,
"Librarian (white)": 1,
"Priest (purple)": 2,
"Blacksmith (black apron)": 3,
"Butcher (white apron)": 4,
"Villager (green)": 5,
}
ProfessionKeys = ("N/A",)
for key in Professions.keys():
ProfessionKeys = ProfessionKeys + (key,)
noop = -1337
inputs = (
("Health", noop),
("VelocityX", noop),
("VelocityY", noop),
("VelocityZ", noop),
("Fire", noop),
("FallDistance", noop),
("Air", noop),
("AttackTime", noop),
("HurtTime", noop),
("Lightning Creeper", ("N/A", "Lightning", "No Lightning")),
("Enderman Block Id", noop),
("Enderman Block Data", noop),
("Villager Profession", ProfessionKeys),
("Slime Size", noop),
("Breeding Mode Ticks", noop),
("Child/Adult Age", noop),
)
def perform(level, box, options):
health = options["Health"]
vx = options["VelocityX"]
vy = options["VelocityY"]
vz = options["VelocityZ"]
fire = options["Fire"]
fall = options["FallDistance"]
air = options["Air"]
attackTime = options["AttackTime"]
hurtTime = options["HurtTime"]
powered = options["Lightning Creeper"]
blockId = options["Enderman Block Id"]
blockData = options["Enderman Block Data"]
profession = options["Villager Profession"]
size = options["Slime Size"]
breedTicks = options["Breeding Mode Ticks"]
age = options["Child/Adult Age"]
for (chunk, slices, point) in level.getChunkSlices(box):
for e in chunk.Entities:
x = e["Pos"][0].value
y = e["Pos"][1].value
z = e["Pos"][2].value
if x >= box.minx and x < box.maxx and y >= box.miny and y < box.maxy and z >= box.minz and z < box.maxz:
if "Health" in e:
if health != noop:
e["Health"] = TAG_Short(health)
if vx != noop:
e["Motion"][0] = TAG_Double(vx)
if vy != noop:
e["Motion"][1] = TAG_Double(vy)
if vz != noop:
e["Motion"][2] = TAG_Double(vz)
if fire != noop:
e["Fire"] = TAG_Short(fire)
if fall != noop:
e["FallDistance"] = TAG_Float(fall)
if air != noop:
e["Air"] = TAG_Short(air)
if attackTime != noop:
e["AttackTime"] = TAG_Short(attackTime)
if hurtTime != noop:
e["HurtTime"] = TAG_Short(hurtTime)
if powered != "N/A" and e["id"].value == "Creeper":
if powered == "Lightning":
e["powered"] = TAG_Byte(1)
if powered == "No Lightning":
e["powered"] = TAG_Byte(0)
if blockId != noop and e["id"].value == "Enderman":
e["carried"] = TAG_Short(blockId)
if blockData != noop and e["id"].value == "Enderman":
e["carriedData"] = TAG_Short(blockData)
if profession != "N/A" and e["id"].value == "Villager":
e["Profession"] = TAG_Int(Professions[profession])
if size != noop and e["id"].value == "Slime":
e["Size"] = TAG_Int(size)
if breedTicks != noop:
e["InLove"] = TAG_Int(breedTicks)
if age != noop:
e["Age"] = TAG_Int(age)
chunk.dirty = True