编辑

通过


Entity Documentation - minecraft:spawn_entity

Adds a timer after which this entity will spawn another entity or item (similar to vanilla's chicken's egg-laying behavior).

Spawn Entity Properties

Name Default Value Type Description Example Values
entities (Entities) not set Array of Entities items List of entity spawn definitions. Can be a single object or an array of objects. Chicken: [{"min_wait_time":300,"max_wait_time":600,"spawn_sound":"plop","spawn_item":"egg","filters":[{"test":"rider_count","subject":"self","operator":"==","value":0},{"test":"enum_property","subject":"self","domain":"minecraft:climate_variant","value":"temperate"}]},{"min_wait_time":300,"max_wait_time":600,"spawn_sound":"plop","spawn_item":"brown_egg","filters":[{"test":"rider_count","subject":"self","operator":"==","value":0},{"test":"enum_property","subject":"self","domain":"minecraft:climate_variant","value":"warm"}]},{"min_wait_time":300,"max_wait_time":600,"spawn_sound":"plop","spawn_item":"blue_egg","filters":[{"test":"rider_count","subject":"self","operator":"==","value":0},{"test":"enum_property","subject":"self","domain":"minecraft:climate_variant","value":"cold"}]}], Drowned: {"max_wait_time":0,"min_wait_time":0,"num_to_spawn":1,"single_use":true,"spawn_entity":"minecraft:zombie_nautilus","spawn_event":"minecraft:entity_spawned"}, Sniffer: {"min_wait_time":0,"max_wait_time":0,"spawn_sound":"plop","spawn_item":"sniffer_egg","spawn_item_event":{"event":"on_egg_spawned","target":"self"},"single_use":true}
entities (as Object) not set Object
filters not set Minecraft filter If present, the specified entity will only spawn if the filter evaluates to true.
max_wait_time 600 Integer number Maximum amount of time to randomly wait in seconds before another entity is spawned.
min_wait_time 300 Integer number Minimum amount of time to randomly wait in seconds before another entity is spawned.
num_to_spawn 1 Integer number The number of entities of this type to spawn each time that this triggers.
should_leash false Boolean true/false If true, this the spawned entity will be leashed to the parent.
single_use false Boolean true/false If true, this component will only ever spawn the specified entity once.
spawn_entity not set String Identifier of the entity to spawn, leave empty to spawn the item defined by "spawn_item" instead.
spawn_event minecraft:entity_born Minecraft Event Trigger Event to call on the spawned entity when it spawns.
spawn_item egg String Item identifier of the item to spawn.
spawn_item_event not set Minecraft Event Trigger Event to call on this entity when the item is spawned.
spawn_method born String Method to use to spawn the entity.
spawn_sound plop String Identifier of the sound effect to play when the entity is spawned.

Entities

Entities Properties

JSON path: entities

Name Default Value Type Description Example Values
filters not set String Chicken: [{"test":"rider_count","subject":"self","operator":"==","value":0},{"test":"enum_property","subject":"self","domain":"minecraft:climate_variant","value":"temperate"}]
max_wait_time not set Decimal number Chicken: 600
min_wait_time not set Decimal number Chicken: 300
spawn_item not set String Chicken: "egg"
spawn_sound not set String Chicken: "plop"

Samples

Chicken

"minecraft:spawn_entity": {
  "entities": [
    {
      "min_wait_time": 300,
      "max_wait_time": 600,
      "spawn_sound": "plop",
      "spawn_item": "egg",
      "filters": [
        {
          "test": "rider_count",
          "subject": "self",
          "operator": "==",
          "value": 0
        },
        {
          "test": "enum_property",
          "subject": "self",
          "domain": "minecraft:climate_variant",
          "value": "temperate"
        }
      ]
    },
    {
      "min_wait_time": 300,
      "max_wait_time": 600,
      "spawn_sound": "plop",
      "spawn_item": "brown_egg",
      "filters": [
        {
          "test": "rider_count",
          "subject": "self",
          "operator": "==",
          "value": 0
        },
        {
          "test": "enum_property",
          "subject": "self",
          "domain": "minecraft:climate_variant",
          "value": "warm"
        }
      ]
    },
    {
      "min_wait_time": 300,
      "max_wait_time": 600,
      "spawn_sound": "plop",
      "spawn_item": "blue_egg",
      "filters": [
        {
          "test": "rider_count",
          "subject": "self",
          "operator": "==",
          "value": 0
        },
        {
          "test": "enum_property",
          "subject": "self",
          "domain": "minecraft:climate_variant",
          "value": "cold"
        }
      ]
    }
  ]
}

Drowned

"minecraft:spawn_entity": {
  "entities": {
    "max_wait_time": 0,
    "min_wait_time": 0,
    "num_to_spawn": 1,
    "single_use": true,
    "spawn_entity": "minecraft:zombie_nautilus",
    "spawn_event": "minecraft:entity_spawned"
  }
}

Sniffer

"minecraft:spawn_entity": {
  "entities": {
    "min_wait_time": 0,
    "max_wait_time": 0,
    "spawn_sound": "plop",
    "spawn_item": "sniffer_egg",
    "spawn_item_event": {
      "event": "on_egg_spawned",
      "target": "self"
    },
    "single_use": true
  }
}