From 977ef7181f5b38d4d11e7791653690fc876f40ae Mon Sep 17 00:00:00 2001 From: Alexander Krylov Date: Sun, 25 Oct 2026 01:51:47 +0300 Subject: [PATCH] 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) --- crates/horizon-client/src/game/commands/data.rs | 7 ++++--- tools/command_exec_corpus.py | 6 ++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/crates/horizon-client/src/game/commands/data.rs b/crates/horizon-client/src/game/commands/data.rs index 89e3d6397..6e4c9825f 100644 --- a/crates/horizon-client/src/game/commands/data.rs +++ b/crates/horizon-client/src/game/commands/data.rs @@ -65,9 +65,10 @@ impl Game<'_> { tag } Target::Mob(id) => { - let uuid = self.uuid_for(id); - let m = self.mobs.iter().find(|m| m.id == id)?; - entity_nbt::mob_to_nbt(m, uuid, self.persist.raw.get(&id)) + // `saveWithoutId` writes the entity as saved, riders under + // `Passengers`: `/data get` reads the same tree persistence does (#1519). + let i = self.mobs.iter().position(|m| m.id == id)?; + self.mob_tree_nbt(i) } Target::Item(id) => { let uuid = self.uuid_for(id); diff --git a/tools/command_exec_corpus.py b/tools/command_exec_corpus.py index 2b2a0afd1..eacc52a32 100644 --- a/tools/command_exec_corpus.py +++ b/tools/command_exec_corpus.py @@ -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]'),