Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pymclevel import MCSchematic
- from pymclevel import TileEntity
- from pymclevel import TAG_Compound
- from pymclevel import TAG_Short
- from pymclevel import TAG_Byte
- from pymclevel import TAG_String
- import random
- displayName = "Random Replace 2"
- inputs = (
- ("Replace", "blocktype"),
- ("With", "blocktype"),
- ("Step", (2, 0, 500)),
- ("Any subtype", False)
- )
- def perform(level, box, options):
- mat1 = options["Replace"]
- mat2 = options["With"]
- step = options["Step"]
- subtype = options["Any subtype"]
- y = box.miny
- for x in xrange(box.minx, box.maxx):
- for z in xrange(box.minz, box.maxz):
- while y <= box.maxy:
- y = y + int(randomGen() * step) + 1
- if level.blockAt(x, y, z) == mat1.ID and (level.blockDataAt(x, y, z) == mat1.blockData or subtype):
- level.setBlockAt(x, y, z, mat2.ID)
- level.setBlockDataAt(x, y, z, mat2.blockData)
- y = box.miny
- level.markDirtyBox(box)
- def randomGen():
- return random.random()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement