mojira.dev
MC-156004

Zombified Piglin spawning is affected by light level

The bug

Zombified Piglins stopped spawning near light sources in the nether. This bug affects gold farm by reducing the amount of valid spawning positions.

To test it, I created spawning platforms in the nether (high above the nether ceiling, see screenshot). The only possible spawning block were on the platforms. Two platforms were empty, a third platform had torch rows on every second block, a fourth platform had glowstone rows two blocks above the platform. A fifth platform was made out of Magma Blocks.

The results show, that piglins can spawn on the first two platforms and the fifth platform. On the platforms with the torches and the glowstone above, no zombified piglins spawned.

Recreating this setup in 1.13.2 shows that piglins can spawn on all platforms.

Linked issues

Attachments

Comments 3

Zombie Pigman is now called Zombified Piglin

Can confirm for 1.16.5

Looked into the cause of this, since I was confused why 22w46a lowered the light level for Skeletons, Wither Skeletons, and Endermen in the Nether from 11 to 7 but did not do so for  Zombified Piglins. I didn't see any light level check in ZombifiedPiglin.checkZombifiedPiglinSpawnRules(), which made it more confusing. As far as that method is concerned they should spawn in any light level.

It turns out it's the call to the generic mob.checkSpawnRules(). PathfinderMob overrides this to check for this.getWalkTargetValue(this.blockPosition(), levelAccessor) >= 0.0f, and Monster overrides that method to return a value based on light level that happens to be >= 0 for light levels <=11 but goes negative for light levels 12 to 15.

P.S. This same thing seems to be the cause for Blazes, Piglins, and Hoglins also requiring light level <=11 to spawn. Magma Cubes and Ghasts escape because they aren't subclasses of PathfinderMob, which is why they do manage to spawn in any light level.

Chris Lucas

(Unassigned)

Confirmed

Gameplay

Low

Mob spawning

Minecraft 1.14.3, Minecraft 1.14.4 Pre-Release 2, 20w07a, 1.16 Pre-release 5, 1.16.1, 1.16.5

Retrieved