import*as mc from"@minecraft/server";import*as vector from"../utils/vector";import*as selectors from"../utils/selectors";export function eventBehavior(t){if(t.entity.isValid()&&"hf_mzs:gong"===t.entity.typeId&&"break"===t.eventId){let e=t.entity.getDynamicProperty("hf_mzs:start_location"),n=t.entity.location;void 0!==e&&(e=e.split(","),n={x:parseFloat(e[0]),y:parseFloat(e[1]),z:parseFloat(e[2])}),vector.magnitude(vector.subtract(n,t.entity.location))>3&&(n=t.entity.location),t.entity.teleport(n),t.entity.runCommand(`/execute positioned ${vector.string(n)} run fill ^-1^ ^ ^1 ^2 ^ air [] replace hf_mzs:gong_side`),t.entity.runCommand(`/execute positioned ${vector.string(n)} run fill ^-1^ ^ ^1 ^2 ^ air [] replace hf_mzs:gong_main`),t.entity.runCommand(`/execute positioned ${vector.string(n)} run loot spawn ~~~ loot "hf/mzs/gong"`),t.entity.runCommand(`/execute positioned ${vector.string(n)} run particle hf_mzs:gong_break ~~~`),t.entity.runCommand(`/execute positioned ${vector.string(n)} run particle hf_mzs:gong_break ~~1~`),t.entity.runCommand(`/execute positioned ${vector.string(n)} run particle hf_mzs:gong_break ~~2~`),t.entity.runCommand(`/execute positioned ${vector.string(n)} run particle hf_mzs:gong_break ^1^^`),t.entity.runCommand(`/execute positioned ${vector.string(n)} run particle hf_mzs:gong_break ^1^1^`),t.entity.runCommand(`/execute positioned ${vector.string(n)} run particle hf_mzs:gong_break ^1^2^`),t.entity.runCommand(`/execute positioned ${vector.string(n)} run particle hf_mzs:gong_break ^-1^^`),t.entity.runCommand(`/execute positioned ${vector.string(n)} run particle hf_mzs:gong_break ^-1^1^`),t.entity.runCommand(`/execute positioned ${vector.string(n)} run particle hf_mzs:gong_break ^-1^2^`),t.entity.remove()}}export function tick1(){for(const t of selectors.getAllDimensions({type:"hf_mzs:gong"}))t.getDynamicProperty("hf_mzs:iterated_enough")||t.setDynamicProperty("hf_mzs:iterated_enough",0),t.getDynamicProperty("hf_mzs:iterated_enough")<20&&(t.setDynamicProperty("hf_mzs:start_location",`${t.location.x},${t.location.y},${t.location.z}`),t.setDynamicProperty("hf_mzs:iterated_enough",t.getDynamicProperty("hf_mzs:iterated_enough")+1))}