-
Notifications
You must be signed in to change notification settings - Fork 8
/
Executify.py
35 lines (28 loc) · 1.02 KB
/
Executify.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
from pymclevel.nbt import *
import time
METHOD = "[Executify]"
BASECOMMAND = "/execute {} {} {}"
VERSION = "1.0.0"
UPDATE_URL = "http://podshot.github.io/update/Executify.json"
displayName = "Executify"
inputs = (
("Execute Entity Arguments", ("string", "value=")),
("Relative Coordinates", ("string", "value=~ ~ ~")),
)
def perform(level, box, options):
print '%s: Started at %s' % (METHOD, time.ctime())
eea = str(options["Execute Entity Arguments"])
rc = str(options["Relative Coordinates"])
for (chunk, point, slices) in level.getChunkSlices(box):
for t in chunk.TileEntities:
if t["id"].value == "Control":
x = t["x"].value
y = t["y"].value
z = t["z"].value
if (x,y,z) in box:
command = t["Command"].value
newC = BASECOMMAND.format(eea, rc, command)
time.sleep(1)
t["Command"] = TAG_String(newC)
chunk.dirty = True
print '%s: Ended at %s' % (METHOD, time.ctime())