Advertisement
Guest User

MCPI Buildings.py

a guest
Apr 29th, 2013
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.26 KB | None | 0 0
  1. import minecraft
  2. import random
  3. import time
  4. def tower( x, y ,z, floors, size):
  5.     mc.setBlocks(x, y, z, x + size, y + (floors * 3), z+size, 0)
  6.     i=y;
  7.     wall=random.randint(1,15)
  8.     floorChoices=(1, 4, 5, 24, 22, 42, 45, 48, 49, 82, 87, 98, 112, 155)
  9.     floor=floorChoices[random.randint(0, len(floorChoices) - 1)]
  10.     windowChoices=(0, 20, 85, 102)
  11.     window=windowChoices[random.randint(0, len(windowChoices) - 1)]
  12.     itemChoices=(41, 46, 47, 51, 54, 57, 58, 61, 103, 245, 247)
  13.     while i < floors * 3:
  14.         #Floor
  15.         mc.setBlocks(x, i, z, x + size, i, z + size, floor)  
  16.         mc.setBlock(x+1, i, z + 1, 65, 3)
  17.         #Floor light
  18.         mc.setBlock( x + (size/2), i, z + (size/2), 89)
  19.         #First wall layer
  20.         i+=1
  21.         mc.setBlocks(x, i, z, x + size, i, z, 35, wall)
  22.         mc.setBlocks(x, i, z, x, i, z + size, 35,  wall)
  23.         mc.setBlocks(x, i, z + size, x + size, i, z + size, 35,  wall)
  24.         mc.setBlocks(x + size, i, z, x + size, i, z + size, 35,  wall)
  25.         #Ladder and glowstone
  26.         mc.setBlock(x, i, z, 89)
  27.         mc.setBlock(x, i, z + size, 89)
  28.         mc.setBlock(x + size, i, z, 89)
  29.         mc.setBlock (x+size, i, z+size, 89)
  30.         mc.setBlock(x+1, i, z + 1, 65, 3)
  31.         #If they're lucky, put an item on the floor
  32.         if random.randint(1, 100)==50:
  33.             mc.setBlock(random.randint(x + 1, x + size -1), i, random.randint(z + 1, z + size - 1), itemChoices[random.randint(0, len(itemChoices) -1)])
  34.         i+=1
  35.         #Windows
  36.         mc.setBlocks(x, i, z, x + size, i, z, window)
  37.         mc.setBlocks(x, i, z, x, i, z + size, window)
  38.         mc.setBlocks(x, i, z + size, x + size, i, z + size, window)
  39.         mc.setBlocks(x + size, i, z, x + size, i, z + size, window)
  40.         #mc.setBlock(x+1, i, z + 1, 65, 3)
  41.         i+=1
  42.         #Next wall
  43.         mc.setBlocks(x, i, z, x + size, i, z, 35,  wall)
  44.         mc.setBlocks(x, i, z, x, i, z + size, 35,  wall)
  45.         mc.setBlocks(x, i, z + size, x + size, i, z + size, 35,  wall)
  46.         mc.setBlocks(x + size, i, z, x + size, i, z + size, 35,  wall)
  47.         mc.setBlock(x, i, z, 89)
  48.         mc.setBlock(x, i, z + size, 89)
  49.         mc.setBlock(x + size, i, z, 89)
  50.         mc.setBlock (x+size, i, z+size, 89)
  51.         mc.setBlock(x+1, i, z + 1, 65, 3)
  52.         i+=1
  53. def city():
  54.     for i in range (30):
  55.         tower(random.randint(-100, 100), random.randint(-5, 5), random.randint(-100, 100), random.randint(5, 20), random.randint(5, 20))  
  56. def main():
  57.     city()
  58.  
  59. mc=minecraft.Minecraft.create()
  60. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement