minecraft:behavior.lay_egg
Allows the mob to lay an egg block on certain types of blocks if the mob is pregnant.
Properties
| Property | Type | Default | What it does |
|---|---|---|---|
target_blocks | List of text | ["minecraft:sand"] | Blocks that the mob can lay its eggs on top of. |
target_materials_above_block | List of text | ["air"] | Types of materials that can exist above the target block. Valid types are Air, Water, and Lava. |
allow_laying_from_below | Boolean | false | Allows the mob to lay its eggs from below the target if it can't get there. This is useful if the target block is water with air above, since mobs may not be able to get to the air block above water. |
use_default_animation | Boolean | true | Specifies if the default lay-egg animation should be played when the egg is placed or not. |
lay_seconds | Decimalmin 0 | 10 | Duration of the laying egg process in seconds. |
egg_type | Text | "minecraft:turtle_egg" | Block type for the egg to lay. If this is a turtle egg, the number of eggs in the block is randomly set. |
lay_egg_sound | Textitem.use.on, hit, step, step.baby, fly, jump, jump.prevent, break, place, heavy.step, gallop, fall, hurt, hurt.baby, hurt.in.water, death, death.baby, death.in.water, death.to.zombie, ambient, ambient.baby, ambient.in.water, ambient.in.air, ambient.tame … | "lay_egg" | Name of the sound event played when laying the egg. Defaults to lay_egg, which is used for Turtles. |
on_lay | Object | {"event": "", "filters": {"AND": null, "NOT": null, "OR":… | Event to run when this mob lays the egg. |
event | Text | "" | |
target | Textself, other, player, target, parent, baby, block, damager, holder, item | "self" | |
filters | Object or List of object | {"AND": null, "NOT": null, "OR": null, "all": null, "all_… | Filters allow data objects to specify test criteria which allows their use. Filters can be defined by a single object of type (Filter Test), an array of tests, collection groups, or a combination of these objects. |
test | Text | — | The name of the test to apply. |
subject | Boolean or Integer or Decimal or Text | — | The subject of this filter test. |
operator | Boolean or Integer or Decimal or Text | — | The comparison to apply with 'value'. |
domain | Boolean or Integer or Decimal or Text | — | The domain the test should be performed in. |
value | Boolean or Integer or Decimal or Text | — | The value being compared with the test. |
search_range | Integer | 0 | The distance in blocks it will look for the block to move towards. |
search_height | Integer | 1 | The height in blocks the mob will look for the block to move towards. |
goal_radius | Decimal | 0.5 | Distance in blocks within the mob considers it has reached the goal. This is the "wiggle room" to stop the AI from bouncing back and forth trying to reach a specific spot. |
speed_multiplier | Decimalmin 0 | 1 | Movement speed multiplier of the mob when using this goal. |
priority | Integermin 0 | 0 | |
control_flags | List of text | [] |
Example from the game files
This is how vanilla Frog uses it in Minecraft Bedrock 1.26.60.5:
{
"minecraft:behavior.lay_egg": {
"allow_laying_from_below": true,
"lay_seconds": 2,
"egg_type": "minecraft:frog_spawn",
"search_height": 3,
"priority": 2,
"goal_radius": 1.7,
"lay_egg_sound": "lay_spawn",
"on_lay": {
"event": "laid_egg",
"target": "self"
},
"search_range": 10,
"use_default_animation": false,
"speed_multiplier": 1.0,
"target_blocks": [
"minecraft:sand",
"minecraft:water"
],
"target_materials_above_block": [
"air",
"air"
]
}
}Used by 2
Vanilla entities with minecraft:behavior.lay_egg in their definition:
Related components
behavior.pickup_itemsbehavior.move_to_villagebehavior.harvest_farm_blockbehavior.move_indoorsbehavior.move_outdoorsbehavior.place_blockbehavior.raid_gardenbehavior.digbehavior.dragonscanningbehavior.drop_item_forbehavior.eat_blockbehavior.eat_carried_itembehavior.eat_mobbehavior.fertilize_farm_blockbehavior.hold_groundbehavior.inspect_bookshelfbehavior.move_through_villagebehavior.open_doorbehavior.random_search_and_digbehavior.restrict_open_doorbehavior.snackingbehavior.stroll_towards_villagebehavior.take_blockbehavior.transport_items