Server: track primed TNT, falling blocks, projectiles, tridents, fireworks and crystals

These entities had no id in Horizon, so a server could not send them to
its clients. Each now has one, given from the entity counter before it is
first tracked, and goes to guests as vanilla's ServerEntity sends it:

- primed TNT with its fuse (sent each tick it changes) and falling blocks
  with their block state and start position; both sync their exact
  position while they touch a block (requiresPrecisePosition);
- arrows and tridents send their position and rotation every update
  (AbstractArrow), with their flags, pierce level, in-ground state,
  loyalty and foil; their owner is the spawn data;
- fireballs, wither skulls and wind charges bundle their velocity with
  ClientboundProjectilePowerPacket (new in horizon-protocol);
- snowballs, eggs, pearls, llama spit, shulker bullets and splash potions;
- firework rockets with their item, the player they boost and whether
  they were shot at an angle; end crystals with their beam and base.

The entity harness's scene gains primed TNT, a falling block, an arrow, a
snowball and a trident that land, a fireball, a firework and a crystal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-17 22:39:00 +02:00
parent 583502f0f4
commit 866e772227
15 changed files with 313 additions and 27 deletions
+14 -2
View File
@@ -6,7 +6,9 @@ world vanilla generated first, with the same server.properties (offline, view di
client (VanillaProtocolClient in its entity mode) joins, and once its chunks are in it asks for the scene: the
console freezes the ticks, builds a wall and a rail and summons, around the spawn, every kind of minecart (one
set rolling along the rail), boats and a raft (one falling onto the ground), armor stands (posed, small, with
arms, wearing a helmet, one falling), a chicken jockey, item frames (one holding a turned diamond) and paintings. The client records
arms, wearing a helmet, one falling), a chicken jockey, item frames (one holding a turned diamond), paintings,
primed TNT, a falling block, an arrow, a snowball and a trident that land, a fireball, a firework rocket and an
end crystal. The client records
for 20 seconds, the ticks running again after 3, what ClientPacketListener would make of the packets (EntityTranscript): each entity's spawn
packet (position, rotations, data, motion), the entity data it was paired with and all it was sent since, its
equipment and passengers, and where its position syncs leave it. Both transcripts must match exactly,
@@ -66,6 +68,15 @@ SCENE = [
'summon minecraft:glow_item_frame -1.5 -59 -4.97 {block_pos:[I;-2,-59,-5],Facing:3b}',
'summon minecraft:painting 1.5 -59 -4.97 {block_pos:[I;1,-59,-5],facing:0b,variant:"minecraft:kebab"}',
'summon minecraft:painting 4 -59 -4.97 {block_pos:[I;4,-59,-5],facing:0b,variant:"minecraft:courbet"}',
# Primed TNT that won't go off, a falling block, projectiles that land, a fireball, a firework, a crystal.
'summon minecraft:tnt 6.5 -60 6.5 {fuse:2000s}',
'summon minecraft:falling_block 2.5 -50 -0.5 {BlockState:{Name:"minecraft:sand"}}',
'summon minecraft:arrow 0.5 -55 -1.5 {Motion:[0.3d,0d,0d]}',
'summon minecraft:snowball -0.5 -55 1.5',
'summon minecraft:trident -2.5 -55 -0.5',
'summon minecraft:fireball 3.5 -57 -3.5',
'summon minecraft:firework_rocket 5.5 -60 -0.5',
'summon minecraft:end_crystal -6.5 -60 6.5 {ShowBottom:0b}',
]
@@ -161,7 +172,8 @@ def main():
schema=1, minecraft=lock['minecraft']['version'], platform=platform.platform(),
java=subprocess.check_output(['java', '--version'], text=True).splitlines()[0],
entities=len(vanilla), output_sha256=lab.digest(build / 'horizon.txt', 'sha256'),
scope='Minecarts (one rolling), boats (one falling), armor stands, a chicken jockey, item frames and paintings tracked to a '
scope='Minecarts (one rolling), boats (one falling), armor stands, a chicken jockey, item frames, paintings, primed '
'TNT, a falling block, projectiles, a fireball, a firework and an end crystal tracked to a '
'vanilla-codec client by a dedicated server: spawn packets, entity data, equipment, passengers and the '
'positions the syncs leave them at.'))
print(f'server entities: {len(vanilla)} entities identical')