Labirynt

mail@pastecode.io avatar
unknown
python
a month ago
2.2 kB
3
Indexable
Never
mury = [
    {"szerokosc": 44, "wysokosc": 6, "start": (0, -60, 0), "material": BEDROCK},
    {"szerokosc": 36, "wysokosc": 6, "start": (4, -60, 4), "material": PURPLE_TERRACOTTA},
    {"szerokosc": 28, "wysokosc": 6, "start": (8, -60, 8), "material": GREEN_TERRACOTTA},
    {"szerokosc": 20, "wysokosc": 6, "start": (12, -60, 12), "material": BLUE_TERRACOTTA},
    {"szerokosc": 12, "wysokosc": 6, "start": (16, -60, 16), "material": RED_TERRACOTTA},
    {"szerokosc": 4, "wysokosc": 6, "start": (20, -60, 20), "material": BLACK_TERRACOTTA}
]


def labirynt():
    for mur in mury:
        startX, startY, startZ = mur["start"]
        endX = startX + mur["szerokosc"]
        endY = startY + mur["wysokosc"]
        endZ = startZ + mur["szerokosc"]
        blok = mur["material"]

        blocks.fill(blok, world(startX,startY - 1,startZ), world(endX,endY,endZ), FillOperation.HOLLOW)
        blocks.fill(GLOWSTONE, world(startX,startY - 1,startZ),world(endX,startY - 1,endZ))
        blocks.fill(BEDROCK, world(startX,startY - 2,startZ),world(endX,startY - 2,endZ))
        blocks.fill(AIR, world(startX,endY,startZ),world(endX,endY,endZ))

def ekwipunek():
    player.execute("/clear")
    mobs.give(mobs.target(NEAREST_PLAYER), NETHERITE_PICKAXE, 1)
    mobs.give(mobs.target(NEAREST_PLAYER), NETHERITE_HELMET, 1)
    mobs.give(mobs.target(NEAREST_PLAYER), NETHERITE_BOOTS, 1)
    mobs.give(mobs.target(NEAREST_PLAYER), NETHERITE_LEGGINGS, 1)
    mobs.give(mobs.target(NEAREST_PLAYER), NETHERITE_CHESTPLATE, 1)
    mobs.give(mobs.target(NEAREST_PLAYER), NETHERITE_SWORD, 1)

def moby():
    for i in range(3):
        mobs.spawn(SKELETON, world(26, -60, 26))
        mobs.spawn(SPIDER, world(23, -60, 30))
        mobs.spawn(ZOMBIE, world(10, -60, 24))
        mobs.spawn(PIG_ZOMBIE, world(21, -60, 6))
        mobs.spawn(CREEPER, world(42, -60, 24))


def start():
    labirynt()
    ekwipunek()
    moby()
    gameplay.time_set(DayTime.NIGHT)
    gameplay.set_game_mode(SURVIVAL, mobs.target(NEAREST_PLAYER))
    player.teleport(world(22, -60, 22))
    player.execute("/gamerule spawnradius 0")
    player.execute("/setworldspawn 22 -60 22")
    
player.on_chat("start", start)
Leave a Comment