Large and medium Slime and Magma Cubes can spawn with their hitbox inside of entities (ones that block building like armor stands and end crystals) and fluids.
Steps to Reproduce:
Find a slime chunk (in biome with mob spawning) or basalt delta.
Build a spawning platform - use jack o lanterns or set daytime for slime chunks to prevent other mobs from spawning.
Place fluids or armor stands with 1 to 2 blocks between them.
Observe spawns
Expected behavior: No Slimes or Magma Cubes should spawn
Observed behavior: Slimes and Magma cubes do spawn.
Note: Doing the same with blocks and “collideable” entities (e.g. boats and shulkers) will result in neither spawning. See code analysis for explanation.
Code Analysis:
This bug goes back to 1.20.5 when the same behavior back was “fixed” here: https://bugs-legacy.mojang.com/browse/MC-268716
The “fix” was to set a spawnDimensionsScale of 4 for Slimes and Magma Cubes entity types and have spawning checks use the Entitytype::getSpawnAABB hitboxes. While the expanded hitboxes were used for checks called by NaturalSpawner::isValidSpawnPostitionForType*, the same was not used in the checks in Mob::checkSpawnObstruction which is called by NaturalSpawner::isValidPositionForMob during the normal spawning process. Those checks use the mob’s default hitboxes (since they happen before finalizeSpawn is called) and do not apply the “spawn scaling”.
The means that - in practice - the same bug from 1.19.3 persists into current versions despite the attempt to fix it in 1.20.5.
The fix would be to use an equivalent of the Entitytype::getSpawnAABB hitboxes for the checks in Mob::checkSpawnObstruction. This may also preempt future issues with spawning mobs that have spawnDimensionsScale > 1.
*This is why intersections with blocks and “collideable” (canBeCollidedWith) entities are checked correctly.
Special thanks to discord user ka1n__ for helping with testing.
the report will be seen by the the bug tracker mods end be fixed by mojang sortly