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"
- inputs = (
- ("Replace", "blocktype"),
- ("With", "blocktype"),
- ("Chance", (50, 0, 100))
- )
- def perform(level, box, options):
- mat1 = options["Replace"]
- mat2 = options["With"]
- chance = options["Chance"]
- for x in xrange(box.minx, box.maxx):
- for y in xrange(box.miny, box.maxy):
- for z in xrange(box.minz, box.maxz):
- if level.blockAt(x, y, z) == mat1.ID and level.blockDataAt(x, y, z) == mat1.blockData:
- if randomGen() <= chance:
- level.setBlockAt(x, y, z, mat2.ID)
- level.setBlockDataAt(x, y, z, mat2.blockData)
- level.markDirtyBox(box)
- def randomGen():
- return int(random.random() * 100)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement