[PR #5408] [MERGED] Native mods: entities for server mods (summon, move, display transforms) #6266

Closed
opened 2026-11-03 06:16:45 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5408
Author: @Vaspyyy
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @levzzz5154

Base: main ← Head: feat/native-entities


📝 Commits (2)

  • 3d09e62 Native mods: entities for server mods (summon, move, display transforms)
  • 4e72c2b Merge remote-tracking branch 'upstream/main' into feat/native-entities

📊 Changes

4 files changed (+318 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+1 -0)
➕ crates/horizon-client/src/game/native_entities.rs (+290 -0)
📝 docs/native-mods.md (+19 -0)
➕ tools/native-hook-fragments/native_entities.json (+8 -0)

📄 Description

Requested by Ransom · project thread

🤖 Opened by Vaspyyy's AI agent (Claude Code, Claude Opus 5.5), not by Vaspyyy personally.

What and why

Helpers for server mods to put models in the world that move:

  • native_summon(dimension, kind, pos, nbt) spawns any entity from its compound, as /summon <kind> <pos> <nbt> does, through spawn_entity_from_nbt (passengers included, native_entity_join_level can still keep it out), and returns its id.
  • native_move_entity(dimension, id, pos, yaw, pitch) moves an entity Horizon keeps without simulating (displays, markers, interactions).
  • native_set_display(dimension, id, &NativeDisplay) sets a display's transformation (translation, left rotation, scale, right rotation), interpolation duration and teleport duration.
  • native_remove_entity(dimension, id) removes such an entity as /kill does.

An item_display showing an item whose model comes from a content mod's assets is then a model a mod can turn and move every tick, eased on each client. Mods need this for things like a turning gun barrel or a projectile in flight; mobs keep their own helpers (native_teleport_mob, native_remove_mob).

One detail worth a look: entity data reaches clients only when it changes, and a display restarts its interpolation only when start_interpolation arrives. Each native_set_display call flips start_interpolation between 0 and -1 so the start is sent every time (vanilla gets the same by forcing the value in Display.setTransformationInterpolationDelay). A -1 start begins the ease one tick earlier, which doesn't show.

Kind

  • feature: something new for players (listed under New in the release notes)

Vanilla reference

SummonCommand.createEntity (EntityType.loadEntityRecursive), Display.readAdditionalSaveData (transformation, interpolation_duration, teleport_duration, start_interpolation), KillCommand for removal.

Other projects' code

none

Self-check

Run from the fork against upstream/main (d30588e), Rust 1.97:

cargo fmt -p horizon-client: clean
cargo test -p horizon-client --bin horizon-client native_entities: pass
cargo clippy -p horizon-client --bins --tests -- -D warnings -A clippy::manual_range_contains: pass
  (the allow is for horizon-world/src/worldgen/aquifer/noise_based.rs:476, a lint new in Rust 1.97 that fails on main too)

All six artillery hook branches (explode, camera shake, falling blocks, entities, shader values, local sounds) were also merged together with tools/stamp_native_hooks.py run locally (not committed) and their tests run there.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XnU6QSxLfzUbudHhcvZtgy


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/5408 **Author:** [@Vaspyyy](https://github.com/Vaspyyy) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `feat/native-entities` --- ### 📝 Commits (2) - [`3d09e62`](https://github.com/horizon-rust/horizon/commit/3d09e62b52ad3d8f93b176d615e53bbf64df6691) Native mods: entities for server mods (summon, move, display transforms) - [`4e72c2b`](https://github.com/horizon-rust/horizon/commit/4e72c2b5b5caa67ee1570e86f63a61b02b11c8cc) Merge remote-tracking branch 'upstream/main' into feat/native-entities ### 📊 Changes **4 files changed** (+318 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+1 -0) ➕ `crates/horizon-client/src/game/native_entities.rs` (+290 -0) 📝 `docs/native-mods.md` (+19 -0) ➕ `tools/native-hook-fragments/native_entities.json` (+8 -0) </details> ### 📄 Description <!-- claude-projects-attribution: {"github_login":"Vaspyyy"} --> _Requested by **Ransom** · [project thread](https://claude.ai/code/project/chan_014LE6qsPXZ5YJ26HjaADSTZ?thread=cmsg_014LE6qsPXZ5YJ26HjaADSTZ1T4cmgL2QQ21WRYQVKMdRd)_ > 🤖 Opened by Vaspyyy's AI agent (Claude Code, Claude Opus 5.5), not by Vaspyyy personally. ## What and why Helpers for server mods to put models in the world that move: - `native_summon(dimension, kind, pos, nbt)` spawns any entity from its compound, as `/summon <kind> <pos> <nbt>` does, through `spawn_entity_from_nbt` (passengers included, `native_entity_join_level` can still keep it out), and returns its id. - `native_move_entity(dimension, id, pos, yaw, pitch)` moves an entity Horizon keeps without simulating (displays, markers, interactions). - `native_set_display(dimension, id, &NativeDisplay)` sets a display's transformation (translation, left rotation, scale, right rotation), interpolation duration and teleport duration. - `native_remove_entity(dimension, id)` removes such an entity as `/kill` does. An `item_display` showing an item whose model comes from a content mod's assets is then a model a mod can turn and move every tick, eased on each client. Mods need this for things like a turning gun barrel or a projectile in flight; mobs keep their own helpers (`native_teleport_mob`, `native_remove_mob`). One detail worth a look: entity data reaches clients only when it changes, and a display restarts its interpolation only when `start_interpolation` arrives. Each `native_set_display` call flips `start_interpolation` between 0 and -1 so the start is sent every time (vanilla gets the same by forcing the value in `Display.setTransformationInterpolationDelay`). A -1 start begins the ease one tick earlier, which doesn't show. ## Kind - [x] feature: something new for players (listed under New in the release notes) ## Vanilla reference `SummonCommand.createEntity` (`EntityType.loadEntityRecursive`), `Display.readAdditionalSaveData` (transformation, `interpolation_duration`, `teleport_duration`, `start_interpolation`), `KillCommand` for removal. ## Other projects' code none ## Self-check Run from the fork against `upstream/main` (d30588e), Rust 1.97: ``` cargo fmt -p horizon-client: clean cargo test -p horizon-client --bin horizon-client native_entities: pass cargo clippy -p horizon-client --bins --tests -- -D warnings -A clippy::manual_range_contains: pass (the allow is for horizon-world/src/worldgen/aquifer/noise_based.rs:476, a lint new in Rust 1.97 that fails on main too) ``` All six artillery hook branches (explode, camera shake, falling blocks, entities, shader values, local sounds) were also merged together with `tools/stamp_native_hooks.py` run locally (not committed) and their tests run there. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01XnU6QSxLfzUbudHhcvZtgy --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:16:45 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#6266
No description provided.