import*as mc from"@minecraft/server";export function onUse(t){mc.system.run((()=>{const o=t.itemStack,i=t.source,a=t.block;if("hf_mzs:foliaath_seed"===o.typeId&&t.isFirstEvent&&("minecraft:grass_block"===a.typeId||"minecraft:dirt"===a.typeId)){const t=a.above();if(t&&t.isValid()){const o=t.dimension.getEntitiesAtBlockLocation(t.location);let a=0;for(const t of o)"hf_mzs:foliaath"!==t.typeId&&"hf_mzs:foliaath_baby"!==t.typeId||a++;if(0===a){i.runCommand("/clear @s hf_mzs:foliaath_seed 0 1");const o=t.location;o.x=Math.floor(o.x)+.5,o.z=Math.floor(o.z)+.5,t.dimension.spawnEntity("hf_mzs:foliaath_baby",o)}}}}))}