minecraft:block_placer for you with a switch.Get GodCraftOverview
minecraft:block_placer is an item component: it goes in the components object of a custom item. Makes the item put a block in the world when the player uses it, like a seed or a sign item. It can also show that block as the item's icon, so you may not need a separate icon.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
block | Block Reference | none | The block that gets placed when the item is used. |
use_on | Block Descriptor[] | none | Blocks the item may be used on to place its block. Leave it empty to allow any block. |
replace_block_item | boolean | false | When true, this item becomes the official item of the block, so breaking or pick-blocking the block gives this item. The item and block need the same identifier. |
aligned_placement | boolean | false | When true, holding the use button places blocks in a neat straight line. |
Example
Inside the components object of BP/items/<name>.json (values are the defaults or placeholders):
BP/items/<name>.json
{
"minecraft:block_placer": {
"block": {},
"use_on": [],
"replace_block_item": false,
"aligned_placement": false
}
}