#Blockt tags and ids
1 messages · Page 1 of 1 (latest)
import { world } from "@minecraft/server";
const data = [
{
blocks: ["minecraft:dirt"],
chance: 100,
entity: "minecraft:creeper",
}
];
world.afterEvents.playerBreakBlock.subscribe((e) => {
const id = e.brokenBlockPermutation.type.id;
data.some((v) =>
v.blocks.includes(id) && Math.random() * 100 <= v.chance
? e.dimension.spawnEntity(v.entity, e.block.location)
: false
);
});