ZenCodeLang / ZenCode

The ZenCode project.
MIT License
13 stars 8 forks source link

Look into `Captured Statement error` #150

Open kindlich opened 5 months ago

kindlich commented 5 months ago
CTEventManager.register<RightClickBlockEvent>((event) => {
    var level = event.player.level;
    var pos = event.hitVec.blockPos;
    var block = level.getBlockState(pos);
    level.schedule()
        .sleep(20)
        .run((level) => {
            level.setBlockAndUpdate(event.hitVec.blockPos, <blockstate:minecraft:dirt>);
        })
        .sleep(20)
        .run((level) => {
            level.setBlockAndUpdate(pos, <blockstate:minecraft:grass_block>);
        })
        .sleep(20)
        .run((level) => {
            level.setBlockAndUpdate(pos, block);
        })
        .build();
});

gives a captured statement error