Advertisement
KorNF4Ke

Project Fuer MP zum selbst erarbeiten

Feb 19th, 2025
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.06 KB | None | 0 0
  1. import time
  2. import random
  3.  
  4. blocks = [22, 133, 152, 41]
  5. startPos = mc.entity.getTilePos(id)
  6.  
  7. laenge = 150
  8. breite = 15
  9. players = []
  10. def getPlayers():
  11.   for ids in mc.getPlayerEntityIds():
  12.     players.append(ids)
  13.  
  14. def countdown(length):
  15.   for i in range(length, 0, -1):
  16.     mc.postToChat(f'seconds left: {i}')
  17.     time.sleep(1)
  18.  
  19. def Plattform():
  20.   x, y, z = mc.entity.getTilePos(id)
  21.   y = y - 1
  22.   for x1 in range(laenge):
  23.     randBlock = random.randint(0,2)
  24.     for z1 in range(breite):    
  25.       mc.setBlock(x + x1, y, z + z1, blocks[randBlock])
  26.   mc.setBlocks(x + laenge, y, z, x + laenge + 6, y, z + breite - 1, blocks[3])
  27.  
  28. def game():
  29.   Plattform()
  30.   #getPlayers()
  31.   start = time.time()
  32.   mc.postToChat("Reach the goal, but look where you step")
  33.   runs = True
  34.   while runs:
  35.     if not players:
  36.       mc.postToChat("all players have lost!")
  37.       mc.postToChat("game over!")
  38.       break
  39.  
  40.     block = blocks[random.randint(0,2)]
  41.     if block == blocks[0]:
  42.       mc.postToChat("You have to be on lapiz or win")
  43.     if block == blocks[1]:
  44.       mc.postToChat("You have to be on emerald or win")
  45.     if block == blocks[2]:
  46.       mc.postToChat("You have to be on redstone or win")
  47.     countdown(3)
  48.  
  49.     for player in players:
  50.       playerX, playerY, playerZ = mc.entity.getTilePos(id)
  51.       if mc.getBlock(playerX, playerY - 1, playerZ) == blocks[3]:
  52.         mc.postToChat("A player has won!")
  53.         runs = False
  54.         break
  55.       if mc.getBlock(playerX, playerY - 1, playerZ) != block:
  56.         players.remove(player)
  57.         mc.postToChat("A player has lost")
  58.         mc.entity.setTilePos(player, startPos)
  59.  
  60. #game()
  61.  
  62. mc.postToChat("type 'play' in the chat to participate")
  63. for sec in range(10,0,-1):
  64.   mc.postToChat(f'game starts in {sec} seconds')
  65.   time.sleep(1)
  66.  
  67.   chats = mc.events.pollChatPosts()
  68.   for chat in chats:
  69.     if chat.message == "play":
  70.       players.append(chat.entityId)
  71.  
  72. x,y,z = mc.entity.getTilePos(id)
  73. for entityID in players:
  74.   mc.entity.setTilePos(entityID, x,y,z)
  75. game()
  76. mc.postToChat('The game is concluded!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement