-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathaddpotioneffect.py
64 lines (54 loc) · 1.6 KB
/
addpotioneffect.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
# 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
displayName = "Add Potion Effect to Mobs"
Effects = {
"Strength": 5,
"Jump Boost": 8,
"Regeneration": 10,
"Fire Resistance": 12,
"Water Breathing": 13,
"Resistance": 11,
"Weakness": 18,
"Poison": 19,
"Speed (no mob effect)": 1,
"Slowness (no mob effect)": 2,
"Haste (no mob effect)": 3,
"Mining Fatigue (no mob effectg)": 4,
"Nausea (no mob effect)": 9,
"Blindness (no mob effect)": 15,
"Hunger (no mob effect)": 17,
"Invisibility (no effect)": 14,
"Night Vision (no effect)": 16,
}
EffectKeys = ()
for key in Effects.keys():
EffectKeys = EffectKeys + (key,)
inputs = (
("Effect", EffectKeys),
("Level", 1),
("Duration (Seconds)", 60),
)
def perform(level, box, options):
effect = Effects[options["Effect"]]
amp = options["Level"]
duration = options["Duration (Seconds)"] * 20
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 "ActiveEffects" not in e:
e["ActiveEffects"] = TAG_List()
ef = TAG_Compound()
ef["Amplifier"] = TAG_Byte(amp)
ef["Id"] = TAG_Byte(effect)
ef["Duration"] = TAG_Int(duration)
e["ActiveEffects"].append(ef)
chunk.dirty = True