import*as mc from"@minecraft/server";import*as vector from"../utils/vector";import{spawnXp}from"../entities";export function eventBehavior(t){if("register"===t.eventId&&t.entity.setProperty("hf_mzs:pump",!1),"drop"===t.eventId&&mc.world.gameRules.doMobLoot&&t.entity.isValid())return spawnXp(t.entity.location,3,t.entity.dimension),void t.entity.remove();"death"!==t.eventId||mc.system.runTimeout((()=>{t.entity.isValid()&&t.entity.triggerEvent("drop")}),3)}export function tick5(t){const e=t.dimension.getBlockFromRay(t.location,vector.down,{maxDistance:500,includePassableBlocks:!0,includeLiquidBlocks:!0});if(void 0===e||!e.block.isValid())return;const o=Math.abs(t.location.y-e.block.location.y);(o<=5||Math.random()<=.26&&o<=16)&&!t.getProperty("hf_mzs:pump")&&pump(t)}function pump(t){t.setProperty("hf_mzs:pump",!0),mc.system.runTimeout((()=>{if(!t.isValid())return;t.clearVelocity();const e={x:.7*(Math.random()-.5),y:.27,z:.7*(Math.random()-.5)};t.applyImpulse(e),mc.system.runTimeout((()=>{t.isValid()&&t.applyImpulse(vector.multiply(vector.up,-.295))}),10),mc.system.runTimeout((()=>{t.isValid()&&t.setProperty("hf_mzs:pump",!1)}),40+30*Math.random())}),6)}