export function breakShield(entity) {
    if (entity.typeId !== 'minecraft:player')
        return false;
    const equippable = entity.getComponent("equippable");
    if (equippable.getEquipment("Mainhand")!==undefined && entity.isSneaking && 
        equippable.getEquipment("Mainhand").typeId === 'minecraft:shield') {
        equippable.setEquipment("Mainhand");
        entity.runCommand("/playsound item.shield.block @a[r=16] ~~~");
        entity.runCommand("/playsound mob.zombie.woodbreak @a[r=16] ~~~");
        return true;
    }
    else if (equippable.getEquipment("Offhand")!==undefined && entity.isSneaking && 
        equippable.getEquipment("Offhand").typeId === 'minecraft:shield') {
        equippable.setEquipment("Offhand");
        entity.runCommand("/playsound item.shield.block @a[r=16] ~~~");
        entity.runCommand("/playsound mob.zombie.woodbreak @a[r=16] ~~~");
        return true;
    }
    return false;
}
export function freezeWater(source) {
    let b = source.getBlockFromViewDirection({
        maxDistance: 13, 
        includeLiquidBlocks: true, 
        includePassableBlocks: true});
    if (b === undefined) 
        return;
    let l = b.block.location;
    source.runCommand("/fill "+(l.x-3)+" "+l.y+" "+(l.z-3)+" "+(l.x+3)+" "+l.y+" "+(l.z+3)+" frosted_ice [] replace water");
}