Data: /data get entity writes a mob's live riders

A mounted mob answered "Found no elements matching Passengers": the command
built the entity with the flat serializer, so `Passengers` was never in the
tag, even though the game had the relationship and saving a world kept it.

Persistence already writes the tree (`Game::mob_tree_nbt`, which also carries
the leash), and vanilla's command path uses the same one, so the command reads
it now.

Fixes #1519.

Co-Authored-By: Hermes Agent (Nous Research) <noreply@nousresearch.com>
This commit is contained in:
Alexander Krylov
2026-10-25 01:51:47 +03:00
parent de840da0e5
commit 977ef7181f
2 changed files with 10 additions and 3 deletions
+6
View File
@@ -280,6 +280,12 @@ def entities():
cmd('/execute as @e[tag=h] run say mob'),
cmd('/execute store result score @s harness_score run data get entity @s SelectedItemSlot'),
cmd('/kill @e[tag=h]'),
# A live rider travels with its vehicle in `/data get`, the way `saveWithoutId`
# writes it (#1519): the pig is mounted, so its health is the nested value.
cmd('/summon minecraft:cow 4.5 210 8.5 {Tags:["root"],NoAI:1b,Passengers:[{id:"minecraft:pig",NoAI:1b}]}'),
cmd('/data get entity @e[tag=root,limit=1] Passengers[0].Health'),
cmd('/data get entity @e[tag=root,limit=1] Passengers[0].id'),
cmd('/kill @e[tag=root]'),
*setup('/kill @e[type=minecraft:armor_stand]'),
{'op': 'tick', 'n': 25},
cmd('/execute if entity @e[tag=h]'),