diff --git a/AGENTS.md b/AGENTS.md
index 0656e40fc..a72c6723a 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -45,6 +45,7 @@ Game workspace (root `Cargo.toml`); `launcher/` and `crates/horizon-telemetry-se
| `horizon-friends`, `horizon-relay` | Play with Friends: invite codes, encrypted tunnel, the relay ([docs/play-with-friends.md](docs/play-with-friends.md)) |
| `horizon-mods`, `horizon-mod-sdk`, `cargo-horizon-mod` | Sandboxed WebAssembly mods: runtime, SDK + WIT, `cargo horizon-mod` ([docs/mods.md](docs/mods.md)) |
| `horizon-port-pack` | Porting Java modpacks ([docs/modpacks.md](docs/modpacks.md)) |
+| `horizon-shader-api` | Horizon's own WGSL shader packs ([docs/api/shaders.md](docs/api/shaders.md)): `horizon-shaders.toml`, the `.hshader` package; shared by the game, the launcher and the registry |
| `horizon-shaders` | Shader packs (the `shaders/` folder format), rebuilt clean-room from a written spec of the format; no wgpu |
| `horizon-theme` | Design tokens and fonts for the launcher, the game's own menus and the website |
| `horizon-telemetry`, `horizon-telemetry-server`, `horizon-bench` | Opt-in data collection, its ingest server, the benchmark report format |
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index e6e959186..21951c083 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -7,6 +7,11 @@ welcome on [Discord](https://discord.gg/HcTeMZxe5E).
This repository holds the game, the launcher and the website, plus the tools, tests and docs that build, check and
release them. Anything else (videos, Discord and other community material) lives elsewhere.
+**Where to start: [playhorizon.dev/hub](https://playhorizon.dev/hub).** It shows what is being done now and next
+([ROADMAP.md](ROADMAP.md) in the repository), the work board, good first tasks, and the forms to report a bug or
+suggest something. A pull request for a roadmap item carries its `roadmap:` label; ideas go to the suggestion
+queue (the hub, or `/suggest` on Discord) rather than to issues, which are for bugs.
+
## Build it
You need Rust (stable), Python 3.10+, JDK 25, and on Linux the ALSA and udev headers (`libasound2-dev libudev-dev`).
diff --git a/Cargo.lock b/Cargo.lock
index 2d09d2d0e..70c3c831c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1437,6 +1437,19 @@ dependencies = [
"ureq",
]
+[[package]]
+name = "horizon-shader-api"
+version = "0.1.0"
+dependencies = [
+ "bytemuck",
+ "naga",
+ "serde",
+ "serde_json",
+ "sha2",
+ "toml",
+ "zip",
+]
+
[[package]]
name = "horizon-shaders"
version = "0.1.0"
diff --git a/Cargo.toml b/Cargo.toml
index c6f2bc581..294e93aa9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[workspace]
exclude = ["launcher", "crates/horizon-telemetry-server", "crates/horizon-mod-registry", "third_party/wgpu-hal"]
-members = ["crates/horizon-core", "crates/horizon-dualsense", "crates/horizon-threads", "crates/horizon-world", "crates/horizon-client", "crates/horizon-server-files", "crates/horizon-server", "crates/horizon-bots", "crates/horizon-assets", "crates/horizon-protocol", "crates/horizon-theme", "crates/horizon-prepare", "crates/horizon-telemetry", "crates/horizon-bench", "crates/horizon-friends", "crates/horizon-relay", "crates/horizon-mod-sdk", "crates/horizon-mods", "crates/horizon-mods/tests/guest", "crates/cargo-horizon-mod", "crates/horizon-port-pack", "crates/horizon-shaders", "crates/horizon-release-sign", "crates/horizon-mod-sdk/examples/coords-hud", "xtask"]
+members = ["crates/horizon-core", "crates/horizon-dualsense", "crates/horizon-threads", "crates/horizon-world", "crates/horizon-client", "crates/horizon-server-files", "crates/horizon-server", "crates/horizon-bots", "crates/horizon-assets", "crates/horizon-protocol", "crates/horizon-theme", "crates/horizon-prepare", "crates/horizon-telemetry", "crates/horizon-bench", "crates/horizon-friends", "crates/horizon-relay", "crates/horizon-mod-sdk", "crates/horizon-mods", "crates/horizon-mods/tests/guest", "crates/cargo-horizon-mod", "crates/horizon-port-pack", "crates/horizon-shaders", "crates/horizon-shader-api", "crates/horizon-release-sign", "crates/horizon-mod-sdk/examples/coords-hud", "xtask"]
resolver = "2"
[workspace.package]
diff --git a/README.md b/README.md
index 6dd192d5d..ceee29249 100644
--- a/README.md
+++ b/README.md
@@ -16,6 +16,7 @@
Download ·
Documentation ·
Release notes ·
+ Roadmap ·
Project status ·
Contributing
@@ -109,6 +110,10 @@ Everything prepared lands in the gitignored `.local/`. It is derived from the ga
The client starts on the title screen. Command-line options (`--world`, `--seed`, `--creative`, `--render-distance`, `--dedicated`), controls, scripting through `horizon-ctl` and the architecture are described in [the native client guide](docs/native-client.md). The rest of the developer documentation is indexed in [docs/README.md](docs/README.md), including [the parity workflow](docs/parity-workflow.md).
+## Roadmap
+
+What is being done now, what comes next and where you can help, in plain words and in technical detail: [ROADMAP.md](ROADMAP.md). [playhorizon.dev/hub](https://playhorizon.dev/hub) shows it with the work board, the journal of what shipped and how to help.
+
## Contributing
Issues and pull requests are welcome: see [CONTRIBUTING.md](CONTRIBUTING.md) for how we work (vanilla first, small pull requests, labels), or [the contributing guide](https://playhorizon.dev/docs/contributing) on the site. Questions and ideas: [Discord](https://discord.gg/HcTeMZxe5E). Before opening a pull request, run the self-check and paste the block it prints:
diff --git a/ROADMAP.md b/ROADMAP.md
new file mode 100644
index 000000000..b433fad3a
--- /dev/null
+++ b/ROADMAP.md
@@ -0,0 +1,341 @@
+# Horizon roadmap
+
+
+
+What is being done on Horizon, what comes next and where you can help. There are no dates: things are Now, Next or Later. Each item is said in plain words, with the technical picture folded under it. The same roadmap, with a Simple / Technical switch, the board, the journal and how to help, is on [playhorizon.dev/hub](https://playhorizon.dev/hub). Pull requests carry the `roadmap:` label of their item.
+
+## At a glance
+
+Horizon is Minecraft: Java Edition 26.3 rewritten from scratch in Rust, so it runs faster on the same computer. Single player, LAN, servers, resource packs and Horizon's own mods work today, on your own copy of the game.
+
+**Being done now**
+
+- **Steady frames at long render distances**: Making Horizon faster than vanilla on every computer, with smooth camera movement even at 32 chunks, by spreading the work better over the processor's cores.
+- **Modpacks' world generation, natively**: Making the world-generation mods of popular modpacks (new structures, YUNG's dungeons and mineshafts, packs built on Lithostitched) generate their worlds in Horizon, natively and fast.
+- **Playing on servers: everything shows as it should**: When you play on a server, other players, mobs, items and menus look and behave as in vanilla: skins, poses, item names, inventories and server networks.
+- **Single player as a server: the last differences**: Single player now runs a small server in the background, as vanilla does. We are fixing what still behaves differently there; every fix also works for LAN and server players.
+- **Horizon's mod registry**: One place for mods, modpacks and resource packs made for Horizon: browse them on the website and install them from the launcher in one click.
+
+**Next**: Microsoft sign-in (coming soon); CurseForge in the mod browser (coming soon); Fresh benchmarks against vanilla; Pistons push players and mobs; Horizon on Intel Macs.
+
+**How to help**: Play it and tell us what differs from vanilla (Discord or GitHub), run the benchmark on your computer, vote for what you want next, or pick one of the Help wanted items.
+
+**Developers**: Read CONTRIBUTING.md, pick a Help wanted item or a To do card, check vanilla's code for the behaviour, and paste the block `python3 tools/pr_ready.py` prints in your pull request.
+
+## Now
+
+### Performance
+
+#### Steady frames at long render distances
+
+Making Horizon faster than vanilla on every computer, with smooth camera movement even at 32 chunks, by spreading the work better over the processor's cores.
+
+Technical
+
+Frame pacing at render distance 32 ([#678](https://github.com/ludovic111/horizon/issues/678)): long frames come from work competing with the render thread. In review: world generation workers build free structure starts instead of queueing them ([#1760](https://github.com/ludovic111/horizon/issues/1760)), the worker pool leaves one core as vanilla does ([#1778](https://github.com/ludovic111/horizon/issues/1778)), and the terrain vertex arena is read as storage where flat draws run ([#1742](https://github.com/ludovic111/horizon/issues/1742)). Still open: far terrain at 48 to 64 chunks ([#718](https://github.com/ludovic111/horizon/issues/718)) and CPU-bound fields of block entities ([#717](https://github.com/ludovic111/horizon/issues/717)). Every change shows before and after numbers from `tools/perf_bench.py` against vanilla 26.3 ([docs/benchmark.md](docs/benchmark.md)).
+
+
+
+#### Faster block lookups
+
+Speeding up the code that reads and writes the blocks of the world, which almost everything in the game goes through: generation, lighting, meshing and ticking.
+
+Technical
+
+`PalettedContainer` and `PackedStorage` find an entry's word by multiply and shift instead of an integer division ([#1790](https://github.com/ludovic111/horizon/issues/1790), [#1794](https://github.com/ludovic111/horizon/issues/1794)); meshing looks up baked models by index, not by name ([#1747](https://github.com/ludovic111/horizon/issues/1747)). Each change keeps the paletted storage harnesses identical and shows its microbenchmark ([docs/performance/paletted-container-access-results.md](docs/performance/paletted-container-access-results.md)).
+
+
+
+### Modpacks
+
+#### Modpacks' world generation, natively
+
+Making the world-generation mods of popular modpacks (new structures, YUNG's dungeons and mineshafts, packs built on Lithostitched) generate their worlds in Horizon, natively and fast.
+
+Technical
+
+`horizon-port-pack` carries a pack's data-driven content over; structure mods that need code get a native port: YUNG's worldgen as written ([#1746](https://github.com/ludovic111/horizon/issues/1746)), Lithostitched's limited and guaranteed elements with pool and processor modifiers ([#1777](https://github.com/ludovic111/horizon/issues/1777)), its processors as the game's own types ([#1765](https://github.com/ludovic111/horizon/issues/1765)). Proved by the structure blocks and layout harnesses ([#1753](https://github.com/ludovic111/horizon/issues/1753), [#1757](https://github.com/ludovic111/horizon/issues/1757)). Mods whose Java code does more than world generation don't run ([docs/modpacks.md](docs/modpacks.md)).
+
+
+
+### Servers and multiplayer
+
+#### Playing on servers: everything shows as it should
+
+When you play on a server, other players, mobs, items and menus look and behave as in vanilla: skins, poses, item names, inventories and server networks.
+
+Technical
+
+Client-of-a-server fixes in `game/remote*.rs` and `horizon-protocol`: mobs' aggressive and item-use flags ([#1802](https://github.com/ludovic111/horizon/issues/1802), [#1798](https://github.com/ludovic111/horizon/issues/1798)), ghost items after a remote menu ([#1795](https://github.com/ludovic111/horizon/issues/1795)), skins ([#1652](https://github.com/ludovic111/horizon/issues/1652)), cookies and transfer packets for proxy networks ([#1650](https://github.com/ludovic111/horizon/issues/1650)), firework boosts ([#1671](https://github.com/ludovic111/horizon/issues/1671)), living-entity attributes and simulation distance ([#1731](https://github.com/ludovic111/horizon/issues/1731)), styled item names ([#1702](https://github.com/ludovic111/horizon/issues/1702)), primed TNT between updates ([#1710](https://github.com/ludovic111/horizon/issues/1710)).
+
+
+
+#### Server dialogs and login screens
+
+Servers that show dialogs, such as the register and login screens of AuthMe, will work in Horizon.
+
+Technical
+
+26.3's dialog packets and model ([#1720](https://github.com/ludovic111/horizon/issues/1720)), the dialog screen with its buttons and actions ([#1734](https://github.com/ludovic111/horizon/issues/1734)), then text and boolean inputs ([#1735](https://github.com/ludovic111/horizon/issues/1735)).
+
+
+
+### Mods and API
+
+#### Horizon's mod registry
+
+One place for mods, modpacks and resource packs made for Horizon: browse them on the website and install them from the launcher in one click.
+
+Technical
+
+Merged: the registry index (schema 1, `.hpack`, checks before install, [#1634](https://github.com/ludovic111/horizon/issues/1634)), `cargo horizon-mod check` ([#1642](https://github.com/ludovic111/horizon/issues/1642)) and the submission service (`crates/horizon-mod-registry`, [#1659](https://github.com/ludovic111/horizon/issues/1659)). In review: the website's /mods ([#1596](https://github.com/ludovic111/horizon/issues/1596)) and /mods/submit ([#1635](https://github.com/ludovic111/horizon/issues/1635)), and in the launcher the registry as a source ([#1636](https://github.com/ludovic111/horizon/issues/1636)), install, enable and takedowns ([#1637](https://github.com/ludovic111/horizon/issues/1637)), the Mods page ([#1638](https://github.com/ludovic111/horizon/issues/1638)) and modpacks as their own profiles ([#1640](https://github.com/ludovic111/horizon/issues/1640)).
+
+More: [docs/mods.md](docs/mods.md)
+
+
+
+### Gameplay parity
+
+#### Single player as a server: the last differences
+
+Single player now runs a small server in the background, as vanilla does. We are fixing what still behaves differently there; every fix also works for LAN and server players.
+
+Technical
+
+Since [#1514](https://github.com/ludovic111/horizon/issues/1514) single player runs on the server thread (`game/integrated.rs`) and the window joins it as a client; `--in-frame` keeps the old path. The open `[server-thread]` issues list the gaps. In review: a tool that changes a block ends the click ([#1797](https://github.com/ludovic111/horizon/issues/1797)), potions keep their potion over the connection ([#1796](https://github.com/ludovic111/horizon/issues/1796)), mobs' aggression and arm swings ([#1802](https://github.com/ludovic111/horizon/issues/1802)). [docs/server-levels.md](docs/server-levels.md).
+
+
+
+#### Play in your language
+
+Item names, container titles and server messages follow the language you pick, as in vanilla. Today parts of the game stay in English.
+
+Technical
+
+Translatable components resolved through the selected language for items, containers and server text ([#1806](https://github.com/ludovic111/horizon/issues/1806)), on top of the bundled languages the prepared resources carry ([#1594](https://github.com/ludovic111/horizon/issues/1594)). Left: the client's own screens ([#1672](https://github.com/ludovic111/horizon/issues/1672)) and the main menu with zh_cn ([#1774](https://github.com/ludovic111/horizon/issues/1774)).
+
+
+
+### Rendering
+
+#### Shader packs, written again from scratch
+
+Shader packs were removed and are being rebuilt from scratch. They come back, off by default, once the best-known packs draw properly.
+
+Technical
+
+A clean-room rewrite in `horizon-shaderpack`, from the packs' public format documentation only: reading packs, the preprocessor and `.properties` files are merged ([#1584](https://github.com/ludovic111/horizon/issues/1584), [#1585](https://github.com/ludovic111/horizon/issues/1585), [#1586](https://github.com/ludovic111/horizon/issues/1586)); translating programs to WGSL through naga, buffers, uniforms and the terrain, entity, sky, weather and hand stages are in review ([#1698](https://github.com/ludovic111/horizon/issues/1698) to [#1801](https://github.com/ludovic111/horizon/issues/1801)).
+
+More: [#1561](https://github.com/ludovic111/horizon/issues/1561) · [#1771](https://github.com/ludovic111/horizon/issues/1771) · [#1786](https://github.com/ludovic111/horizon/issues/1786)
+
+
+
+### Horizon extras
+
+#### Discord Rich Presence
+
+Your Discord profile can show that you are playing Horizon, with a switch to turn it off.
+
+Technical
+
+A Discord IPC client on its own thread ([#1787](https://github.com/ludovic111/horizon/issues/1787)) and the presence with its setting ([#1788](https://github.com/ludovic111/horizon/issues/1788)). Merged: it ships with the next release.
+
+
+
+### Code and tools
+
+#### A leaner codebase that builds faster
+
+Cleaning up Horizon's code: removing what nothing uses and making it quicker to build, so fixes and new features land faster.
+
+Technical
+
+A review of the whole tree: dead code and stubs removed ([#1432](https://github.com/ludovic111/horizon/issues/1432), [#1658](https://github.com/ludovic111/horizon/issues/1658)), one probe binary per crate ([#1453](https://github.com/ludovic111/horizon/issues/1453), [#1454](https://github.com/ludovic111/horizon/issues/1454)), shared harness helpers ([#1448](https://github.com/ludovic111/horizon/issues/1448)), clippy clean on the whole tree ([#1707](https://github.com/ludovic111/horizon/issues/1707)). [docs/architecture.md](docs/architecture.md) maps each feature to its files and harnesses.
+
+
+
+## Next
+
+### Performance
+
+#### Fresh benchmarks against vanilla
+
+New public numbers comparing Horizon with vanilla on many kinds of computers, measured the same way every time, on the website's Benchmarks page.
+
+Technical
+
+Redo the comparison after the current performance work ([#1073](https://github.com/ludovic111/horizon/issues/1073)); reliability, coverage and presentation ([#1346](https://github.com/ludovic111/horizon/issues/1346)); a scene must count as loaded only once its first chunk arrives ([#1749](https://github.com/ludovic111/horizon/issues/1749)). Players' reports come in through `--benchmark` and `horizon-launcher data benchmark` ([docs/benchmark.md](docs/benchmark.md)).
+
+
+
+### Modpacks
+
+#### CurseForge in the mod browser (coming soon)
+
+Coming soon: search and download CurseForge mods and modpacks from the launcher, as you can with Modrinth today.
+
+Technical
+
+The mod browser lists CurseForge as coming soon ([docs/mod-browser.md](docs/mod-browser.md)): it needs CurseForge API access. Meanwhile packs import from a CurseForge zip or instance folder, and jars only CurseForge hosts come from the player's own instance ([docs/modpacks.md](docs/modpacks.md)).
+
+
+
+### Gameplay parity
+
+#### Pistons push players and mobs
+
+Pistons and slime blocks will push players, mobs and items as in vanilla. Today moving blocks pass through them.
+
+Technical
+
+Port `PistonMovingBlockEntity.moveCollidedEntities` and `moveStuckEntities` (honey), the slime bounce and `Entity.limitPistonMovement` for `MoverType.PISTON`, in single player and for a server's players. Issues [#1496](https://github.com/ludovic111/horizon/issues/1496), [#1609](https://github.com/ludovic111/horizon/issues/1609), [#1608](https://github.com/ludovic111/horizon/issues/1608), [#1704](https://github.com/ludovic111/horizon/issues/1704), [#1758](https://github.com/ludovic111/horizon/issues/1758).
+
+
+
+### Launcher
+
+#### Microsoft sign-in (coming soon)
+
+Coming soon: sign in with your Microsoft account to play on online-mode servers. The code is ready; it waits for Microsoft's approval.
+
+Technical
+
+Device-code sign-in in the launcher and online-mode login in the client ([docs/microsoft-account.md](docs/microsoft-account.md)). It is turned on by setting the app's client id once Minecraft API access is approved; until then the launcher shows "Coming soon".
+
+More: [#1270](https://github.com/ludovic111/horizon/issues/1270)
+
+
+
+#### Horizon on Intel Macs
+
+Builds of the game and the launcher for Macs with an Intel processor.
+
+Technical
+
+x86_64 game and launcher builds, picked per processor ([#1171](https://github.com/ludovic111/horizon/issues/1171)). Before it ships it needs a run on a real Intel Mac: Rosetta on Apple Silicon only proves the CPU code. Requests: [#1161](https://github.com/ludovic111/horizon/issues/1161), [#1792](https://github.com/ludovic111/horizon/issues/1792).
+
+
+
+## Later
+
+### Gameplay parity
+
+#### Following new Minecraft versions
+
+When Mojang releases a new version of the game, Horizon follows it, and every system is checked against the new version again.
+
+Technical
+
+The port pipeline detects a release, diffs its classes against 26.3 and writes a port report ([docs/version-ports.md](docs/version-ports.md)); the harnesses then run against the new version.
+
+
+
+### Horizon extras
+
+#### An optional AI teammate
+
+An AI teammate that plays beside you and that you can talk to. It is off unless you turn it on, and the No AI switch hides it completely.
+
+Technical
+
+Draft pull requests: the companion ([#1068](https://github.com/ludovic111/horizon/issues/1068)), its safety modes and their evaluation ([#1069](https://github.com/ludovic111/horizon/issues/1069)), and a route that finishes the game ([#1070](https://github.com/ludovic111/horizon/issues/1070)). Local models first; it ships only once the safety evaluation passes.
+
+
+
+## Help wanted
+
+### Performance
+
+#### Benchmark your computer
+
+Run Horizon's built-in benchmark and share the report: every new computer makes the performance work more accurate. No coding needed.
+
+Technical
+
+`horizon-launcher play --arg=--benchmark --arg=standard` writes a JSON report; `horizon-launcher data benchmark ` shows what would be sent and uploads it ([website/docs/performance.md](website/docs/performance.md)). Results from three installs with the same hardware appear on the Benchmarks page. Example: [#1711](https://github.com/ludovic111/horizon/issues/1711).
+
+
+
+### Gameplay parity
+
+#### End city banners keep their pattern
+
+Banners in End cities show as plain magenta instead of with their pattern.
+
+Technical
+
+Compare the banner block entities the End city templates place with vanilla's (`EndCityPieces`, the templates' block entity NBT, `BannerBlockEntity`'s patterns), in `crates/horizon-world/src/worldgen/structure/`. Issue [#1438](https://github.com/ludovic111/horizon/issues/1438); possibly related: [#526](https://github.com/ludovic111/horizon/issues/526).
+
+
+
+#### Enchanted loot in End cities
+
+Armour and tools in End city chests should come enchanted, as in vanilla.
+
+Technical
+
+`loot.rs` implements `enchant_with_levels`: find why the End city chest table's rolls come out bare, and compare them with vanilla's for a few seeds. Issues [#1437](https://github.com/ludovic111/horizon/issues/1437), [#1660](https://github.com/ludovic111/horizon/issues/1660).
+
+
+
+#### Cooldowns drawn on items
+
+After you throw an ender pearl, its slot should show the cooldown sweeping away, as in vanilla.
+
+Technical
+
+Vanilla draws `ItemCooldowns`' percent as a white overlay over the slot (`GuiGraphicsExtractor.itemDecorations` and `itemCooldown`) in the hotbar and in inventories. Issue [#1763](https://github.com/ludovic111/horizon/issues/1763).
+
+
+
+#### Chat settings and team prefixes
+
+The Hidden and Commands Only chat settings should hide chat, and team prefixes should appear before names in chat.
+
+Technical
+
+Vanilla checks `ChatVisiblity` before it delivers chat and system messages ([#1376](https://github.com/ludovic111/horizon/issues/1376)), and chat uses the team-formatted display name ([#1378](https://github.com/ludovic111/horizon/issues/1378)). Both issues have exact steps to reproduce.
+
+
+
+#### A pointing hand over buttons
+
+The mouse pointer should turn into a pointing hand over menu buttons, as in vanilla 26.3.
+
+Technical
+
+26.3's `AbstractWidget` asks for a cursor from `CursorTypes` when it is hovered; winit's `CursorIcon::Pointer` gives the same shape. Issue [#1347](https://github.com/ludovic111/horizon/issues/1347).
+
+
+
+#### Ctrl+Backspace and scroll bars in menus
+
+Ctrl+Backspace should delete a whole word in the creative search, and every list's scroll bar should be draggable.
+
+Technical
+
+`EditBox` deletes by word with Ctrl ([#1764](https://github.com/ludovic111/horizon/issues/1764)); the Game Rules and Statistics lists' scroll bars can't be dragged ([#1782](https://github.com/ludovic111/horizon/issues/1782), after [#978](https://github.com/ludovic111/horizon/issues/978)).
+
+
+
+#### Chickens flap while they fall
+
+Chickens should flap their wings while they fall, not stand still in the air.
+
+Technical
+
+Vanilla's `Chicken.aiStep` updates `flap` and `flapSpeed` when the chicken isn't on the ground, and the model's wings follow them. Issue [#1706](https://github.com/ludovic111/horizon/issues/1706).
+
+
+
+## Recently shipped
+
+- **Server resource packs** (v0.2.48): Servers can send you their resource pack: Horizon asks, downloads it and applies it, like vanilla. [#1562](https://github.com/ludovic111/horizon/issues/1562) · [#1569](https://github.com/ludovic111/horizon/issues/1569) · [#1570](https://github.com/ludovic111/horizon/issues/1570)
+- **Single player on its own server thread** (v0.2.39): Single player runs on a server thread, as vanilla does, so the world keeps ticking smoothly while the window draws. [#1514](https://github.com/ludovic111/horizon/issues/1514) · [docs/server-levels.md](docs/server-levels.md)
+- **GPU occlusion culling on Macs** (v0.2.17): On Macs the GPU now skips terrain hidden behind hills and caves: 8 to 48% more frames per second at 32 chunks on an M4 Pro. [#1434](https://github.com/ludovic111/horizon/issues/1434)
+- **Animated textures on the GPU** (v0.2.5): Water, lava and other animated blocks are now animated by the graphics card: 1.7 to 2.4 times better 1% lows on Intel graphics. [#1239](https://github.com/ludovic111/horizon/issues/1239)
+- **Far Detail for integrated graphics** (v0.2.5): An optional Reduced setting for far terrain, suggested on integrated graphics, that saves 2 to 4 ms of GPU time per frame. [#1199](https://github.com/ludovic111/horizon/issues/1199) · [#1029](https://github.com/ludovic111/horizon/issues/1029)
+- **The launcher's mod browser** (launcher@0.2.0): Search Modrinth for mods, modpacks and resource packs from the launcher; it says before installing what works in Horizon. [#1154](https://github.com/ludovic111/horizon/issues/1154) · [#1242](https://github.com/ludovic111/horizon/issues/1242) · [#1243](https://github.com/ludovic111/horizon/issues/1243) · [#1246](https://github.com/ludovic111/horizon/issues/1246) · [docs/mod-browser.md](docs/mod-browser.md)
+- **A blocky, Minecraft-like launcher** (launcher@0.2.0): The launcher got a new blocky look in Horizon's purple, in dark and light. [#1269](https://github.com/ludovic111/horizon/issues/1269) · [docs/design-system.md](docs/design-system.md)
+- **Dynamic lights** (v2026.10.22): An optional extra: torches you hold, drop or set on fire light up what is around them. [#1162](https://github.com/ludovic111/horizon/issues/1162)
+- **Host a server from the launcher** (launcher-v0.15.0): The launcher's Servers page creates, starts, backs up and updates a Horizon server with buttons, and invites friends. [#1026](https://github.com/ludovic111/horizon/issues/1026) · [docs/hosting.md](docs/hosting.md)
diff --git a/crates/cargo-horizon-mod/src/check.rs b/crates/cargo-horizon-mod/src/check.rs
index 0294bec98..8a25d1a24 100644
--- a/crates/cargo-horizon-mod/src/check.rs
+++ b/crates/cargo-horizon-mod/src/check.rs
@@ -21,6 +21,8 @@ pub struct Report {
pub sha256: String,
pub size: u64,
pub signed: bool,
+ /// A mod has code to run (a content mod may have none).
+ pub code: bool,
/// A mod's component imports.
pub imports: Vec,
/// A mod's commands, each run once.
@@ -49,6 +51,7 @@ impl Report {
"sha256": self.sha256,
"size": self.size,
"signed": self.signed,
+ "code": self.code,
"imports": self.imports,
"commands": self.commands,
"output": self.output,
@@ -87,7 +90,9 @@ impl Report {
for r in &f.requires {
out += &format!(" needs {} {} ({})\n", r.id, r.version, &r.sha256[..12]);
}
- if self.kind == Kind::Mod {
+ if self.kind == Kind::Mod && !self.code {
+ out += " no code: content only, nothing to run\n";
+ } else if self.kind == Kind::Mod {
let commands = if self.commands.is_empty() {
String::new()
} else {
@@ -142,6 +147,7 @@ pub fn check(
sha256: index::sha256_file(path)?,
size,
signed,
+ code: false,
imports: Vec::new(),
commands: Vec::new(),
output: Vec::new(),
@@ -153,10 +159,14 @@ pub fn check(
}
/// Runs a mod in the sandbox, as the game does, from a scratch copy so its
-/// storage lands in a folder removed afterwards.
+/// storage lands in a folder removed afterwards. A content mod has no code to
+/// run: `inspect` already read its content as the game does.
fn trial_run(path: &Path, report: &mut Report) -> Result<(), String> {
let package = Package::read(path)?;
- let wasm = package.wasm.as_deref().ok_or("the .hmod has no mod.wasm")?;
+ let Some(wasm) = package.wasm.as_deref() else {
+ return Ok(());
+ };
+ report.code = true;
report.imports = component_imports(wasm)?;
package
.manifest
diff --git a/crates/cargo-horizon-mod/src/main.rs b/crates/cargo-horizon-mod/src/main.rs
index 925633930..a4585f680 100644
--- a/crates/cargo-horizon-mod/src/main.rs
+++ b/crates/cargo-horizon-mod/src/main.rs
@@ -1,14 +1,16 @@
//! `cargo horizon-mod`: make Horizon mods in Rust (`docs/mods.md`).
//!
-//! - `new [--name "Name"] [--sdk-path ]`: a mod crate from the template.
-//! - `build [--debug]`: the `.hmod` in `target/horizon-mod/`.
+//! - `new [--template code|content] [--name "Name"] [--sdk-path ]`:
+//! a mod from a template: a Rust crate, or a content mod (no code).
+//! - `build [--debug]`: the `.hmod` in `target/horizon-mod/`, with the mod's
+//! `assets/` and `data/`; a folder without `Cargo.toml` is content only.
//! - `run [--game ] [-- ]`: build, then play with
//! the mod; run `build` again and the game reloads it.
//! - `check [--json]`: what the registry checks of a submission
//! (`.hmod`, `.hpack`, resource pack `.zip`), with a trial run for a mod.
//! - `registry build|review|check|list`: the registry repository's CI.
use horizon_mods::{
- Manifest, Package,
+ Capability, Content, Manifest, Package,
manifest::{MANIFEST, component_imports, componentize},
};
mod check;
@@ -36,7 +38,7 @@ fn main() -> ExitCode {
Some("run") => run(&args[1..]),
Some("check") => check(&args[1..]),
Some("registry") => registry::main(&args[1..]),
- _ => Err("usage: cargo horizon-mod new | build [--debug] | run [--game ] [-- ] | check [--kind ] [--key --signature ] [--json] | registry build|review|check|list".into()),
+ _ => Err("usage: cargo horizon-mod new [--template code|content] | build [--debug] | run [--game ] [-- ] | check [--kind ] [--key --signature ] [--json] | registry build|review|check|list".into()),
};
match result {
Ok(()) => ExitCode::SUCCESS,
@@ -90,19 +92,68 @@ fn new(args: &[String]) -> Result<(), String> {
.replace("{name}", &name)
.replace("{sdk}", &sdk)
};
- let files = [
+ let code = [
("Cargo.toml", include_str!("../template/Cargo.toml.in")),
(MANIFEST, include_str!("../template/horizon-mod.toml")),
("src/lib.rs", include_str!("../template/src/lib.rs")),
(".gitignore", include_str!("../template/gitignore")),
];
- for (file, text) in files {
+ // A block copying a vanilla one, with its model, name, loot, recipe and tag.
+ let content = [
+ (
+ MANIFEST,
+ include_str!("../template/content/horizon-mod.toml"),
+ ),
+ (
+ "data/{id}/horizon/block/glowing_amethyst.json",
+ include_str!("../template/content/block.json"),
+ ),
+ (
+ "assets/{id}/blockstates/glowing_amethyst.json",
+ include_str!("../template/content/blockstate.json"),
+ ),
+ (
+ "assets/{id}/models/block/glowing_amethyst.json",
+ include_str!("../template/content/model.json"),
+ ),
+ (
+ "assets/{id}/items/glowing_amethyst.json",
+ include_str!("../template/content/item.json"),
+ ),
+ (
+ "assets/{id}/lang/en_us.json",
+ include_str!("../template/content/lang.json"),
+ ),
+ (
+ "data/{id}/loot_table/blocks/glowing_amethyst.json",
+ include_str!("../template/content/loot.json"),
+ ),
+ (
+ "data/{id}/recipe/glowing_amethyst.json",
+ include_str!("../template/content/recipe.json"),
+ ),
+ (
+ "data/minecraft/tags/block/mineable/pickaxe.json",
+ include_str!("../template/content/pickaxe.json"),
+ ),
+ (".gitignore", include_str!("../template/gitignore")),
+ ];
+ let files: &[(&str, &str)] = match flag(args, "--template").unwrap_or("code") {
+ "code" => &code,
+ "content" => &content,
+ other => return Err(format!("no template {other}: code or content")),
+ };
+ for &(file, text) in files {
+ let file = fill(file);
+ let file = file.as_str();
let to = dir.join(file);
std::fs::create_dir_all(to.parent().expect("a file in the mod"))
.map_err(|e| e.to_string())?;
std::fs::write(&to, fill(text)).map_err(|e| format!("{}: {e}", to.display()))?;
}
- Manifest::parse(&std::fs::read_to_string(dir.join(MANIFEST)).map_err(|e| e.to_string())?)?;
+ let manifest =
+ Manifest::parse(&std::fs::read_to_string(dir.join(MANIFEST)).map_err(|e| e.to_string())?)?;
+ Content::read(dir, &manifest)?;
println!(
"Created {} (mod id {id}). Next: cd {path} && cargo horizon-mod run",
dir.display()
@@ -110,14 +161,53 @@ fn new(args: &[String]) -> Result<(), String> {
Ok(())
}
-/// Builds the crate in the current folder and packs `target/horizon-mod/.hmod`.
+/// Builds the mod in the current folder and packs `target/horizon-mod/.hmod`:
+/// the manifest, the crate's component (none without a `Cargo.toml`: a
+/// content mod) and the files in `assets/` and `data/`.
fn build(release: bool) -> Result {
- let manifest_text = std::fs::read_to_string(MANIFEST)
+ build_in(Path::new("."), release)
+}
+
+fn build_in(root: &Path, release: bool) -> Result {
+ let manifest_text = std::fs::read_to_string(root.join(MANIFEST))
.map_err(|e| format!("{MANIFEST}: {e} (run this in a mod's folder)"))?;
let manifest = Manifest::parse(&manifest_text)?;
+ let (wasm, target_dir) = if root.join("Cargo.toml").exists() {
+ let (wasm, target) = compile(root, release)?;
+ // The game refuses a component importing capabilities the manifest lacks.
+ manifest.check_imports(component_imports(&wasm)?.iter().map(String::as_str))?;
+ (Some(wasm), target)
+ } else if manifest.capabilities.contains(&Capability::Registries) {
+ (None, root.join("target"))
+ } else {
+ return Err(format!(
+ "no Cargo.toml: only a content mod (capability registries in {MANIFEST}) has no code"
+ ));
+ };
+ // The same checks as the game's, and the files in the order it lists them.
+ let content = Content::read(root, &manifest)?;
+ let mut reader = content.reader()?;
+ let mut files = Vec::with_capacity(content.files.len());
+ for name in &content.files {
+ files.push((name.as_str(), reader.read(name)?));
+ }
+ let files: Vec<(&str, &[u8])> = files.iter().map(|(n, b)| (*n, b.as_slice())).collect();
+ let dir = target_dir.join("horizon-mod");
+ std::fs::create_dir_all(&dir).map_err(|e| e.to_string())?;
+ let path = dir.join(format!("{}.hmod", manifest.id));
+ // Write then rename, so a running game never reads half a file.
+ let partial = path.with_extension("hmod.partial");
+ let bytes = Package::write_files(&manifest_text, wasm.as_deref(), &files)?;
+ std::fs::write(&partial, bytes).map_err(|e| e.to_string())?;
+ std::fs::rename(&partial, &path).map_err(|e| e.to_string())?;
+ Ok(path)
+}
+
+/// Builds the crate for WebAssembly: its component, and Cargo's target folder.
+fn compile(root: &Path, release: bool) -> Result<(Vec, PathBuf), String> {
let cargo = std::env::var("CARGO").unwrap_or_else(|_| "cargo".into());
let mut cmd = Command::new(cargo);
- cmd.args([
+ cmd.current_dir(root).args([
"build",
"--lib",
"--target",
@@ -145,17 +235,8 @@ fn build(release: bool) -> Result {
.rfind(|f| f.extension().is_some_and(|e| e == "wasm"))
.ok_or("the build made no .wasm: is the crate a cdylib?")?;
let wasm = componentize(&std::fs::read(&core).map_err(|e| e.to_string())?)?;
- // The game refuses a component importing capabilities the manifest lacks.
- manifest.check_imports(component_imports(&wasm)?.iter().map(String::as_str))?;
- let target_dir = core.ancestors().nth(3).ok_or("unexpected target folder")?;
- let dir = target_dir.join("horizon-mod");
- std::fs::create_dir_all(&dir).map_err(|e| e.to_string())?;
- let path = dir.join(format!("{}.hmod", manifest.id));
- // Write then rename, so a running game never reads half a file.
- let partial = path.with_extension("hmod.partial");
- std::fs::write(&partial, Package::write(&manifest_text, &wasm)?).map_err(|e| e.to_string())?;
- std::fs::rename(&partial, &path).map_err(|e| e.to_string())?;
- Ok(path)
+ let target = core.ancestors().nth(3).ok_or("unexpected target folder")?;
+ Ok((wasm, target.to_path_buf()))
}
/// `check `: the registry's checks of a submission, printed; fails
@@ -237,4 +318,49 @@ mod tests {
);
std::fs::remove_dir_all(&dir).unwrap();
}
+
+ #[test]
+ fn the_content_template_builds_and_checks_with_no_code() {
+ let dir = std::env::temp_dir().join(format!("horizon-mod-content-{}", std::process::id()));
+ let path = dir.join("gems");
+ let new_args = [
+ path.display().to_string(),
+ "--template".into(),
+ "content".into(),
+ ];
+ new(&new_args).unwrap();
+ assert!(!path.join("Cargo.toml").exists());
+ let hmod = build_in(&path, true).unwrap();
+ assert_eq!(hmod, path.join("target/horizon-mod/gems.hmod"));
+ let package = Package::read(&hmod).unwrap();
+ assert!(package.wasm.is_none());
+ let content = Content::read(&hmod, &package.manifest).unwrap();
+ assert!(
+ content
+ .files
+ .contains(&"data/gems/horizon/block/glowing_amethyst.json".into())
+ );
+ assert_eq!(content.files.len(), 8, "{:?}", content.files);
+ let report = check::check(&hmod, check::kind_of(&hmod).unwrap(), None, None).unwrap();
+ assert!(!report.code);
+ assert!(
+ report.text().contains("no code: content only"),
+ "{}",
+ report.text()
+ );
+ // Without registries, a mod needs code.
+ let manifest = std::fs::read_to_string(path.join(MANIFEST)).unwrap();
+ let manifest = manifest.replace("[\"registries\"]", "[]");
+ std::fs::write(path.join(MANIFEST), manifest).unwrap();
+ assert!(build_in(&path, true).unwrap_err().contains("no Cargo.toml"));
+ assert!(
+ new(&[
+ dir.join("x").display().to_string(),
+ "--template".into(),
+ "lua".into()
+ ])
+ .is_err()
+ );
+ std::fs::remove_dir_all(&dir).unwrap();
+ }
}
diff --git a/crates/cargo-horizon-mod/template/content/block.json b/crates/cargo-horizon-mod/template/content/block.json
new file mode 100644
index 000000000..ea68a1a27
--- /dev/null
+++ b/crates/cargo-horizon-mod/template/content/block.json
@@ -0,0 +1,4 @@
+{
+ "template": "minecraft:amethyst_block",
+ "properties": { "hardness": 2.0, "light": 7 }
+}
diff --git a/crates/cargo-horizon-mod/template/content/blockstate.json b/crates/cargo-horizon-mod/template/content/blockstate.json
new file mode 100644
index 000000000..ea472666e
--- /dev/null
+++ b/crates/cargo-horizon-mod/template/content/blockstate.json
@@ -0,0 +1,5 @@
+{
+ "variants": {
+ "": { "model": "{id}:block/glowing_amethyst" }
+ }
+}
diff --git a/crates/cargo-horizon-mod/template/content/horizon-mod.toml b/crates/cargo-horizon-mod/template/content/horizon-mod.toml
new file mode 100644
index 000000000..4f133a905
--- /dev/null
+++ b/crates/cargo-horizon-mod/template/content/horizon-mod.toml
@@ -0,0 +1,10 @@
+id = "{id}"
+name = "{name}"
+version = "0.1.0"
+description = ""
+authors = []
+# A content mod: blocks and items from data/ and assets/, no code (API 0.2).
+api = "0.2"
+side = "both"
+# registries: "May add blocks and items to your worlds".
+capabilities = ["registries"]
diff --git a/crates/cargo-horizon-mod/template/content/item.json b/crates/cargo-horizon-mod/template/content/item.json
new file mode 100644
index 000000000..411bc4499
--- /dev/null
+++ b/crates/cargo-horizon-mod/template/content/item.json
@@ -0,0 +1,3 @@
+{
+ "model": { "type": "minecraft:model", "model": "{id}:block/glowing_amethyst" }
+}
diff --git a/crates/cargo-horizon-mod/template/content/lang.json b/crates/cargo-horizon-mod/template/content/lang.json
new file mode 100644
index 000000000..74baddab8
--- /dev/null
+++ b/crates/cargo-horizon-mod/template/content/lang.json
@@ -0,0 +1,3 @@
+{
+ "block.{id}.glowing_amethyst": "Glowing Amethyst"
+}
diff --git a/crates/cargo-horizon-mod/template/content/loot.json b/crates/cargo-horizon-mod/template/content/loot.json
new file mode 100644
index 000000000..898111f1b
--- /dev/null
+++ b/crates/cargo-horizon-mod/template/content/loot.json
@@ -0,0 +1,11 @@
+{
+ "type": "minecraft:block",
+ "pools": [
+ {
+ "condition": { "type": "minecraft:survives_explosion" },
+ "entries": [{ "type": "minecraft:item", "name": "{id}:glowing_amethyst" }],
+ "rolls": 1
+ }
+ ],
+ "random_sequence": "{id}:blocks/glowing_amethyst"
+}
diff --git a/crates/cargo-horizon-mod/template/content/model.json b/crates/cargo-horizon-mod/template/content/model.json
new file mode 100644
index 000000000..5710fecb1
--- /dev/null
+++ b/crates/cargo-horizon-mod/template/content/model.json
@@ -0,0 +1,4 @@
+{
+ "parent": "minecraft:block/cube_all",
+ "textures": { "all": "minecraft:block/amethyst_block" }
+}
diff --git a/crates/cargo-horizon-mod/template/content/pickaxe.json b/crates/cargo-horizon-mod/template/content/pickaxe.json
new file mode 100644
index 000000000..8725edebd
--- /dev/null
+++ b/crates/cargo-horizon-mod/template/content/pickaxe.json
@@ -0,0 +1,3 @@
+{
+ "values": ["{id}:glowing_amethyst"]
+}
diff --git a/crates/cargo-horizon-mod/template/content/recipe.json b/crates/cargo-horizon-mod/template/content/recipe.json
new file mode 100644
index 000000000..5edb03d94
--- /dev/null
+++ b/crates/cargo-horizon-mod/template/content/recipe.json
@@ -0,0 +1,6 @@
+{
+ "type": "minecraft:crafting_shapeless",
+ "category": "building",
+ "ingredients": ["minecraft:amethyst_block", "minecraft:glowstone_dust"],
+ "result": { "id": "{id}:glowing_amethyst" }
+}
diff --git a/crates/horizon-client/src/game.rs b/crates/horizon-client/src/game.rs
index 699468651..7fcb3be89 100644
--- a/crates/horizon-client/src/game.rs
+++ b/crates/horizon-client/src/game.rs
@@ -12098,6 +12098,8 @@ enum PendingWorldEntry {
Server {
address: String,
name: String,
+ /// A transfer's carried-over server cookies (`TransferState`).
+ cookies: Option,
},
}
@@ -12172,8 +12174,12 @@ impl Game<'_> {
}) => {
self.open_world(&folder, name.as_deref(), seed, creative, create.as_deref())?;
}
- Some(PendingWorldEntry::Server { address, name }) => {
- self.connect_server(&address, &name)?;
+ Some(PendingWorldEntry::Server {
+ address,
+ name,
+ cookies,
+ }) => {
+ self.connect_server_with_cookies(&address, &name, cookies)?;
}
None => {}
}
diff --git a/crates/horizon-client/src/game/agent.rs b/crates/horizon-client/src/game/agent.rs
index f6b68aa74..57c12da97 100644
--- a/crates/horizon-client/src/game/agent.rs
+++ b/crates/horizon-client/src/game/agent.rs
@@ -469,7 +469,8 @@ impl Game<'_> {
"flying": p.flying,
"fall_flying": p.fall_flying,
"sneaking": self.keys.contains(&KeyCode::ShiftLeft),
- "sprinting": self.keys.contains(&KeyCode::ControlLeft),
+ "sprinting": p.sprinting,
+ "fov_modifier": self.view.fov_modifier,
"health": p.health.health(),
"absorption": p.health.absorption(),
// The hurt animation's ticks left (the camera's hurt tilt).
diff --git a/crates/horizon-client/src/game/remote.rs b/crates/horizon-client/src/game/remote.rs
index bc14b5263..620d145bf 100644
--- a/crates/horizon-client/src/game/remote.rs
+++ b/crates/horizon-client/src/game/remote.rs
@@ -193,6 +193,9 @@ pub(super) struct Remote {
/// the oldest of them first waited (`poll_remote`).
backlog: VecDeque,
backlog_since: Option,
+ /// `ClientboundTransferPacket`'s target: when the connection ends the
+ /// game connects here, the stored cookies carried over (`TransferState`).
+ transfer: Option,
}
/// The time a frame spends on chunk packets before it leaves the rest of
@@ -257,14 +260,25 @@ fn number_format(f: &play::NumberFormat) -> horizon_client::scoreboard::NumberFo
impl Game<'_> {
/// Leave the title for a server (ConnectScreen): an empty world fed by the connection.
pub(super) fn connect_server(&mut self, address: &str, name: &str) -> Result<()> {
+ self.connect_server_with_cookies(address, name, None)
+ }
+ /// `connect_server` carrying a transfer's stored server cookies
+ /// (`TransferState`); None on an ordinary join.
+ pub(super) fn connect_server_with_cookies(
+ &mut self,
+ address: &str,
+ name: &str,
+ cookies: Option,
+ ) -> Result<()> {
if self.defer_world_entry(super::PendingWorldEntry::Server {
address: address.to_owned(),
name: name.to_owned(),
+ cookies: cookies.clone(),
})? {
return Ok(());
}
self.join_world_rest()?;
- if let Err(error) = self.join_server(address, name, None) {
+ if let Err(error) = self.join_server(address, name, None, cookies) {
log::warn!("Horizon: could not join server: {error}");
if self.title.is_none() {
self.title = Some(horizon_client::title::Title::new(
@@ -285,13 +299,14 @@ impl Game<'_> {
pipe: horizon_protocol::connection::Pipe,
name: &str,
) -> Result<()> {
- self.join_server("local", name, Some(pipe))
+ self.join_server("local", name, Some(pipe), None)
}
fn join_server(
&mut self,
address: &str,
name: &str,
local: Option,
+ cookies: Option,
) -> Result<()> {
self.perf.world_opening();
let root = self.options.resources.clone();
@@ -323,7 +338,17 @@ impl Game<'_> {
Some(pipe) => Session::connect_local(pipe, name, view, lang.clone()),
None => {
self.extras_connecting(address, name);
- Session::connect(address, name, auth.clone(), view, lang.clone())
+ match cookies {
+ Some(cookies) => Session::connect_transferred(
+ address,
+ name,
+ auth.clone(),
+ view,
+ lang.clone(),
+ cookies,
+ ),
+ None => Session::connect(address, name, auth.clone(), view, lang.clone()),
+ }
}
};
let player_type = super::perspective::player_type(&root);
@@ -446,6 +471,7 @@ impl Game<'_> {
chunk_center: (0, 0),
backlog: VecDeque::new(),
backlog_since: None,
+ transfer: None,
});
// The level's TickRateManager follows the server's ticking packets.
self.clock = horizon_client::clock::FixedStep::client();
@@ -867,6 +893,15 @@ impl Game<'_> {
}
}
Event::Reconfigured(registries) => self.set_registries(registries),
+ // handleTransfer: "Cannot transfer to server from
+ // singleplayer" (no ServerData), so the world just closes.
+ Event::Transfer { host, port } => {
+ if let Some(r) = self.remote.as_mut()
+ && r.session.address != "local"
+ {
+ r.transfer = Some(format!("{host}:{port}"));
+ }
+ }
Event::PackPush(p) => self.handle_pack_push(p),
Event::PackPop(id) => self.handle_pack_pop(id),
Event::DecodeError(e) => {
@@ -882,6 +917,20 @@ impl Game<'_> {
from_server,
} => {
log::info!("Horizon: disconnected: {reason}");
+ // ClientboundTransferPacket left a target: connect there
+ // instead of showing the disconnect, the stored cookies
+ // carried over (ClientCommonPacketListenerImpl.
+ // handleTransfer → ConnectScreen.startConnecting).
+ let transfer = self.remote.as_mut().and_then(|r| {
+ r.transfer.take().map(|address| {
+ (address, r.session.name.clone(), r.session.cookies.clone())
+ })
+ });
+ if let Some((address, name, cookies)) = transfer {
+ self.leave_server(None)?;
+ self.connect_server_with_cookies(&address, &name, Some(cookies))?;
+ return Ok(());
+ }
let retry = self.reconnect_after(&reason, from_server);
self.leave_server(Some(reason))?;
self.offer_reconnect(retry);
@@ -1015,6 +1064,9 @@ impl Game<'_> {
r.stepped.clear();
r.head_lerps.clear();
r.pending_items.clear();
+ // The entity ids are the old world's; the new dimension's
+ // player entities re-map to their profiles on AddEntity.
+ r.level_players.clear();
// A new ClientLevel: a new chunk storage, centred on 0, 0.
r.chunk_center = (0, 0);
}
@@ -4796,6 +4848,11 @@ impl Game<'_> {
self.mount_menu_reset();
// The client's menu has no level access: what it holds is the server's.
self.station = None;
+ // AbstractContainerMenu.removed: the server gives the grid and the
+ // carried stack back to the inventory and syncs it; the copies here
+ // are stale the moment the window closes.
+ self.craft_grid.fill(None);
+ self.carried = None;
self.craft_size = 2;
if let Some(key) = self.container.take() {
// Server containers stay renderable but lose their copied slots.
diff --git a/crates/horizon-client/src/game/startup_menu.rs b/crates/horizon-client/src/game/startup_menu.rs
index 96af99bbc..fe568fe71 100644
--- a/crates/horizon-client/src/game/startup_menu.rs
+++ b/crates/horizon-client/src/game/startup_menu.rs
@@ -33,6 +33,7 @@ impl StartupMenu {
Some(PendingWorldEntry::Server {
address: address.clone(),
name: options.player_name(),
+ cookies: None,
})
} else {
options
@@ -125,6 +126,7 @@ impl StartupMenu {
Action::Connect { address } => PendingWorldEntry::Server {
address,
name: player_name,
+ cookies: None,
},
_ => return,
};
@@ -762,7 +764,7 @@ mod tests {
"Guest".into(),
);
assert!(
- matches!(menu.pending.take(), Some(PendingWorldEntry::Server { address, name })
+ matches!(menu.pending.take(), Some(PendingWorldEntry::Server { address, name, .. })
if address == "localhost:25565" && name == "Guest")
);
assert!(menu.pending.take().is_none(), "an entry is consumed once");
diff --git a/crates/horizon-client/src/hud.rs b/crates/horizon-client/src/hud.rs
index 89d1b1c3c..617126c2e 100644
--- a/crates/horizon-client/src/hud.rs
+++ b/crates/horizon-client/src/hud.rs
@@ -78,7 +78,10 @@ pub const MAP_SLOTS: usize = 256;
/// The atlas slot the minimap extra draws into.
pub const MINIMAP_SPRITE: &str = "horizon/minimap";
/// Atlas slots for downloaded player skins (`skins/`), 64x64 each.
-pub const SKIN_SLOTS: usize = 32;
+/// Vanilla registers a texture per skin. Here a skin evicted from its slot
+/// is not stored again, and its player falls back to the default skin, so
+/// the slots must cover a busy server's player list.
+pub const SKIN_SLOTS: usize = 128;
/// Reused by the visible rows of the classic world selector.
pub const WORLD_ICON_SLOTS: usize = 32;
/// Atlas slots for the pack icons on the pack screen, one per icon drawn
diff --git a/crates/horizon-client/src/lan/hub.rs b/crates/horizon-client/src/lan/hub.rs
index c2a395899..dd0a32f22 100644
--- a/crates/horizon-client/src/lan/hub.rs
+++ b/crates/horizon-client/src/lan/hub.rs
@@ -1984,7 +1984,9 @@ impl Hub {
S::PlayerInput(p) => {
self.guests[i].input = p.flags;
self.guests[i].sneaking = p.flags & 32 != 0;
- self.guests[i].sprinting = p.flags & 64 != 0 && p.flags & 1 != 0;
+ // handlePlayerInput only records keys and updates crouching.
+ // Sprinting persists after the sprint key is released (or
+ // starts with a double tap); PlayerCommand changes it.
}
// OPEN_INVENTORY (the ridden mount's inventory) and
// START_FALL_FLYING (checked against the guest's chest slot
diff --git a/crates/horizon-client/src/net.rs b/crates/horizon-client/src/net.rs
index 9cce9e1c6..18aec0bea 100644
--- a/crates/horizon-client/src/net.rs
+++ b/crates/horizon-client/src/net.rs
@@ -18,6 +18,7 @@ use horizon_protocol::{
text::{Language, plain, translatable},
};
use std::{
+ collections::HashMap,
sync::{
Arc, Mutex,
atomic::{AtomicBool, Ordering},
@@ -27,6 +28,12 @@ use std::{
time::Duration,
};
+/// `CommonListenerCookie.serverCookies`: cookies the server asked the client
+/// to store (`ClientboundStoreCookiePacket`), answered to
+/// `ClientboundCookieRequestPacket`. A `transfer` carries them to the next
+/// connection (`TransferState`), so a proxy's backend switch keeps them.
+pub type Cookies = Arc>>>;
+
/// What the network thread reports to the game.
pub enum Event {
/// Progress text for the connecting screen.
@@ -48,6 +55,13 @@ pub enum Event {
PackPush(cfg::ResourcePackPush),
/// ClientboundResourcePackPopPacket: one pack, or every pack.
PackPop(Option),
+ /// `ClientboundTransferPacket`: the server sent us to another address.
+ /// The connection ends right after; the game reconnects there with the
+ /// stored cookies.
+ Transfer {
+ host: String,
+ port: i32,
+ },
/// The connection ended. `from_server`: the server gave the reason (or
/// the connection was refused for good), rather than the connection
/// failing (auto-reconnect retries only failures and shutdowns).
@@ -67,6 +81,8 @@ pub struct Session {
pub address: String,
pub name: String,
pub counters: Arc>>>,
+ /// The cookies this server stored on us (`ClientboundStoreCookiePacket`).
+ pub cookies: Cookies,
/// HORIZON_NET_DEBUG=1 logs every packet sent from the game thread.
debug: bool,
}
@@ -79,7 +95,27 @@ impl Session {
view_distance: i8,
lang: Arc,
) -> Self {
- Self::start(address, name, auth, view_distance, lang, None)
+ Self::start(address, name, auth, view_distance, lang, None, None)
+ }
+ /// `ConnectScreen.startConnecting` for a `transfer`: the cookies the
+ /// server stored carry to the new connection (`TransferState`).
+ pub fn connect_transferred(
+ address: &str,
+ name: &str,
+ auth: Option>,
+ view_distance: i8,
+ lang: Arc,
+ cookies: Cookies,
+ ) -> Self {
+ Self::start(
+ address,
+ name,
+ auth,
+ view_distance,
+ lang,
+ None,
+ Some(cookies),
+ )
}
/// Join an integrated server through memory (`Connection.connectToLocalServer`).
pub fn connect_local(
@@ -88,7 +124,7 @@ impl Session {
view_distance: i8,
lang: Arc,
) -> Self {
- Self::start("local", name, None, view_distance, lang, Some(pipe))
+ Self::start("local", name, None, view_distance, lang, Some(pipe), None)
}
fn start(
address: &str,
@@ -97,12 +133,18 @@ impl Session {
view_distance: i8,
lang: Arc,
local: Option,
+ cookies: Option,
) -> Self {
let (send, events) = channel();
let writer = Arc::new(Mutex::new(None));
let configuring = Arc::new(AtomicBool::new(true));
let counters = Arc::new(Mutex::new(None));
- let (thread_writer, thread_counters) = (writer.clone(), counters.clone());
+ // Connection.initiateServerboundPlayConnection: a transfer's
+ // handshake says so (ClientIntent.TRANSFER).
+ let transferred = cookies.is_some();
+ let cookies = cookies.unwrap_or_default();
+ let (thread_writer, thread_counters, thread_cookies) =
+ (writer.clone(), counters.clone(), cookies.clone());
let thread_configuring = configuring.clone();
let (address_owned, name_owned) = (address.to_owned(), name.to_owned());
let thread = std::thread::Builder::new()
@@ -119,6 +161,8 @@ impl Session {
&thread_writer,
&thread_configuring,
&thread_counters,
+ &thread_cookies,
+ transferred,
);
let from_server = result.is_ok();
let reason = result.unwrap_or_else(|e| e);
@@ -140,6 +184,7 @@ impl Session {
address: address.to_owned(),
name: name.to_owned(),
counters,
+ cookies,
debug,
}
}
@@ -291,6 +336,8 @@ fn run(
shared_writer: &Mutex