mojira.dev
MC-266577

Some trial spawners in trial chambers spawn mobs without persistence

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

  1. 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
  2. Activate the trial spawner by switching to survival.

  3. Move more than 128 blocks from the spawner and wait there for ~10s.

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

Linked issues

Attachments

Comments 1

Code analysis (Mojang mappings, 23w45a): In TrialSpawner#spawnMob:

...
   if ($$13 instanceof Mob) {
            Mob $$14 = (Mob)$$13;
            ...
            if ($$3.getEntityToSpawn().size() == 1 && $$3.getEntityToSpawn().contains("id", 8)) {
                $$14.finalizeSpawn($$0, $$0.getCurrentDifficultyAt($$14.blockPosition()), MobSpawnType.TRIAL_SPAWNER, null, null);
                $$14.setPersistenceRequired();
            }
        }
...

The spawner only sets persistence (and finalizes spawn) if the entity field inside spawn_data has only one tag (which is the id tag). Spawners that spawn slimes, skeletons holding poison arrows, and baby zombies have more than one tag, so the PersistenceRequired 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 in finalizeSpawn).

ninjabob0

(Unassigned)

1140460

Confirmed

Expansion B

Normal

Mob spawning

23w45a

24w03b

Retrieved