minecraft:behavior.lay_egg

Allows the mob to lay an egg block on certain types of blocks if the mob is pregnant.

Properties

PropertyTypeDefaultWhat it does
target_blocksList of text["minecraft:sand"]Blocks that the mob can lay its eggs on top of.
target_materials_above_blockList of text["air"]Types of materials that can exist above the target block. Valid types are Air, Water, and Lava.
allow_laying_from_belowBooleanfalseAllows 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_animationBooleantrueSpecifies if the default lay-egg animation should be played when the egg is placed or not.
lay_secondsDecimalmin 010Duration of the laying egg process in seconds.
egg_typeText"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_soundTextitem.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_layObject{"event": "", "filters": {"AND": null, "NOT": null, "OR":…Event to run when this mob lays the egg.
eventText""
targetTextself, other, player, target, parent, baby, block, damager, holder, item"self"
filtersObject 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.
testText—The name of the test to apply.
subjectBoolean or Integer or Decimal or Text—The subject of this filter test.
operatorBoolean or Integer or Decimal or Text—The comparison to apply with 'value'.
domainBoolean or Integer or Decimal or Text—The domain the test should be performed in.
valueBoolean or Integer or Decimal or Text—The value being compared with the test.
search_rangeInteger0The distance in blocks it will look for the block to move towards.
search_heightInteger1The height in blocks the mob will look for the block to move towards.
goal_radiusDecimal0.5Distance 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_multiplierDecimalmin 01Movement speed multiplier of the mob when using this goal.
priorityIntegermin 00
control_flagsList 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