Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import random
- blocks = [22, 133, 152, 41]
- startPos = mc.entity.getTilePos(id)
- laenge = 150
- breite = 15
- players = []
- def getPlayers():
- for ids in mc.getPlayerEntityIds():
- players.append(ids)
- def countdown(length):
- for i in range(length, 0, -1):
- mc.postToChat(f'seconds left: {i}')
- time.sleep(1)
- def Plattform():
- x, y, z = mc.entity.getTilePos(id)
- y = y - 1
- for x1 in range(laenge):
- randBlock = random.randint(0,2)
- for z1 in range(breite):
- mc.setBlock(x + x1, y, z + z1, blocks[randBlock])
- mc.setBlocks(x + laenge, y, z, x + laenge + 6, y, z + breite - 1, blocks[3])
- def game():
- Plattform()
- #getPlayers()
- start = time.time()
- mc.postToChat("Reach the goal, but look where you step")
- runs = True
- while runs:
- if not players:
- mc.postToChat("all players have lost!")
- mc.postToChat("game over!")
- break
- block = blocks[random.randint(0,2)]
- if block == blocks[0]:
- mc.postToChat("You have to be on lapiz or win")
- if block == blocks[1]:
- mc.postToChat("You have to be on emerald or win")
- if block == blocks[2]:
- mc.postToChat("You have to be on redstone or win")
- countdown(3)
- for player in players:
- playerX, playerY, playerZ = mc.entity.getTilePos(id)
- if mc.getBlock(playerX, playerY - 1, playerZ) == blocks[3]:
- mc.postToChat("A player has won!")
- runs = False
- break
- if mc.getBlock(playerX, playerY - 1, playerZ) != block:
- players.remove(player)
- mc.postToChat("A player has lost")
- mc.entity.setTilePos(player, startPos)
- #game()
- mc.postToChat("type 'play' in the chat to participate")
- for sec in range(10,0,-1):
- mc.postToChat(f'game starts in {sec} seconds')
- time.sleep(1)
- chats = mc.events.pollChatPosts()
- for chat in chats:
- if chat.message == "play":
- players.append(chat.entityId)
- x,y,z = mc.entity.getTilePos(id)
- for entityID in players:
- mc.entity.setTilePos(entityID, x,y,z)
- game()
- mc.postToChat('The game is concluded!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement