/*
██╗  ██╗ █████╗ ██╗   ██╗███████╗███╗   ██╗    ███╗   ███╗ ██████╗ ██████╗ ██████╗  █████╗  ██████╗██╗  ██╗███████╗
██║  ██║██╔══██╗██║   ██║██╔════╝████╗  ██║    ████╗ ████║██╔═══██╗██╔══██╗██╔══██╗██╔══██╗██╔════╝██║ ██╔╝██╔════╝
███████║███████║██║   ██║█████╗  ██╔██╗ ██║    ██╔████╔██║██║   ██║██║  ██║██████╔╝███████║██║     █████╔╝ ███████╗
██╔══██║██╔══██║╚██╗ ██╔╝██╔══╝  ██║╚██╗██║    ██║╚██╔╝██║██║   ██║██║  ██║██╔═══╝ ██╔══██║██║     ██╔═██╗ ╚════██║
██║  ██║██║  ██║ ╚████╔╝ ███████╗██║ ╚████║    ██║ ╚═╝ ██║╚██████╔╝██████╔╝██║     ██║  ██║╚██████╗██║  ██╗███████║
╚═╝  ╚═╝╚═╝  ╚═╝  ╚═══╝  ╚══════╝╚═╝  ╚═══╝    ╚═╝     ╚═╝ ╚═════╝ ╚═════╝ ╚═╝     ╚═╝  ╚═╝ ╚═════╝╚═╝  ╚═╝╚══════╝
*/
Ponder.registry((event) => 
    {
    event.create("pylons:harvester_pylon").scene("pylon_farm", "Introduction to the Harvester Pylon", "pylon_farm", (scene, util) => 
        {
            scene.showBasePlate()
            scene.overlay.showText(50).text("Introducing the Harvester Pylon").independent(20).placeNearTarget()
            scene.idle(40)
            scene.overlay.showText(50).text("Place it in water within your farm").independent(36).placeNearTarget()
            scene.idle(40)
            scene.world.hideSection([0, 0, 0, 9, 0, 3], Facing.DOWN)
            scene.idle(40)
            scene.showControls(40, [4.5, 1, 4.5], "down")
                .rightClick()
                .withItem("pylons:harvester_pylon")
            scene.idle(40)
            scene.world.modifyBlock([4, 0, 4], () => Block.id("pylons:harvester_pylon").with("waterlogged", "true"), false)
            scene.idle(40)
            scene.addLazyKeyframe()
            scene.overlay.showText(50).text("Equip the pylon with a hoe").independent(20).placeNearTarget()
            scene.idle(40)
            scene.overlay.showText(50).text("to enable its harvesting function").independent(36).placeNearTarget()
            scene.idle(40)
            scene.showControls(40, [4.5, 1, 4.5], "down")
                .withItem("minecraft:iron_hoe")
            scene.idle(40)
            scene.overlay.showText(50).text("Hoe durability is consumed during use").independent(68).placeNearTarget()
            scene.idle(40)
            scene.addLazyKeyframe()
            scene.overlay.showText(50).text("Ensure there's storage above the pylon").independent(20).placeNearTarget()
            scene.idle(40)
            scene.overlay.showText(50).text("for collected crops").independent(36).placeNearTarget()
            scene.idle(40)
            scene.showControls(40, [4.5, 2, 4.5], "down")
                .rightClick()
                .withItem("sophisticatedstorage:barrel")
            scene.idle(40)
            scene.world.showSection([4, 1, 4], Facing.DOWN)
            scene.idle(40)
            scene.addLazyKeyframe()
            scene.world.showSection([0, 0, 0, 9, 0, 3], Facing.UP)
            scene.idle(40)

            let threebythree = util.select.fromTo(3, 1, 3, 5, 1, 5)
            let fivebyfive = util.select.fromTo(2, 1, 2, 6, 1, 6)
            let sevenbyseven = util.select.fromTo(1, 1, 1, 7, 1, 7)
            let ninebynine = util.select.fromTo(0, 1, 0, 8, 1, 8)

            scene.world.setBlocks(ninebynine, Block.id("minecraft:potatoes").with("age", 7), false)
            scene.world.showSection(ninebynine, Facing.UP)
            scene.idle(40)
            scene.overlay.showText(60).text("The Harvester Pylon can operate in different areas").independent(20).placeNearTarget()
            scene.idle(40)

            let areas = [
                { label: "3x3", area: threebythree },
                { label: "5x5", area: fivebyfive },
                { label: "7x7", area: sevenbyseven },
                { label: "9x9", area: ninebynine }
            ]

            for (let { label, area } of areas) {
                scene.overlay.showText(30).text(`${label} area`).independent(36).placeNearTarget()
                scene.idle(40)
                scene.overlay.showOutline(PonderPalette.GREEN, label, area, 30)
                scene.idle(40)
                scene.world.modifyBlocks(area, (curState) => curState.with("age", 0), false)
                scene.idle(40)
            }
    })
})