import { BlockPermutation } from '@minecraft/server';

export function onTick(event) {
    const { block, dimension } = event;
    const torchGolems = dimension.getEntities({
        location: block.location,
        maxDistance: 1.4,
        type: 'lv_mo:torch_golem'
    });

    if (torchGolems.length === 0) {
        block.setPermutation(BlockPermutation.resolve('minecraft:air'));
    }
}


const torch_golem_light = {
    onTick: onTick
};

export default torch_golem_light