Advertisement
giganciprogramowania

Lesson 4. Spider nest

Dec 13th, 2021
388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. position=player.position()
  2. x=position.get_value(Axis.X)
  3. y=position.get_value(Axis.Y)
  4. z=position.get_value(Axis.Z)
  5.  
  6.  
  7. def spiderSpawn():
  8.  
  9. gameplay.set_game_mode(SURVIVAL, mobs.target(NEAREST_PLAYER))
  10. #clearning the inventory
  11. player.execute("/clear")
  12. mobs.give(mobs.target(NEAREST_PLAYER), DIAMOND_AXE, 1)
  13. mobs.give(mobs.target(NEAREST_PLAYER), BOW, 1)
  14. mobs.give(mobs.target(NEAREST_PLAYER), ARROW, 64)
  15. mobs.give(mobs.target(NEAREST_PLAYER), TORCH, 3)
  16. #use a loop to spawn spider webs
  17. for i in range(50):
  18.  
  19. blocks.place(COBWEB, randpos(world(x-4,y+1,z), world(x+9,y+7,z+45)))
  20.  
  21. for i in range(5):
  22.  
  23. mobs.spawn(SPIDER, randpos(world(x-4,y+1,z+10), world(x+9,y+7,z+45)))
  24.  
  25. def cave():
  26.  
  27. blocks.fill(BEDROCK, world(x-5,y-1,z-1),world(x+10,y+10,z+50),FillOperation.HOLLOW)
  28. blocks.place(GLOWSTONE, world(x,y,z+49))
  29. spiderSpawn()
  30.  
  31. player.on_chat("spiders", cave)
  32.  
  33. #an event for destroying a block
  34. def blockDestroy():
  35. gameplay.set_game_mode(CREATIVE, mobs.target(NEAREST_PLAYER))
  36. player.teleport(pos(50, 1, 50))
  37. blocks.on_block_broken(GLOWSTONE, blockDestroy)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement