import { BlockVolume, system } from '@minecraft/server';
import WitherbossModule from '../witherboss/witherbossModule';
import WBVector3 from '../util/wbVector3';
export default function createWitherWraithPortalEffect(location) {
    // Create the portal effect and the arms
    const { dimension } = location;
    // Play the summoning sound
    dimension.playSound('twb_wisu:witherboss.summon', location, { volume: 16 });
    dimension.runCommand(`/summon twb_wisu:witherboss_spawn_vfx ${location.x} ${location.y} ${location.z} facing @p`);
    dimension.runCommand(`/summon twb_wisu:witherboss_summon_arm ${location.x} ${location.y} ${location.z} facing @p twb_wisu:set_left_arm`);
    dimension.runCommand(`/summon twb_wisu:witherboss_summon_arm ${location.x} ${location.y} ${location.z} facing @p twb_wisu:set_right_arm`);
    // Actually summon the boss
    WitherbossModule.summonNewWitherboss(dimension, location);
    // Trigger a timer that removes the ash
    system.runTimeout(() => {
        dimension.fillBlocks(new BlockVolume(new WBVector3(2, 0, 2).add(location), new WBVector3(-2, 1, -2).add(location)), 'minecraft:air', {
            blockFilter: {
                includeTypes: [
                    'twb_wisu:ash_layer'
                ]
            }
        });
    }, 20 * 2);
}
