A summoned or egg-spawned mob is not persistent

Vanilla never calls `Mob.setPersistenceRequired` for a mob it spawns: the
spawn egg's offspring, the spawn egg on a block and `/summon` all leave
the mob to the despawn rule, and only the NBT can make it persistent.
Horizon marked every one of them persistent, so they never despawn and
they are left out of the mob cap.

The three paths now spawn the mob like before, without the persistence
flag, and the command execution corpus checks it against vanilla: a
summoned zombie is not selected by `nbt={PersistenceRequired:1b}`.

Fixes #2787

Co-Authored-By: minimax-m3.1-flash (Claude Code) <noreply@users.noreply.github.com>
This commit is contained in:
levzzz
2026-10-27 19:21:08 +05:00
parent 6b9d3309cc
commit f8f2f904bc
3 changed files with 22 additions and 4 deletions
+5
View File
@@ -327,6 +327,11 @@ def entities():
cmd('/data get entity @e[tag=attr,limit=1] Health'),
cmd('/attribute @e[tag=attr,limit=1] minecraft:attack_damage base get'),
cmd('/kill @e[tag=attr]'),
# A summoned mob is not persistent: vanilla never calls
# `Mob.setPersistenceRequired` for a mob it spawns (#2787).
cmd('/summon minecraft:zombie 4.5 210 12.5'),
cmd('/execute if entity @e[type=minecraft:zombie,nbt={PersistenceRequired:1b}]'),
cmd('/kill @e[type=minecraft:zombie]'),
# An End crystal is an entity of its own: a type selector finds it,
# reads it and kills it (#1531).
cmd('/summon minecraft:end_crystal 4.5 210 8.5'),