Advertisement
coding_giants

l15 ship

Nov 23rd, 2023
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def buildPirateShip():
  2. shipWidth = 7
  3. shipLength = 15
  4. shipHeight = 5
  5.  
  6. shipPosition = world(0, -48, (islandLength // 2) + 5)
  7.  
  8. for x in range(-shipWidth // 2, shipWidth // 2 + 1):
  9. for z in range(-shipLength // 2, shipLength // 2 + 1):
  10. for y in range(shipHeight):
  11. if y == 0:
  12. blocks.place(PLANKS_OAK, positions.add(shipPosition, pos(x, y, z)))
  13. elif y == shipHeight - 1 and -shipWidth // 4 <= x <= shipWidth // 4 and -shipLength // 4 <= z <= shipLength // 4:
  14. blocks.place(PLANKS_OAK, positions.add(shipPosition, pos(x, y, z)))
  15. elif y > 0 and y < shipHeight - 1 and ((x == -shipWidth // 2 or x == shipWidth // 2) or (z == -shipLength // 2 or z == shipLength // 2)):
  16. blocks.place(PLANKS_OAK, positions.add(shipPosition, pos(x, y, z)))
  17.  
  18. # Adding a mast
  19. for y in range(shipHeight, shipHeight * 3):
  20. blocks.place(PLANKS_OAK, positions.add(shipPosition, pos(0, y, 0)))
  21.  
  22. # Adding sails
  23. for y in range(shipHeight + 1, shipHeight * 3 - 1):
  24. for z in range(-shipLength // 4, shipLength // 4 + 1):
  25. if -y + shipHeight <= z <= y - shipHeight:
  26. blocks.place(WOOL, positions.add(shipPosition, pos(0, y, z)))
  27.  
  28.  
  29. def ship():
  30. buildPirateShip()
  31.  
  32. player.on_chat("ship", ship)
  33.  
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement