The bug
Zombie reinforcements can spawn on the following biomes: Mushroom Fields, Mushroom Field Shore, The Void, and all Nether and End biomes, even though zombies naturally don't spawn in those biomes.
Steps to reproduce
Create a single biome world of one of the previously mentioned biomes, on creative mode (or go to The End).
Set the difficulty to Hard.
Set command blocks to constantly kill any mob that is not either a zombie or the player (you cannot execute the command
/gamerule doMobSpawning false
, as that disables reinforcements). This is not necessary, but it assures that other mobs won't interfere or attempt to kill the player.Set the time to night.
Spawn a zombie that can summon reinforcements inside it:
/summon zombie ~ ~ ~ {Attributes:[{Name:"zombie.spawn_reinforcements",Base:1.0},{Name:"generic.movement_speed",Base:0.0}]}
Switch the gamemode to survival, and hit the zombie a few times.
❌ Zombie reinforcements will spawn.
Expected results
Zombie reinforcements should not spawn in biomes where zombies can't spawn (especially in the void).
Code analysis
Using 1.18.2-pre1, Mojang mappings
The logic for zombie reinforcement is in the method net.minecraft.entity.monster.Zombie.hurt(DamageSource, float)
; it contains several checks, including NaturalSpawner.isSpawnPositionOk(...)
which checks for an empty valid spawn block within the world border, and SpawnPlacements.checkSpawnRules(...)
which checks monster spawn rules (brightness, not in Peaceful mode). However, none of these methods seem to check for biomes where zombies can naturally spawn.
Potential fix:
Using 1.19.2, Mojang mappings
Change this piece of code of Zombie#hurt
from:
...
BlockPos $$12 = new BlockPos($$9, $$10, $$11);
EntityType<?> $$13 = $$7.getType();
SpawnPlacements.Type $$14 = SpawnPlacements.getPlacementType($$13);
if (!NaturalSpawner.isSpawnPositionOk($$14, this.level, $$12, $$13) || !SpawnPlacements.checkSpawnRules($$13, $$2, MobSpawnType.REINFORCEMENT, $$12, this.level.random)) continue;
...
To:
...
BlockPos $$12 = new BlockPos($$9, $$10, $$11);
EntityType<?> $$13 = $$7.getType();
SpawnPlacements.Type $$14 = SpawnPlacements.getPlacementType($$13);
Holder<Biome> biome = $$2.getBiome($$12);
if (biome.is(BiomeTags.IS_NETHER) || biome.is(BiomeTags.IS_END) || biome.is(BiomeTags.WITHOUT_ZOMBIE_SIEGES) || biome.is(BiomeTags.WITHOUT_WANDERING_TRADER_SPAWNS)) continue;
if (!NaturalSpawner.isSpawnPositionOk($$14, this.level, $$12, $$13) || !SpawnPlacements.checkSpawnRules($$13, $$2, MobSpawnType.REINFORCEMENT, $$12, this.level.random)) continue;
...
There is probably a much better way to fix this, but this works.
Linked issues
is duplicated by 1
Attachments
Comments 8
When a dungeon generates in a mushroom fields biome (as described in MC-227601), it is possible in survival mode.
Also affects the following biomes, which zombies are not usually able to spawn in:
The Void
Every nether biome
Every end biome
I just finally figured out why they spawned multiple times in my mushroom biome, and it is this exact bug. it can happend in survival mode just too easily, even if player is just AFK and did not built anything before. It can happend with stuff like naturally spawned axolotl killing naturally spawned drowned, spawning zombies on mushroom biome where it shouldnt, even on things like redstone where they shouldn't. In player-build structures like mob trap, it can spawn outside... I just feel like spawn mechanics of reinforcements are just bad as a whole, not just biome itself. it is cool feature, but this spawning not properly implemented. So even biome that shoud be completly monster free is not safe from monsters, both from phantoms and this bug.
So is this considered a bug and something that will be removed eventually? This behavior makes sense to me since reinforcements bypass the mobcap, so that's already one "rule" the mechanic circumvents. Also, considering that the mechanic only exists in hard difficulty AND you'd have to lure a zombie in or find a mushroom field with a zombie spawner, I think it should be considered intended behavior. I just don't see how this could even occur without the player purposefully setting the situation up.
@unknown This hasn't been triaged yet, so I am not sure if this is intended or not. We'll have to see. Personally, I think this behavior is illogical and unintuitive, and possibly the result of an oversight: mushroom biomes disallow all types of spawns, except zombie reinforcements (edit: and spawners). It doesn't make much sense to me for zombies to spawn in the Nether or the End either.
@ampolive Dungeon spawners also work and skeleton traps can spawn in mushroom fields as well, so it isn't only reinforcements.
Personally, I think that it should be kept since it's exclusive to hard difficulty and requires a zombie spawner (which I player can break or disable) or luring in a zombie or drowned (something that is easily avoidable, especially for any player choosing to play on hard difficulty). I can agree on removing reinforcement spawning from The End and Nether, but I really do think that allowing reinforcements in mushroom fields adds a fun quirk for reinforcement farms (it basically allows you to have a perimeter without actually digging one, so you can keep the natural feel of the area and still get the rewards from the farm). And that quirk is something that is easily avoidable for players who do not wish to utilize it.
Relates to MC-14800, MC-126778 and MC-171585. Discovered while testing MC-227601.