on Block Placed
Run code when a certain type of block is placed.
blocks.onBlockPlaced(GRASS, () => {
});
Parameters
- block: the type of block that, when it is placed, will start some code
- handler: this is the code to run when the type of block selected in block is placed in the world
Example
This code displays a comment in the game chat when a block of gold is placed in the world.
blocks.onBlockPlaced(GOLD_BLOCK, () => {
player.say("Shiny!");
});