mojira.dev
MC-280342

Slimes and magma cubes can spawn inside of entities and fluids

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:

  1. Find a slime chunk (in biome with mob spawning) or basalt delta.

  2. Build a spawning platform - use jack o lanterns or set daytime for slime chunks to prevent other mobs from spawning.

  3. Place fluids or armor stands with 1 to 2 blocks between them.

  4. 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.

Comments 1

the report will be seen by the the bug tracker mods end be fixed by mojang sortly

stacked_dynamite

(Unassigned)

Community Consensus

Platform

Normal

Entities, Hitboxes, Mob spawning

1.21.4, 25w09a

Retrieved