-
Notifications
You must be signed in to change notification settings - Fork 8
/
Tamer.py
37 lines (31 loc) · 1.1 KB
/
Tamer.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
from pymclevel.nbt import TAG_Byte, TAG_String
VERSION = "1.0.0"
UPDATE_URL = "http://podshot.github.io/update/Tamer.json"
inputs = (
("Cats", True),
("Dogs", True),
("Horses", True),
("Owner Name", "string"),
("Version: 1.0","label"),
)
def perform(level, box, options):
cat = options["Cats"]
dog = options["Dogs"]
horse = options["Horses"]
owner = options["Owner Name"]
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,y,z) in box:
if e["id"].value == "Wolf" and dog:
e["Owner"] = TAG_String(owner)
chunk.dirty = True
if e["id"].value == "Ozelot" and cat:
e["Owner"] = TAG_String(owner)
chunk.dirty = True
if e["id"].value == "EntityHorse" and horse:
e["Tame"] = TAG_Byte(1)
e["OwnerName"] = TAG_String(owner)
chunk.dirty = True