import { world } from "@minecraft/server";

const blockTypes = ["minecraft:budding_amethyst"];

world.afterEvents.playerBreakBlock.subscribe((event) => {
	const { brokenBlockPermutation } = event;

	blockTypes.forEach((id) => {
		if (brokenBlockPermutation.matches(id)) {
			event.player.dimension.runCommand(
				`summon manalabs_opw:amethyst_fish ${event.block.x} ${event.block.y} ${event.block.z}`,
			);
			return;
		}
	});
});
