Certain types of trial spawners that generate in the trial chambers will fail to set the spawned mobs as persistent, allowing the player to despawn the mobs and claim their reward without fighting.
Steps to Reproduce
Locate a trial spawner that is affected by the bug.
Example:Seed: -3955354196018892310 /execute in minecraft:overworld run tp @s 40.00 -35.00 191.77 -643.71 17.55
Activate the trial spawner by switching to survival.
Move more than 128 blocks from the spawner and wait there for ~10s.
Return to the spawner.
Expected Result
The mobs remain inside the room.
Actual Result
All of the mobs spawned by the trial spawner despawn causing the trial spawner to eject loot.
Code analysis (Mojang mappings, 23w45a): In
TrialSpawner#spawnMob
:The spawner only sets persistence (and finalizes spawn) if the
entity
field insidespawn_data
has only one tag (which is theid
tag). Spawners that spawn slimes, skeletons holding poison arrows, and baby zombies have more than one tag, so thePersistenceRequired
tag is not set (also, mobs cannot spawn left handed, baby zombies do not spawn with armor or as chicken jockeys, and poison skeletons do not spawn with armor, as that is done infinalizeSpawn
).