From 02ba66b72149bdc86334485170d01ba521e85010 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 21 Oct 2026 04:21:48 +0200 Subject: [PATCH] /summon reports the entities that take their id when first tracked Primed TNT (and falling blocks, projectiles) spawned from /summon get their entity id only when first tracked, so the summon found no new id and answered "Unable to summon entity" though the entity was there and went off. The summon now also counts those lists, and names the type: "Summoned new Primed TNT", as vanilla. Test: a TNT summon in the command execution corpus (world group: 125/126 match vanilla; the one left, /waypoint list, was there before). Co-Authored-By: Claude Opus 5.5 (cherry picked from commit dd733684bc8a2efca2b2fa76fc54d6eb48608103) --- crates/horizon-client/src/game/commands.rs | 34 +++++++++++++++++----- tools/command_exec_corpus.py | 3 ++ 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/crates/horizon-client/src/game/commands.rs b/crates/horizon-client/src/game/commands.rs index b970414a6..f174f98c1 100644 --- a/crates/horizon-client/src/game/commands.rs +++ b/crates/horizon-client/src/game/commands.rs @@ -1612,11 +1612,16 @@ impl Game<'_> { { return Err(err("commands.summon.failed.peaceful", &[])); } - let Some(target) = self.summon_with_nbt(&format!("minecraft:{short}"), pos, &nbt)? - else { - return Err(err("commands.summon.failed", &[])); + let before = self.spawned_mark(); + let name = match self.summon_with_nbt(&format!("minecraft:{short}"), pos, &nbt)? { + Some(target) => self.target_name(target), + // Spawned as a kind no command target stands for (primed + // TNT, falling blocks, projectiles): its type's name. + None if self.spawned_mark() != before => { + Text::translate(&format!("entity.minecraft.{short}"), &[]) + } + None => return Err(err("commands.summon.failed", &[])), }; - let name = self.target_name(target); self.feedback(Text::translate("commands.summon.success", &[name])); return Ok(1); } @@ -1669,16 +1674,31 @@ impl Game<'_> { } // SummonCommand.createEntity: any other type from an empty compound. _ => { - let Some(target) = self.summon_with_nbt(&kind, pos, "{}")? else { - return Err(err("commands.summon.failed", &[])); + let before = self.spawned_mark(); + name = match self.summon_with_nbt(&kind, pos, "{}")? { + Some(target) => self.target_name(target), + // Spawned as a kind no command target stands for + // (primed TNT, falling blocks, projectiles). + None if self.spawned_mark() != before => { + Text::translate(&format!("entity.minecraft.{short}"), &[]) + } + None => return Err(err("commands.summon.failed", &[])), }; - name = self.target_name(target); } } } self.feedback(Text::translate("commands.summon.success", &[name])); Ok(1) } + /// What changes when an entity spawns, kinds that take their id only + /// when first tracked (primed TNT, falling blocks, projectiles) + /// included: a summon compares it before and after. + fn spawned_mark(&self) -> (u32, usize) { + ( + self.next_entity, + self.tnts.len() + self.falling.len() + self.creatures.projectiles.len(), + ) + } /// BlockStateArgument -> registry state. pub(super) fn block_state(&self, b: &BlockInput) -> R { let state = horizon_world::chunk::BlockState { diff --git a/tools/command_exec_corpus.py b/tools/command_exec_corpus.py index 02311beda..b6edc009a 100644 --- a/tools/command_exec_corpus.py +++ b/tools/command_exec_corpus.py @@ -568,6 +568,9 @@ def world_misc(): cmd('/summon minecraft:armor_stand 4.5 210 4.5 {NoGravity:1b,Tags:["w"],CustomName:{text:"Stand",color:"blue"}}'), cmd('/swing @e[tag=w]'), cmd('/summon minecraft:lightning_bolt 4.5 300 4.5'), + # Primed TNT is no command target in Horizon: still "Summoned new + # Primed TNT" (it explodes high in the air, far from the rest). + cmd('/summon minecraft:tnt 60.5 300 60.5 {fuse:1s}'), cmd('/summon minecraft:pig 4.5 210 4.5 {NoAI:1b,Invulnerable:1b,Tags:["w"],Passengers:[{id:"minecraft:chicken",NoAI:1b,Tags:["w"]}]}'), cmd('/summon minecraft:pig 4.5 400 4.5'), cmd('/summon minecraft:pig 30000000 210 4.5'),