Block Events

Events

blockRegister

Fired when a new block is registered.

Examples

Prevent block from being registered

1
this.api.getEventManager()
2
.on("blockRegister", (event: BlockRegisterEvent) => {
3
const block = event.getBlock() as Block;
4
if (block.getName() !== "minecraft:stone") return;
5
6
this.api.getLogger().info("minecraft:stone isn't permitted");
7
event.preventDefault();
8
});
Copied!
Last modified 8mo ago