mralasic

subota 2 - castle

May 28th, 2022 (edited)
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.65 KB | None | 0 0
  1. #castle creating function
  2. #the minimum length of the walls is 20. if the walls are shorter the stairs won't be generated correctly
  3. #the length of the walls has to be EVEN or the corners won't be generated correctly
  4. #the recommended wall height is 4. Only then the creepers can get activated and explode
  5. def castleBuilder(wallLength, wallHeight):
  6.     wallLengthCopy = wallLength / 2
  7.     builder.teleport_to(pos(-5, 0, 5))
  8.     builder.set_origin()
  9.     builder.mark()
  10.     i = 0
  11.     #the loop creating 3 layer wall around the player
  12.     while i < 3:
  13.         j = 0
  14.         while j < 4:
  15.             builder.move(FORWARD, wallLength)
  16.             builder.raise_wall(MOSSY_STONE_BRICKS, wallHeight)
  17.             builder.turn(RIGHT_TURN)
  18.             j += 1
  19.         wallLength += -2
  20.         builder.move(RIGHT, 1)
  21.         builder.move(FORWARD, 1)
  22.         builder.mark()
  23.         i += 1
  24.     builder.move(UP, wallHeight - 1)
  25.     builder.face(WEST)
  26.     builder.move(BACK, 15)
  27.     builder.mark()
  28.     i = 0
  29.     #the loop creating stairs
  30.     while i < wallHeight - 1:
  31.         builder.shift(1, -1, 0)
  32.         builder.line(STONE_BRICK_STAIRS)
  33.         i += 1
  34.     builder.teleport_to_origin()
  35.     builder.move(UP, wallHeight)
  36.     builder.face(NORTH)
  37.     builder.mark()
  38.     i = 0
  39.     #the loop creating corners
  40.     while i < 4:
  41.         j = 0
  42.         while j < wallLengthCopy:
  43.             builder.place(SEA_LANTERN)
  44.             builder.move(FORWARD, 2)
  45.             j += 1
  46.         builder.turn(RIGHT_TURN)
  47.         i += 1
  48. player.on_chat("castle", castleBuilder)
  49.  
  50. def inventory():
  51.     #creating the array and specifying what we want to get and how many units
  52.     items = [
  53.         IRON_SWORD, 1,
  54.         IRON_AXE, 1,
  55.         BOW, 1,
  56.         ARROW, 64,
  57.         FIREBALL, 10,
  58.         LAVA_BUCKET, 5,
  59.         IRON_HELMET, 1,
  60.         IRON_CHESTPLATE, 1 ,
  61.         IRON_LEGGINGS, 1,
  62.         IRON_BOOTS, 1,
  63.         SPRUCE_DOOR, 20,
  64.         TORCH, 30,
  65.         LADDER, 64,
  66.         ENCHANTED_APPLE, 2,
  67.         SHIELD, 1,
  68.         SPLASH_POTION, 1
  69.         ]
  70.  
  71.     for i in range(0, len(items),2):
  72.         #the loop going through every second element of list
  73.         mobs.give(mobs.target(NEAREST_PLAYER), items[i], items[i+1])
  74.  
  75.  
  76. player.on_chat("inventory", inventory)
  77.  
  78. def horseSpawn():
  79.     mobs.spawn(HORSE, pos(1, 0, 0))
  80.     mobs.give(mobs.target(NEAREST_PLAYER), SADDLE, 1)
  81.     mobs.give(mobs.target(NEAREST_PLAYER), IRON_HORSE_ARMOR, 1)
  82.  
  83. player.on_chat("horse", horseSpawn)
  84.  
  85. def enchantedBow():
  86.     mobs.enchant(mobs.target(NEAREST_PLAYER), "Power", 5)
  87.     mobs.enchant(mobs.target(NEAREST_PLAYER), "Flame", 1)
  88.  
  89. player.on_chat("enchant", enchantedBow)
Add Comment
Please, Sign In to add comment