2

What I mean is--can you spawn in a monster spawner that has a chance to spawn a different mob or type of mob seperate from the mob already being spawned?

1 Answer 1

5

Yes, monster spawners have a SpawnPotentials list, in which multiple different mobs can be specified. Here's an example with a charged creeper and a zombie:

/setblock ~ ~1 ~ mob_spawner 0 replace {Delay:-1,SpawnPotentials:[{Weight:1,Entity:{id:"Creeper",powered:1b}},{Weight:1,Entity:{id:"Zombie"}}]}

For versions later than 1.10, you'l need to replace Creeper with minecraft:creeper and Zombie with minecraft:zombie.

Expanded:

{
    Delay:-1,
    SpawnPotentials:
    [
        {
            Weight:2,
            Entity:
            {
                id:"Creeper",
                powered:1b
            }
        },
        {
            Weight:1,
            Entity:
            {
                id:"Zombie"
            }
        }
    ]
}

The SpawnPotentials contains a list of entries with a Weight integer and a Entity compound tag.

Weight determines how often this type of mob is chosen. In my example, the ratio of creepers to zombies will be 2:1.

Entity is where all of the tags for the entity you want to spawn should go, such as their id and powered:1b.

Delay:-1 makes the spawner immediately pick at random from its SpawnPotentials to copy to SpawnData, rather than spawning whatever's in SpawnData first (a pig, by default).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .