1. Wiki
  2. /Entities
  3. /minecraft:behavior.lay_egg

minecraft:behavior.lay_egg

Don't want to write this by hand? GodCraft sets minecraft:behavior.lay_egg for you with a switch.Get GodCraft

Overview

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

FieldTypeDefaultDescription
target_blocksstring[]["minecraft:sand"]Blocks the egg can be placed on.
target_materials_above_blockstring[]["air"]What may be above the target block: Air, Water or Lava.
allow_laying_from_belowbooleanfalseIf true, the mob can lay from below when it cannot reach the top, handy for frogs laying spawn on water.
use_default_animationbooleantrueIf true, the built-in egg laying animation plays.
lay_secondsnumber10How many seconds laying takes.Range: 0 to …
egg_typestring"minecraft:turtle_egg"The egg block that is placed. Turtle eggs get a random count.
lay_egg_soundLevelSoundEvent"lay_egg"Sound event played while laying.
on_layActorDefinitionTrigger{"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_rangeinteger0How far sideways, in blocks, the mob looks for a place to lay.
search_heightinteger1How far up and down, in blocks, the mob looks for a place to lay.
goal_radiusnumber0.5How close the mob must get to count as arrived.
speed_multipliernumber1Speed multiplier while moving to the spot.Range: 0 to …
priorityinteger0Lower numbers run first: when two goals compete, the one with the smaller priority wins.Range: 0 to …
control_flagsGoal's control flags[]noneWhich 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"
    }
  }
}

We use cookies to improve your experience and analyse site traffic. Learn more