Data-Driven Spawn Rules
Data-Driven spawning allows creators to adjust the spawn conditions of mobs within Minecraft: Bedrock Edition, providing the tools to determine when, where, and how mobs spawn in the world. Let's take a closer look at how data-driven spawning works.
Spawn Rules
First and foremost, all Spawn Rules JSON files must have an ID that follows the "namespace:name" convention. Note that the minecraft
namespace is reserved for vanilla Minecraft rules.
When changing an existing mob, use the ID that appears in the entity JSON for that entity. When creating your own mob, make sure all of the entity's JSON files use the same ID.
Secondly, the pool used for population control must be defined. There are four pools that entities can be assigned to (animal, water_animal, monster, and cat), and each has its own spawn limit. By assigning an entity to a pool, it will spawn as long as that pool hasn't reached the spawn limit.
Important
The 'cat' pool functions differently than the other 3 population pools. Cat spawn rules and limits are based upon the amount within a village.
Note
There are 2 more pools located within the game files, Villager
and Pillager
. However, these are not currently used by any entities.
Components
The following components provide the specifics in determining the ways in which spawns occur, from specifying which spawns occur by difficulty to setting the probability of spawned entities to mutate; this is where the potential for magic occurs.
Name | Description |
---|---|
minecraft:biome_filter | Allows players to specify which biomes the mob spawns in. Check on minecraft:biome_filter to see which Biome Tags exist, and what each biome is tagged as. |
minecraft:brightness_filter | Allows players to set the light level range that causes the mob to spawn. |
minecraft:delay_filter | Allows players to set mobs spawn with specified time delays. |
minecraft:density_limit | Allows players to specify the amount of mobs to spawn in certain locations. |
minecraft:difficulty_filter | Allows creators to set which mobs spawn depending on difficulty level. |
minecraft:disallow_spawns_in_bubble | Allows creators to keep entities from spawning in bubbles. |
minecraft:entity_types | This is a specific type of JSON object used by Minecraft: Bedrock Edition to encapsulate entity data that can be used in certain behaviors and components. |
minecraft:height_filter | Allows players to set mob spawning within specific heights of the map. |
minecraft:herd | Allows players to determine the herd size of animals. |
minecraft:mob_event_filter | Allows players to spawn mobs on a pillager, wandering trader, or ender dragon event. |
minecraft:operator | Defines arithmetic operators in order to compare the values of two given data points. |
minecraft:permute_type | Allows players to specify the permutations of a mob that will spawn. |
minecraft:player_in_village_filter | Allows players to be filtered by whether they are in a village or not, using distance and the village border definitions. |
minecraft:spawn_event | Event related to the spawning of an entity. |
minecraft:spawns_lava | Determines if an entity spawns on lava. |
minecraft:spawns_on_block_filter | Allows an entity to spawn on a particular block. |
minecraft:spawns_on_block_prevented_filter | Prevents an entity from spawning on a particular block. |
minecraft:spawns_on_surface | Allows an entity to spawn on the surface. |
minecraft:spawns_underwater | Allows the mob to spawn underwater. |
minecraft:weight | Allows players to set a priority for how often that mob should spawn. |
minecraft:world_age_filter | Allows players to set mob spawns after a specified amount of time has passed within a world. |
Example Spawn Rules for the zombie
{
"format_version": "1.8.0",
"minecraft:spawn_rules": {
"description": {
"identifier": "minecraft:zombie",
"population_control": "monster"
},
"conditions": [
{
"minecraft:spawns_on_surface": {},
"minecraft:spawns_underground": {},
"minecraft:brightness_filter": {
"min": 0,
"max": 7,
"adjust_for_weather": true
},
"minecraft:difficulty_filter": {
"min": "easy",
"max": "hard"
},
"minecraft:weight": {
"default": 100
},
"minecraft:herd": {
"min_size": 2,
"max_size": 4
},
"minecraft:permute_type": [
{
"weight": 95
},
{
"weight": 5,
"entity_type": "minecraft:zombie_villager_v2"
}
],
"minecraft:biome_filter": {
"test": "has_biome_tag", "operator": "==", "value": "monster"
}
}
]
}
}
Vanilla Entity Spawn Rules
Below is a list of all available spawn rules for Vanilla Behavior Pack entities as of the publication of this article.