import { world, BlockPermutation, system } from "@minecraft/server";

system.beforeEvents.startup.subscribe((initEvent) => {
    initEvent.blockComponentRegistry.registerCustomComponent("rustic:sneak_place", {
        beforeOnPlayerPlace: e => {
            const { player, block, face, permutationToPlace, dimension } = e;
            if ( !player.isSneaking ) {
                return;
            }
            e.permutationToPlace = permutationToPlace.withState('rustic:place', true);
        },
    });
});