Bat Cave

Bats flying in a cave

Dig a cave and fill it up with bats!

Try the code:

let bat_cave: Position = null
player.onChat("cave", function () {
    player.say("dig a cave!")
    gameplay.timeSet(DAY)
    for (let i = 0; i < 50; i++) {
        blocks.fill(
            AIR,
            pos(-1, 0, -1),
            pos(1, 2, 1),
            FillOperation.Replace
        )
    }
    bat_cave = player.position()
    player.say("You have 10 seconds to go out before the bats arrive!")
    loops.pause(10000)
    player.say("Watch for bats!")
    gameplay.timeSet(DUSK)
    for (let i = 0; i < 200; i++) {
        mobs.spawn(BAT, bat_cave)
    }
})