Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # MCEdit filter by daxorion27
- # A huge thanks goes to sethbling for his "entity code" filter : https://www.youtube.com/sethbling , http://sethbling.com/downloads/mcedit-filters/entitycode/
- displayName = "End Gateway"
- 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_Float
- from pymclevel import TAG_String
- from pymclevel import TAG_Long
- from pymclevel import TAG_Int_Array
- from numpy import zeros
- try:
- exitSetByFunction
- except NameError:
- exitSetByFunction = False
- inputs = (
- ("Function:", (
- "Set Exit Position",
- "Clear Exit Position",
- "Create End Gateway"
- )),
- ("X", 0),
- ("Y", (1,1,255)),
- ("Z", 0),
- ("These values are used to define the exit, but if you set the exit with a function they are overwritten, to use them again run clear exit position.", "label"),
- )
- def perform (level, box, options):
- function = options["Function:"]
- global exitSetByFunction
- global functionExitX
- global functionExitY
- global functionExitZ
- if exitSetByFunction and function == "Create End Gateway":
- exitX = functionExitX
- exitY = functionExitY
- exitZ = functionExitZ
- for x in xrange (box.minx,box.maxx):
- for y in xrange (box.miny,box.maxy):
- for z in xrange (box.minz,box.maxz):
- level.setBlockAt (x, y, z, 209)
- level.setBlockDataAt(x, y, z, 0)
- createEndGateway(x,y,z,exitX,exitY,exitZ,level)
- print "Incredible Success!"
- elif function == "Create End Gateway":
- exitX = options["X"]
- exitY = options["Y"]
- exitZ = options["Z"]
- for x in xrange (box.minx,box.maxx):
- for y in xrange (box.miny,box.maxy):
- for z in xrange (box.minz,box.maxz):
- level.setBlockAt (x, y, z, 209)
- level.setBlockDataAt(x, y, z, 0)
- createEndGateway(x,y,z,exitX,exitY,exitZ,level)
- print "Success!"
- elif function == "Clear Exit Position":
- exitSetByFunction = False
- print "Position reset"
- elif function == "Set Exit Position":
- if box.width == 1 and box.height == 1 and box.length == 1:
- functionExitX = box.minx
- functionExitY = box.miny
- functionExitZ = box.minz
- print "Position set successfully:"
- print "X: " + str(functionExitX)
- print "Y: " + str(functionExitY)
- print "Z: " + str(functionExitZ)
- exitSetByFunction = True
- else:
- raise Exception("Your box can only be one block!")
- def createEndGateway(x,y,z,exitX,exitY,exitZ,level):
- endGateway = TAG_Compound()
- endGateway["x"] = TAG_Int(x)
- endGateway["Life"] = TAG_Long(10000)
- endGateway["y"] = TAG_Int(y)
- exitPortal = TAG_Compound()
- exitPortal["X"] = TAG_Int(exitX + 5)
- exitPortal["Y"] = TAG_Int(exitY)
- exitPortal["Z"] = TAG_Int(exitZ + 5)
- endGateway["ExitPortal"] = exitPortal
- endGateway["z"] = TAG_Int(z)
- endGateway["id"] = TAG_String(u'EndGateway')
- chunk = level.getChunk(x/16,z/16)
- chunk.TileEntities.append(endGateway)
- chunk.dirty = True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement