import { world } from "@minecraft/server";
import { fallingBlocksManager } from "../fallingBlocksManager";
import { breakBlock } from "../util/miscUtils";
import { SuppStates } from "../reg/suppStates";
fallingBlocksManager.register("razz_sup:urn" /* SuppBlocks.Urn */, {
    onLand(entity, placedAt) {
        //const verticalSpeed = entity.getVelocity().y;
        //if (verticalSpeed < -0.6) {
        breakBlock(placedAt);
        //}
    }
});
//thanks mojang. silk touch skips loot tables...
world.afterEvents.playerBreakBlock.subscribe((event) => {
    const block = event.brokenBlockPermutation;
    if (block.type.id == "razz_sup:urn" /* SuppBlocks.Urn */ && block.getState(SuppStates.Treasure)) {
        const center = event.block.center();
        event.player.runCommand(`loot spawn ${center.x} ${center.y} ${center.z} loot razz_sup_manual_urn`);
    }
});
