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).
While the mobcap for regular spawning depends on the number of players, it does not affect spawners.
From the wiki (archive):
MaxNearbyEntities: Overrides the maximum number of nearby (within a box of spawnrange*2+1 x spawnrange*2+1 x 8 centered around the spawner block) entities whose IDs match this spawner's entity ID. Note that this is relative to a mob's hitbox, not their physical position. Also note that all entities within all chunk sections (16x16x16 cubes) overlapped by this box are tested for their ID and hitbox overlap, rather than just entities which are within the box, meaning a large amount of entities outside the box (or within it, of course) can cause substantial lag.
This means that the number of e.g. zombies around a zombie spawner is fixed for that spawner. Even if you bring in zombies that were not spawned by that spawner, they still decrease the amount of zombies that can spawn there. And also it doesn't matter how many players are there, as long as at least one stands inside the activation radius.
I wasn't able to figure out just from research whether the mob spawner counts renamed mobs, too, but from that wiki quote it seems like it.
Best Answer
Yes, add the tags you want in
EntityTag
. For example:No, you will need to edit the data of the mob spawner separately. For example: