minecraft:behavior.place_block for you with a switch.Get GodCraftOverview
minecraft:behavior.place_block is an entity component: it goes in the components object of a custom mob, or in one of its component groups. Lets the entity place blocks in the world, either the block it carries or a random one from a weighted list. Endermen use it to put down the block they hold.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
placeable_carried_blocks | Block Descriptor[] | none | Which carried blocks may be placed. Leave empty to allow any block. |
randomly_placeable_blocks | PlaceBlockGoalWeightedBlockDescriptor[] | none | A weighted list of blocks to place at random. If empty, the entity places its carried block instead. |
can_place | Filter Group | {"AND":null,"NOT":null,"OR":null,"all":null,"all_of":null,"any":null,"any_of":null,"none_of":null} | Conditions that must be true for the entity to try placing a block. |
on_place | ActorDefinitionTrigger | {"event":"","filters":{"AND":null,"NOT":null,"OR":null,"all":null,"all_of":null,"any":null,"any_of":null,"none_of":null},"target":"self"} | Event that runs after a block is placed. |
xz_range | IntRange | {"max":2,"min":-2} | Sideways range around the entity where blocks can be placed. |
y_range | IntRange | {"max":3,"min":0} | Up and down range around the entity where blocks can be placed. |
chance | number | 1 | Chance each tick that the entity tries to place a block.Range: 0 to 1 |
affected_by_griefing_rule | boolean | true | If true, the goal stops working when the mobGriefing game rule is off. |
priority | integer | 0 | Decides which goal wins when several want to run: lower numbers run first.Range: 0 to … |
control_flags | Goal's control flags[] | none | Lists the body parts this goal takes control of (such as move, look or jump), so goals that need the same part don't run together. |
Example
Inside the components object of BP/entities/<name>.json (values are the defaults or placeholders):
BP/entities/<name>.json
{
"minecraft:behavior.place_block": {
"placeable_carried_blocks": [],
"randomly_placeable_blocks": [],
"can_place": {
"AND": null,
"NOT": null,
"OR": null,
"all": null,
"all_of": null,
"any": null,
"any_of": null,
"none_of": null
},
"on_place": {
"event": "",
"filters": {
"AND": null,
"NOT": null,
"OR": null,
"all": null,
"all_of": null,
"any": null,
"any_of": null,
"none_of": null
},
"target": "self"
},
"xz_range": {
"max": 2,
"min": -2
},
"y_range": {
"max": 3,
"min": 0
},
"chance": 1,
"affected_by_griefing_rule": true
}
}