https://pastein.ru/t/jlV

  скопируйте уникальную ссылку для отправки


from mcpi.minecraft import Minecraft
import mcpi.block as block
import time
import random

mc = Minecraft.create()

start_pos = mc.player.getTilePos()
mc.setBlock(start_pos.x, 150, start_pos.z, block.GOLD_BLOCK.id)
mc.player.setTilePos(start_pos.x, 152, start_pos.z)

difficulty = int(input("Выбери сложность (1 - normal, 2 - hard, 3 - H.E.L.L): "))
max_height = 200 if difficulty in {2, 3} else 150
spawn_distance = 2 if difficulty == 1 else 4
timer = 3 if difficulty == 3 else 4 if difficulty == 2 else 5

mc.postToChat("Игра начнется через 5 секунд")
time.sleep(5)
mc.postToChat("Удачи! Не стой на месте")

blocks = []
blocks.append([start_pos.x, max_height, start_pos.z])
max_pos = 0

while True:
    xr, yr, zr = random.randint(-spawn_distance, spawn_distance), random.randint(-1, 1), random.randint(-spawn_distance, spawn_distance)

    player_pos = mc.player.getTilePos()
    player_pos.x += xr
    player_pos.y += yr
    player_pos.z += zr

    mc.setBlock(player_pos.x, player_pos.y, player_pos.z, block.GOLD_BLOCK.id)
    time.sleep(1)

    blocks.append([player_pos.x, player_pos.y, player_pos.z])
    if len(blocks) > 4:
        previous_block = blocks.pop(0)
        mc.setBlock(previous_block[0], previous_block[1], previous_block[2], block.AIR.id)

    mc.postToChat("Высота: " + str(player_pos.y))
    if player_pos.y > max_pos:
        max_pos = player_pos.y

    if player_pos.y < max_height:
        for previous_block in blocks:
            mc.setBlock(previous_block[0], previous_block[1], previous_block[2], block.AIR.id)
        mc.postToChat("Игра окончена!")
        mc.postToChat("Достигнутая высота: " + str(max_pos))
        break

    time.sleep(timer)