minecraft:behavior.lay_egg for you with a switch.Get GodCraftOverview
minecraft:behavior.lay_egg is an entity component: it goes in the components object of a custom mob, or in one of its component groups. AI goal that makes a pregnant mob place an egg block on a fitting block, like a turtle laying eggs on sand.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
target_blocks | string[] | ["minecraft:sand"] | Blocks the egg can be placed on. |
target_materials_above_block | string[] | ["air"] | What may be above the target block: Air, Water or Lava. |
allow_laying_from_below | boolean | false | If true, the mob can lay from below when it cannot reach the top, handy for frogs laying spawn on water. |
use_default_animation | boolean | true | If true, the built-in egg laying animation plays. |
lay_seconds | number | 10 | How many seconds laying takes.Range: 0 to … |
egg_type | string | "minecraft:turtle_egg" | The egg block that is placed. Turtle eggs get a random count. |
lay_egg_sound | LevelSoundEvent | "lay_egg" | Sound event played while laying. |
on_lay | 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 fires once the egg is laid. |
search_range | integer | 0 | How far sideways, in blocks, the mob looks for a place to lay. |
search_height | integer | 1 | How far up and down, in blocks, the mob looks for a place to lay. |
goal_radius | number | 0.5 | How close the mob must get to count as arrived. |
speed_multiplier | number | 1 | Speed multiplier while moving to the spot.Range: 0 to … |
priority | integer | 0 | Lower numbers run first: when two goals compete, the one with the smaller priority wins.Range: 0 to … |
control_flags | Goal's control flags[] | none | Which body parts this goal takes over (move, look, jump), so goals using the same parts cannot run together. |
Example
Inside the components object of BP/entities/<name>.json (values are the defaults or placeholders):
BP/entities/<name>.json
{
"minecraft:behavior.lay_egg": {
"target_blocks": [
"minecraft:sand"
],
"target_materials_above_block": [
"air"
],
"allow_laying_from_below": false,
"use_default_animation": true,
"lay_seconds": 10,
"egg_type": "minecraft:turtle_egg",
"lay_egg_sound": "lay_egg",
"on_lay": {
"event": "",
"filters": {
"AND": null,
"NOT": null,
"OR": null,
"all": null,
"all_of": null,
"any": null,
"any_of": null,
"none_of": null
},
"target": "self"
}
}
}