Compare commits

..
Author SHA1 Message Date
levzzz af5528ef25 Merge pull request #4580 from levzzz5154/launcher/mods-from-github-ui
Mods page: Add from GitHub, origin line and Check for updates
2026-10-30 23:44:33 +05:00
levzzz f4c1010c64 Merge pull request #4489 from ludovicthenot/fix-zoom-keybind-label
Options > Mods: a test that a native mod's key shows and keeps the key pressed
2026-10-30 23:42:43 +05:00
levzzz edbeffbcf3 Merge pull request #4302 from ludovicthenot/native-use-item-hook
Native mods: hook points for using an item (API 5)
2026-10-30 23:40:44 +05:00
levzzzandClaude Sonnet 5.5 8a2e5cb55f Mods page: Add from GitHub, origin line and Check for updates
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 23:36:23 +05:00
levzzz 1c7eb12800 Merge pull request #4573 from levzzz5154/launcher/mods-from-github
Launcher: install a native mod from a GitHub link (CLI)
2026-10-30 23:36:17 +05:00
levzzz 02c48952b8 Merge pull request #4575 from levzzz5154/registry/owner-updates
Registry form: sign an owner's update so horizon-mods can merge it without a reviewer
2026-10-30 23:36:13 +05:00
levzzz 0ddaf69abc Merge remote-tracking branch 'hr/main' into fix/pr-4489 2026-10-30 23:30:09 +05:00
levzzzandClaude Sonnet 5.5 0e060bb2ac Merge main: use-item hooks are API 13
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 23:29:33 +05:00
levzzzandClaude Sonnet 5.5 754440dd55 Registry form: sign an owner's update so horizon-mods can merge it without a reviewer
An owner's new version with nothing else of the entry changed gets an HMAC
trailer (REGISTRY_UPDATE_KEY) in the pull request body and the label
owner-update. Off when the secret is unset.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 23:28:00 +05:00
levzzz cd79f2e326 Merge pull request #4284 from ludovicthenot/native-tooltip-hook
Native mods: a hook point for item tooltips (API 4)
2026-10-30 23:27:32 +05:00
levzzzandClaude Sonnet 5.5 b4ad459449 Launcher: install a native mod from a GitHub link (mods add-github, update-github)
Resolves a repo, release, tag, ref or commit link through GitHub's public API to an
exact release .hnmod or commit, checks the bundle as the registry does, asks for
--trust-native-code, and keeps the origin beside the file.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 23:26:38 +05:00
Ludovic Marie a3726f4bf8 Merge pull request #4547 from horizon-rust/feat/horizon-clients-only
🤖 Agent: verified on the Mac mini at 7a4f7d5: tools/server_horizon_only_e2e.py on a real dedicated server: off by default (a brandless client joins); with horizon-clients-only=true, no brand and "vanilla" are turned away with "This server is for the Horizon client: playhorizon.dev" and a console line, "horizon" joins. pr_ready --quick green (1067 tests); dedicated_server, server_entities, server_player_damage, server_files harnesses pass.
2026-10-30 19:22:05 +01:00
levzzz d17163d417 Merge pull request #4401 from levzzz5154/launcher/native-pin-mismatch
Launcher: build native mods made for different Horizon versions, after "Build anyway"
2026-10-30 23:19:17 +05:00
Ludovic Marie a83ac6ac1c Merge pull request #4553 from horizon-rust/feat/server-perf-report
🤖 Agent: requeued: main merged in (main had dropped the two native_lifecycle source-shape tests, so main's file is taken), docs/api/server-reference.md regenerated for the new command; horizon-server tests 53/53, report and dedicated tests pass; end to end verified earlier (init/start/report 10/stop).
2026-10-30 19:16:55 +01:00
levzzz 701168f1e5 Merge pull request #4560 from levzzz5154/docs/no-wasm-docs
Docs: remove the old WebAssembly mod system
2026-10-30 23:16:14 +05:00
levzzzandClaude Sonnet 5.5 15a18c3a5e Merge main: tooltip hook is API 12
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 23:14:14 +05:00
levzzz 7af000900b Merge pull request #4390 from arismoko/native-vanilla-particles
Native mods: send vanilla particles from server code
2026-10-30 23:12:34 +05:00
levzzzandClaude Sonnet 5.5 f7ce36c8e1 Merge main into native-pin-mismatch
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 23:09:14 +05:00
levzzz f6154f9ebb Merge pull request #3877 from arismoko/content-block-shapes
Content mods: set per-state outline and collision shapes
2026-10-30 23:07:31 +05:00
levzzzandClaude Sonnet 5.5 f5eb5a18f3 Docs: remove the old WebAssembly mod system from the docs and roadmap
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 23:07:28 +05:00
Ludovic MarieandClaude Opus 5.5 71e6b60d96 docs/api/server-reference.md: the report command
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 19:05:57 +01:00
Ludovic Marie f533c3af7d Merge pull request #4531 from horizon-rust/fix/server-reach
🤖 Agent: verified on the Mac mini at d39eb5d: tools/server_reach_e2e.py on a real dedicated server refuses attacks from 7 and 50 blocks (survival) and 9 (creative), and accepts 3 and 6 (survival) and 7 (creative), as vanilla's handleAttack does (main lets all of them hit). pr_ready --quick green (1065 tests), 34 of 35 affected harnesses pass; lunge_motion's vanilla transcript changes between runs (STAB path, untouched).
2026-10-30 19:05:38 +01:00
Ludovic Marie 25e03754e2 Merge main into feat/server-perf-report
# Conflicts:
#	crates/horizon-client/src/game/native_lifecycle.rs
2026-10-30 19:03:27 +01:00
levzzzandClaude Sonnet 5.5 00c9b04674 Native particles: API 11
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 23:00:46 +05:00
levzzz 20703366f9 Merge remote-tracking branch 'hr/main' into fix/pr-4390 2026-10-30 22:59:06 +05:00
levzzzandClaude Sonnet 5.5 d7cb3537ea Merge main into content-block-shapes: keep shapes and default_state
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 22:55:44 +05:00
levzzz 59e71f00ef Merge pull request #3846 from arismoko/content-default-states
Content mods: allow a block default state override
2026-10-30 22:50:58 +05:00
levzzz fcf76afc05 Merge pull request #4485 from arismoko/native-lifecycle-behavior-cleanup
Native mods: drop source-text lifecycle tests
2026-10-30 22:50:42 +05:00
levzzz b12a499a9a Merge pull request #4412 from levzzz5154/native/server-tick-at-start
Native mods: server tick Start before any level; one tick-clock step per server tick
2026-10-30 22:50:26 +05:00
Ludovic MarieandClaude Opus 5.5 59526900a0 native_lifecycle test: find the server tick in the report's match
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 18:47:29 +01:00
arismoko 4783b8d552 Native mods: send vanilla particles from server code 2026-10-30 12:40:06 -05:00
Ludovic Marie ab6851d5a8 Merge pull request #4494 from horizon-rust/feat/smp-design
🤖 Agent: docs only (docs/smp.md + an index line), checked at 6f6650a: it matches Ludovic's scope of 2026-10-30 (the SMP is a native mod only the official server builds; players install nothing) and the hook points of #4514, #4519 and #4534 as they are; pr_ready green.
2026-10-30 18:37:47 +01:00
Ludovic Marie a03ce15c4e Merge pull request #4534 from horizon-rust/feat/smp-server-menus
🤖 Agent: verified at e23b4b7d8 (stacked on #4519): pr_ready green (1072 horizon-client tests, clippy); dedicated_server and server_entities pass; the SMP mod's /trade on a real dedicated server with two real clients clicking the server's chest menu: closing, the cancel button, death (keep_inventory on) and leaving moved nothing; a full inventory was refused with nothing moved; a confirmed trade swapped 10 diamonds for 5 emeralds and 35 coins, as counted on both clients.
2026-10-30 18:35:39 +01:00
Ludovic Marie d60c8d4e0f Merge pull request #4519 from horizon-rust/feat/smp-item-helpers
🤖 Agent: verified at 396f45655 (stacked on #4514): pr_ready green (1069 horizon-client tests, clippy); dedicated_server and server_entities pass on #4534's head, which holds this one; with the SMP mod's market, a real dedicated server and two real clients ran /sell wheat, /sell hand and /buy torch 5, and the buyer's own client counted 0 diamond, 0 wheat and 5 torch; a creative player was refused.
2026-10-30 18:35:34 +01:00
Ludovic Marie 152a0db8c3 Merge pull request #4514 from horizon-rust/feat/smp-native-hooks
🤖 Agent: verified at 768d20d: pr_ready green (1067 horizon-client tests, clippy -D warnings); tools/parity.py dedicated_server server_entities pass (on #4534's head, which holds this one); with no mod the tree stays Null and the gate is a hash lookup; with the SMP mod, a real dedicated server and two real clients ran /balance, /pay, /baltop and /eco (operator-only, hidden from others), the files and audit log matched, and a restart kept the balances.
2026-10-30 18:35:30 +01:00
Ludovic Marie b4a7018864 Merge pull request #3720 from Domanffe/fix/launcher-remove-queue
🤖 Agent: pr-triage-1 (Ludovic's AI agent, Claude), not Ludovic himself. Proven on ccb85be48 merged with current main, on macOS: - `pr_ready --quick` passes (launcher rustfmt, clippy, tests). - Concurrent removals through the launcher CLI in a scratch home: three versions of 20,000 files each removed at once, with `versions --installed` polled 143 times meanwhile. None of the three is listed once its removal has started. On main, each stays listed for ~0.46 s of a 1.5 s delete, half-deleted, which is the window your marker-first change closes. - The window's gate (`removable`) is covered by the new test. Queued for the merger.
2026-10-30 18:35:25 +01:00
Ludovic Marie c7e33a9163 Merge pull request #4535 from horizon-rust/perf/creaking-heart-snapshot
🤖 Agent: verified: 3 interleaved A/B rounds on playhorizon (60 bots) cut tick_block_entities ~5.7 to ~2.7 ms/tick, MSPT avg -3.5 to -9 ms; behaviour unchanged (the snapshot is only skipped on ticks that read no mob); pr_ready --quick green.
2026-10-30 18:35:21 +01:00
Ludovic MarieandClaude Opus 5.5 7a4f7d5c99 Dedicated server: horizon-clients-only lets only the Horizon client join
Off by default. With horizon-clients-only=true in server.properties (server.toml's [properties]), a
client whose minecraft:brand isn't "horizon" (vanilla's client says "vanilla"; one that names none
counts as vanilla, as on vanilla's server) is disconnected during configuration with "This server is
for the Horizon client: playhorizon.dev", and the console logs which client it was. The brand can be
spoofed: this is a gate for players who didn't install Horizon, not security.

horizon-bots gets --brand and prints a configuration disconnect's reason;
tools/server_horizon_only_e2e.py checks both settings on a real dedicated server.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 18:32:25 +01:00
rdbt c9f49f3b54 Merge pull request #4525 from doodlyyousuf/fix/item-honey-slide
Slide dropped items down the sides of honey blocks
2026-10-30 17:24:22 +00:00
rdbt 8e93b54a41 Merge pull request #4368 from xFedeT/fix/sulfur-cube-redstone
Explosive sulfur cubes light their fuse beside redstone power
2026-10-30 17:22:44 +00:00
rdbt 9e50f5618c Merge pull request #4340 from xFedeT/fix/smithing-cycling-icons
Smithing table: the empty slots cycle their icons, as CyclingSlotBackground does
2026-10-30 17:22:33 +00:00
rdbt ce5086e2d3 Merge pull request #4403 from Ashura006/display-box-culling
Cull display entities with the width/height frustum box
2026-10-30 17:22:22 +00:00
rdbt 9ab3cee2e8 Merge pull request #4373 from iLostName/join-stall-cheaper
joining a world: the player model and command registries are read once, not at every join
2026-10-30 17:21:40 +00:00
rdbt ff8bd6a91f Merge pull request #4362 from DUzzL/fix/issue-4356-piglin-crossbow
Let a piglin holding a crossbow shoot instead of melee
2026-10-30 17:21:29 +00:00
rdbt 9c825e67df Merge pull request #4324 from v3nn7/investigate/farmland-shadow
Project entity shadows onto partial block bounds
2026-10-30 17:21:11 +00:00
rdbt 00448b2ea0 Merge pull request #4322 from DUzzL/fix/issue-4317-slider-hover-outline
Keep the slider track outline off on hover
2026-10-30 17:21:00 +00:00
rdbt 81410769f5 Merge pull request #4372 from iLostName/namespaced-item-animations
item sprites: another namespace's animated texture packs its first frame and animates
2026-10-30 17:20:50 +00:00
rdbt 1df5237769 Merge pull request #4352 from xFedeT/fix/loot-set-instrument
Loot: a goat horn from a loot table gets its instrument (set_instrument)
2026-10-30 17:20:39 +00:00
rdbt 9ca78f1309 Merge pull request #4346 from xFedeT/fix/port-map-ominous-stew-crossbow-frames
Port map: four rows of #3515 already ported; item frames keep to the build height
2026-10-30 17:20:28 +00:00
rdbt e37351ed75 Merge pull request #4395 from DUzzL/fix/issue-4388-mcmeta-bom
Accept a UTF-8 byte-order mark in server pack.mcmeta
2026-10-30 17:20:17 +00:00
Ludovic Marie 0d6db579ec Merge pull request #4522 from horizon-rust/fix/crash-head-server
🤖 Agent: verified: new crash test passes, pr_ready --quick green. A dedicated server's crash report says Server thread and drops the client's render settings.
2026-10-30 18:19:56 +01:00
Ludovic Marie e749114173 Merge main into feat/server-perf-report 2026-10-30 18:19:55 +01:00
Ludovic MarieandClaude Opus 5.5 05bc171f13 horizon-server report: a performance report to share (horizon-report on the console)
`horizon-server report [SECONDS]` (or `horizon-report` on the console)
records every tick for 60 s by default, up to 600, then writes
reports/perf-<time>.json and a short .txt beside it, and prints the
summary. The report holds:
- TPS and MSPT (average, p50/p95/p99, max, ticks over 50 and 100 ms) and
  CPU time per tick;
- each span's share of the tick, and the 10 worst ticks with their spans;
- entities by type and chunks per level, players online;
- memory, CPU, the machine, view and simulation distance, max players.
No names, UUIDs, addresses, seed or world name, so a server owner can
attach it to an issue as it is.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 18:19:55 +01:00
rdbt b7d754a60a Merge pull request #4381 from DUzzL/fix/issue-4370-golem-chest-lid-guests
Send the copper golem chest lid event to LAN guests
2026-10-30 17:19:49 +00:00
rdbt 1c8532cbe1 Merge pull request #4323 from v3nn7/fix/title-debug-overlay
Keep debug overlay off the title screen
2026-10-30 17:19:44 +00:00
Muhammad Asif ed6d97cbbb Slide dropped items down the sides of honey blocks
HoneyBlock.entityInside already slides players and mobs. Dropped items
never ran it, so they fell at full speed beside honey. ItemEntity.tick
now applies isSlidingDown / doSlideMovement after the move, before
friction, without slide sounds (doesEntityDoHoneyBlockSlideEffects).

Fixes #4513
2026-10-30 22:13:52 +05:00
Ludovic Marie d52d37f944 Merge main into perf/creaking-heart-snapshot 2026-10-30 18:13:38 +01:00
Ludovic MarieandClaude Opus 5.5 d39eb5d638 Server: vanilla's reach on attacks and entity interactions, and blocks by attribute
A client could attack any player or mob from any distance: the server path (LAN host, the integrated
server thread, dedicated servers) never checked ServerboundAttackPacket's range, so a hacked client
hit people 50 blocks away. Now, as ServerGamePacketListenerImpl does:

- handleAttack: Player.isWithinAttackRange(mainHandItem, targetBox, 3.0), the held item's
  attack_range or AttackRange.defaultFor (0 to the entity interaction range), for players, mobs,
  vehicles, dragon parts and projectiles alike; out of range the attack is dropped silently;
- handleInteract: Player.isWithinEntityInteractionRange(targetBox, 3.0);
- digging and handleUseItemOn read the guest's block_interaction_range attribute instead of a fixed
  4.5 (5 in creative), so /attribute and items count, and handleUseItemOn logs vanilla's
  "Rejecting UseItemOnPacket ... too far away from hit block" line.

The ranges are the player's attributes: creative's modifiers (+2, +0.5) are on them every tick.
horizon-bots gets a stand behaviour, --attack NAME and the victim's health in its report;
tools/server_reach_e2e.py proves it on a real dedicated server.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 18:12:00 +01:00
Ludovic Marie 91352551d6 Merge pull request #4517 from horizon-rust/fix/region-cache-limit
🤖 Agent: verified: unit test fails on main (601 descriptors) and passes here; bots repro shows region fds growing without bound on main; pr_ready --quick green. Fixes the official server's 'Too many open files' crashes.
2026-10-30 18:11:11 +01:00
Ludovic MarieandClaude Opus 5.5 848c0b10d4 Crash reports: a dedicated server's head says Server thread, without render settings
On a dedicated server, the main thread's report said "Thread: Render thread"
and listed the render settings it had read from options.txt (the official
server's EMFILE crash reports did). The main thread is now named for its
side, as vanilla's reports name it, and a server's report leaves out the
render settings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 18:08:19 +01:00
Ludovic MarieandClaude Opus 5.5 e23b4b7d8f Native mods: server menus and an atomic item exchange (API 10)
A server mod opens a vanilla chest menu (generic_9x1..9x6) for a player and
fills it with items to look at. No click moves anything: clicks and the
menu's closing (by the player, another menu, leaving) reach the mod through
native_menu_clicked and native_menu_closed, run with no player swapped in.
native_exchange_items swaps two players' offered stacks in one step, each
checked to still be exactly as offered and to fit whole on the other side,
or moves nothing. A stock client shows it all.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 18:04:25 +01:00
Ludovic MarieandClaude Opus 5.5 396f456556 Native mods: the items test follows getFreeSlot's empty off hand
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 18:03:53 +01:00
Ludovic MarieandClaude Opus 5.5 e0cb05bfce Save: keep at most 256 region files open, like vanilla
The region cache in save.rs opened every region, entities and poi file a
dimension ever touched and never closed one. A server whose players travel
(teleports, elytra, exploration) runs out of file descriptors: the four
crashes of the official server on 2026-10-30 (v0.2.97) were all
"Too many open files (os error 24)" from horizon-region-writer, then a
failed save and a fatal tick error.

Cap the cache at RegionFileStorage.MAX_CACHE_SIZE (256): when full, drop
the least recently used file no caller still holds. Also raise the soft
open-file limit to the hard one at startup, as the JVM does with
-XX:+MaxFDLimit, so sockets and other files keep their headroom.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 17:58:29 +01:00
Ludovic MarieandClaude Opus 5.5 6f6650a68f docs/smp.md: players install nothing; trades move nothing until the swap; config.json
The SMP uses only what a stock Horizon client renders (commands, vanilla
chest menus, sounds, titles, action bar, boss bars, sidebar). The trade
menu is display only and swaps both offers atomically, so no way out has
items to return. The config is config.json, as the mod writes it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 17:52:33 +01:00
Ludovic MarieandClaude Opus 5.5 768d20d998 Native mods: a server player's game mode
A shop must refuse a player in creative mode, who can make any item.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 17:39:10 +01:00
Ludovic MarieandClaude Opus 5.5 b070f41dda Native mods: the acting player's plain items for server mods (API 9)
native_held, native_count_items, native_carried_items, native_take_items,
native_room_for and native_give_items: what a server shop needs, on the
36 inventory slots and the off hand, plain stacks only (no damage, no
component), in Inventory.add's slot order, and give only where it fits.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 17:39:10 +01:00
Ludovic Marie 8f376a4712 Merge pull request #4490 from horizon-rust/feat/launcher-night-mods
🤖 Agent: Launcher redesign R7b (the instance's Mods tab), approved by Ludovic after the screenshots. main merged in; full pr_ready green, verify and launcher CI green on this head. The only comment is the overlap bot's note on #4478 (different change; not landed).
2026-10-30 17:39:06 +01:00
Ludovic Marie 63db88b844 Merge remote-tracking branch 'origin/main' into feat/launcher-night-mods 2026-10-30 17:29:45 +01:00
Ludovic MarieandClaude Opus 5.5 076c41fc27 Native mods: server commands and players (API 8)
native_register_commands: the commands a native mod adds to every player's
command tree (usages such as `pay <player:player> <amount:integer>`,
optional arguments last, an operator level each), merged into one tree the
hub sends after vanilla's, filtered by level. native_perform_command: a
player's command on the server for a registered name, inside their swap,
whether the world allows commands or not. Helpers: the players on the
server, a line to one or to all, the command's feedback, the world's
folder. With no mod hooking them, the tree is empty and nothing changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 17:29:20 +01:00
Ludovic MarieandClaude Opus 5.5 3f1a45313e docs/smp.md: the SMP is a native mod only the official server builds
Horizon's own server stays plain: no SMP command, setting or code in the
release. The mod lives in horizon-mods (native/smp); Horizon gains general
server hook points (commands, players, items, menus, interactions) that
any native mod can use. Config and data move to world/horizon-smp/.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 17:22:55 +01:00
Ludovic MarieandClaude Opus 5.5 9d0473d748 docs/smp.md: the SMP layer's design (economy, trades, gambling, organisation)
Built in behind [smp] in server.toml, off by default: why not a server mod
or a datapack, the commands, the configuration, the data files under
world/horizon-smp/, the cost and the phases.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 17:22:18 +01:00
Ludovic Marie f6a757ac2e Merge pull request #3491 from ThatCakeIsAPie/feat/datapack-biomes-1
🤖 Agent: verified on main + this head. With the level-shape stack merged, this PR is now one file (biome.rs, +242/−68): the biome-table piece levzzz5154 asked for first on #3492. I merged main in, and main's biome features (#4211) are now read in BiomeInfo::from_json, where this PR parses a biome file. Checks: 110 of the 111 harnesses this change can affect pass. lunge_motion fails on main itself since #4297. dedicated_server, datapack_worldgen, server_world_gen, pr_ready and lan_e2e (worldspawn, light, levels, distance, portals, chest, forced-levels) also pass. Biome files are parsed only when a world loads. Queued to merge.
2026-10-30 17:18:57 +01:00
Neferr ca9195fb02 Options > Mods: a test that a native mod's key shows and keeps the key pressed
#3539: on v0.2.97 the WebAssembly Zoom's key set to R showed another key. Since #3346 and #3350 a mod's keys are Key Binds rows of its native settings page; this test sets Zoom's key to R there and checks the row shows R and horizon-mods.txt keeps key.keyboard.r. Fixes #3539.
2026-10-30 17:07:38 +01:00
Ludovic MarieandClaude Opus 5.5 c1c646a326 Launcher: the instance's Mods tab (redesign R7b)
Home gets a Mods tab after Overview (plan R0, screens 5 and 6): every mod of the selected
instance, the browser's and the jars put in its folder by hand, with its version, where it comes
from (Modrinth, needed by another mod, or a local file), an amber Update pill when the browser
found a newer version, and a switch (a Java jar turned off is renamed .disabled, as the browser
already does; a Horizon instance's registry mods switch as the game's Options > Mods does). A
filter, Update all and Add mods (the Mods page) complete it. Java instances without a loader
have no Mods tab.

The Mods page's per-instance load moves into mods_load(), which the tab shares without the
page's first search.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 17:02:29 +01:00
Ludovic Marie fca2169de9 Merge pull request #4459 from horizon-rust/feat/launcher-night-instance
🤖 Agent: Launcher redesign R7a (the instance's tabs under Home's hero), approved by Ludovic after the screenshots. main merged in; full pr_ready green, verify and launcher CI green on this head.
2026-10-30 16:52:32 +01:00
Ludovic MarieandClaude Opus 5.5 aa906ecbe7 Creaking hearts: build the other mobs only on the ticks that read them
with_heart collected a snapshot of every mob for every heart, every tick,
while CreakingHeartBlockEntity.serverTick reads the level only when its
ticker runs out (every 20 to 24 ticks). tick_updates says when; the other
ticks get a mob world without the others.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 16:45:14 +01:00
Ludovic Marie c505204c24 Merge remote-tracking branch 'origin/main' into feat/launcher-night-instance 2026-10-30 16:44:27 +01:00
Ludovic Marie eeb1d3773d Merge remote-tracking branch 'origin/main' into pt1-3491 2026-10-30 16:43:22 +01:00
arismoko bdc422ad8c Remove source-pinned native lifecycle tests 2026-10-30 10:40:37 -05:00
Ludovic MarieandClaude Opus 5.5 91c77af9ae Merge main into datapack-biomes-1
main's biome features (BiomeGenerationSettings.features, #4211) are read
in BiomeInfo::from_json, where this branch parses a biome file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 16:38:14 +01:00
Ludovic Marie 594b50b510 Merge pull request #3490 from ThatCakeIsAPie/feat/level-shape-11
🤖 Agent: verified on main + this head. It carries #3488 and #3489, and merging it lands both. I merged main in. main's new native_world_read.rs read the build range from Dim::min_y and max_y, which #3488 replaces, so it now reads the shape of the world it reads from (736d22009, rustfmt in 6e5d821ee). Checks on main + this branch: the 122 harnesses these PRs can affect, plus dedicated_server, datapack_worldgen (with the tall fixture), server_world_gen, server_dimension_players, locator_bar, pr_ready and lan_e2e (worldspawn, light, levels, distance, portals, chest, forced-levels) pass. After the rustfmt fix, on today's main, 124 of 125 pass: lunge_motion fails on main itself since #4297 (noted there). Meshing time is unchanged. Queued to merge; the data-pack biomes (#3491–#3494) follow.
2026-10-30 16:38:09 +01:00
levzzz 1da354b67a Merge pull request #4211 from d3grando/fix-3518-chunks-biomes
/fillbiome recolours loaded chunks for every client (ClientboundChunksBiomesPacket)
2026-10-30 20:22:19 +05:00
levzzz d0a7c52171 Merge pull request #4076 from d3grando/fix-2912-void
The Void superflat preset gets its stone start platform
2026-10-30 20:22:13 +05:00
levzzz 92f69c1fca Merge pull request #4264 from d3grando/fix-3514-pet-death-message
A tame pet's death tells its owner how it died
2026-10-30 20:22:04 +05:00
levzzz 7c6bbc1cfd Merge pull request #4205 from d3grando/fix-3513-strider-dismount-lava
Get off a strider onto the shore, not into the lava beside it
2026-10-30 20:21:39 +05:00
levzzz 12299b07c9 Merge pull request #4214 from d3grando/fix-3518-delete-chat
A chat message the server deletes becomes the deleted marker
2026-10-30 20:18:35 +05:00
levzzz 0e780d404f Merge pull request #4069 from d3grando/fix-2755
Creative players are pushed by explosions and crystals
2026-10-30 20:18:27 +05:00
Neferr 4ee9816b82 Native mods: hook points for using an item (API 5)
native_use_item_on hears a right click with an item on a block once the block let it through (ItemStack.useOn); native_use_item hears the item's own use, in the air or after native_use_item_on let it through (Item.use). Each hears a click once, on the server for every player; a mod that claims one swings the hand instead of the item's use. Fixes #4290.
2026-10-30 16:18:20 +01:00
levzzz d4740f8621 Merge pull request #4315 from JulesB40/fix/rocket-block-hits
A firework rocket with stars bursts on any block it hits, as in vanilla
2026-10-30 20:18:09 +05:00
levzzz 20b0fd4eca Merge pull request #2990 from kacpherek/fix/item-damage-parity
Items and damage parity: arrow and potion effects, mob damage sources, adventure can_break and can_place_on, lily pads on water, mud from water bottles
2026-10-30 20:16:39 +05:00
Ludovic Marie 0ad879b601 Merge pull request #4455 from horizon-rust/ci/nightly-notes-launcher-line
🤖 Agent: Nightly notes now open with the existing launcher banner (release_train.PLAYERS) and the game archives are labelled as what the launcher installs; Python tests and verify green.
2026-10-30 16:12:22 +01:00
Ludovic Marie 842028904a Merge pull request #4461 from horizon-rust/fix/standalone-start-no-resources
🤖 Agent: verified on the Mac mini: a game started without prepared files (the release zip run by hand) now shows a 'Start Horizon from the launcher' window with Download (playhorizon.dev) and Quit, exits 0 with no crash report; pr_ready --quick green, verify green.
2026-10-30 16:12:18 +01:00
levzzz da1f0fb3a4 Merge hr/main into fix-3513-strider-dismount-lava 2026-10-30 20:10:05 +05:00
levzzzandClaude Sonnet 5.5 c3139d6de7 Merge hr/main into fix/item-damage-parity
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 20:08:20 +05:00
levzzz e296924abb Merge pull request #4083 from d3grando/fix-2885-wolfwet
Wet wolves darken and shake off the water on clients
2026-10-30 20:07:34 +05:00
levzzz c62cba3f17 Merge pull request #3957 from kacpherek/fix/split-misc-b
Fix a batch of small mob, block and world-list behaviours so they match vanilla
2026-10-30 20:07:17 +05:00
Neferr 4d3ee1ace0 Native mods: explain the tooltip hook's place from the game alone 2026-10-30 16:07:01 +01:00
levzzz a434ad7ab9 Merge pull request #3956 from kacpherek/fix/split-misc-a
Tipped arrows, leather armour, allays, mooshrooms and LAN guests behave like vanilla
2026-10-30 20:05:05 +05:00
levzzzandClaude Sonnet 5.5 33743fb052 Merge main; port put_biomes to the column layout
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 20:04:51 +05:00
levzzz 762ce6114c Merge pull request #4363 from 1038april/fix/mouse-tweaks-menus
Run the Mouse Tweaks wheel and drags in furnaces and crafting tables, and keep the cursor right under fast clicks
2026-10-30 20:03:23 +05:00
levzzz cbbcb4323b Merge pull request #2577 from levzzz5154/fix/root-vehicle-restore
Riding a horse survives a save and a reopen
2026-10-30 20:03:13 +05:00
levzzz d2c159e74d Merge pull request #4077 from septydev/fix/ukrainian-launcher-overflow
Fix account chip text overflow
2026-10-30 20:03:05 +05:00
levzzz 526c5f0b5b Merge pull request #4199 from kacpherek/fix/camel-horse-llama-riding
Camel, horse and llama riding physics as vanilla
2026-10-30 20:02:56 +05:00
levzzz 61dc245f09 Merge pull request #3550 from v3nn7/v3nn7
Fix teleport commands without an explicit target
2026-10-30 20:02:51 +05:00
levzzzandClaude Sonnet 5.5 8fb961c146 Merge main; place the void start platform at the generator's own min Y
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 20:02:38 +05:00
levzzzandClaude Sonnet 5.5 0b2ed9162a Merge hr/main into fix/rocket-block-hits
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 20:02:20 +05:00
levzzz 2c80e75d81 Merge pull request #4308 from JulesB40/fix/crossbow-firework-impact
A plain firework rocket from a crossbow flies past the first block, as in vanilla
2026-10-30 20:02:06 +05:00
levzzz 942e3b2ded Merge pull request #2417 from kacpherek/fix/goat-horns
Make goat horns play their sound and show the horn pose
2026-10-30 20:01:21 +05:00
levzzz f1807de201 Merge pull request #3951 from kacpherek/fix/split-rendering
Rendering parity: jeb_ sheep, golem walk tilt, spyglass particle hiding, skulls, brush, witch potion
2026-10-30 20:00:25 +05:00
levzzz fdc4a8b80e Merge remote-tracking branch 'hr/main' into fix/pr-4264 2026-10-30 19:59:58 +05:00
levzzz 381a1ec66e Merge hr/main into fix-3514-pet-death-message 2026-10-30 19:59:56 +05:00
levzzz 53259f6b07 Merge hr/main into fix-3513-strider-dismount-lava 2026-10-30 19:59:16 +05:00
Ludovic MarieandClaude Opus 5.5 e6f5246fdf Game started without its files: a launcher screen, not a crash
A player ran horizon.exe from the release's game zip, thinking it was the
launcher. v0.2.97 then failed with "resource loader stopped before
finishing" and a crash report: the loader's real error (no prepared files)
was taken by App::about_to_wait, and the next poll saw the closed channel
(fixed on main by 9f28fe890, which also checks horizon-resources.json
before any window). That check still ended in an error and a crash report.

- An interactive game with no prepared files now opens a window in Horizon's
  design language (bundled fonts, none of Minecraft's files needed): start
  Horizon from the launcher, Download (opens playhorizon.dev), Quit. The
  console says the same. Closing it quits with code 0 and no crash report.
  Offscreen, scripted and server runs keep the error.
- The heartbeat and servers.dat wait until the files are there.
- A loader channel that closes without a result always names why.
- PLAY.txt sends players to playhorizon.dev for the launcher.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 15:58:23 +01:00
levzzz 67e69ee447 Merge remote-tracking branch 'hr/main' into fix/pr-2990 2026-10-30 19:56:52 +05:00
levzzz a814e9d5a4 Merge remote-tracking branch 'hr/main' into fix/pr-3957 2026-10-30 19:55:53 +05:00
Ludovic MarieandClaude Opus 5.5 36c489208b Launcher: the instance's tabs under Home's hero (redesign R7a)
Home's lower part was one long page: the setup rows, the console, worlds, servers, packs and
screenshots one after the other. They become tabs under the hero: Overview (what Play needs),
Worlds, Multiplayer, Packs, then Screenshots and Console once they hold something. Each tab names
how many it holds; its own buttons sit at the strip's end. The "Ready to play" heading goes: the
hero's state line and the Overview tab already say it.

HORIZON_LAUNCHER_PAGE=worlds (multiplayer, packs, screenshots, console) opens Home on that tab,
for screenshots; it replaces HORIZON_LAUNCHER_CONSOLE.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 15:55:51 +01:00
levzzz fae78ab1d0 Merge remote-tracking branch 'hr/main' into fix/pr-3956 2026-10-30 19:55:00 +05:00
Ludovic MarieandClaude Opus 5.5 0f8f59ec22 Nightly notes open with the way to the launcher
A player ran horizon.exe from the release's game zip, thinking it was the
launcher. Game releases already open with the "Want to play? Download the
Horizon launcher" banner (release_train.PLAYERS, #1647); the Nightly, the
only release since 10-28, did not. Its notes now start with the same banner
(raw HTML, which launchers' notes views skip), and its game archives are
labelled "Game files the launcher installs".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 15:54:56 +01:00
levzzzandClaude Sonnet 5.5 b513f1b152 Merge hr/main into fix-3518-delete-chat
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 19:54:43 +05:00
levzzz 988049b64f Merge hr/main into fix-2885-wolfwet 2026-10-30 19:54:37 +05:00
levzzzandClaude Sonnet 5.5 a712692527 Merge hr/main into fix-2755
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 19:54:29 +05:00
levzzzandClaude Sonnet 5.5 6f9467703a Merge hr/main into fix/crossbow-firework-impact
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 19:54:15 +05:00
levzzz edc5593c76 Merge remote-tracking branch 'hr/main' into fix/pr-4199 2026-10-30 19:54:04 +05:00
Ludovic Marie 04976d95eb Merge pull request #4320 from horizon-rust/fix/light-edge-neighbours
🤖 Agent: server light-edge fix (#4294): verify, launcher and parity green on the head merged into main; playhorizon dedicated_server 5/5 pass (main 5/5 fail), no idle/join regression.
2026-10-30 15:53:21 +01:00
levzzz 65b0155b8e Merge remote-tracking branch 'hr/main' into fix/pr-2417 2026-10-30 19:52:35 +05:00
levzzz 702f03a4b9 Merge remote-tracking branch 'hr/main' into fix/pr-3951 2026-10-30 19:51:34 +05:00
levzzz f83505a484 Merge remote-tracking branch 'hr/main' into fix/pr-4363 2026-10-30 19:51:07 +05:00
levzzz 9a644f3e72 Merge remote-tracking branch 'hr/main' into fix/pr-2577 2026-10-30 19:51:07 +05:00
levzzz a2d6d33d30 Merge remote-tracking branch 'hr/main' into fix/pr-4077 2026-10-30 19:51:07 +05:00
levzzz 1ab895ea01 Merge remote-tracking branch 'hr/main' into fix/pr-3550 2026-10-30 19:51:07 +05:00
levzzzandClaude Sonnet 5.5 f646dc1e0d Merge hr/main into fix-3518-delete-chat
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 19:50:58 +05:00
levzzz 3132240f21 Merge pull request #4438 from horizon-rust/fix/creatures-test-modules
Fix main's test build: duplicate tests module in creatures.rs, two stale test signatures
2026-10-30 19:50:42 +05:00
levzzzandClaude Sonnet 5.5 41d70dc6c5 Merge hr/main into fix-2755
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 19:49:23 +05:00
levzzzandClaude Sonnet 5.5 da5895b445 Merge hr/main into fix/item-damage-parity: keep only HotFloor and the PR's unique parts; heal to attrs.max_health
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 19:49:04 +05:00
levzzzandClaude Sonnet 5.5 7cee64a389 Fix main's test build: Aabb in_water stub in end_gateway
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 19:48:35 +05:00
levzzzandClaude Sonnet 5.5 1bb3647ed6 Merge hr/main into fix/split-misc-b; pass the held stack to armor_stand_spawn (fixes E0425)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 19:47:34 +05:00
levzzzandClaude Sonnet 5.5 f47cec589b Draw the mooshroom variant before the child is borrowed
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 19:46:02 +05:00
levzzzandClaude Sonnet 5.5 6286de3abd Merge hr/main into fix/split-misc-a; mooshroom offspring variant in vanilla's RNG order
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 19:45:25 +05:00
levzzz 17e5640d94 Merge remote-tracking branch 'hr/main' into fix/pr-4363 2026-10-30 19:45:23 +05:00
levzzzandClaude Sonnet 5.5 c30f519c16 Skip chunk copies only of vehicles restored from the player's file
The early skips in spawn_loaded_entities and load_mob matched any remembered UUID, so stale id to UUID entries dropped chunk minecarts after a reopen. Track the UUIDs restore_saved_vehicle brought in for this load instead.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 19:45:15 +05:00
Ludovic Marie 11d1936a5e Merge branch 'pt1-3490' into pt1-3491 2026-10-30 15:45:09 +01:00
Ludovic Marie 865ad0b89d Merge branch 'pt1-3489' into pt1-3490 2026-10-30 15:45:09 +01:00
Ludovic Marie 93bab2181c Merge branch 'pt1-3488' into pt1-3489 2026-10-30 15:45:09 +01:00
Ludovic MarieandClaude Opus 5.5 6e5d821eeb native_world_read: rustfmt
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 15:45:08 +01:00
levzzzandClaude Sonnet 5.5 bf016d1c54 Merge hr/main into fix/camel-horse-llama-riding; run onPlayerJump on the controlling client too (#4224)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 19:44:17 +05:00
levzzzandClaude Sonnet 5.5 b5ad463d2d Fix main's test build: Aabb in_water stub in end_gateway, duplicate tests module and Items::load args in creatures
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 19:44:10 +05:00
levzzz 83f723f666 Merge hr/main into fix-3513-strider-dismount-lava 2026-10-30 19:44:10 +05:00
levzzzandClaude Sonnet 5.5 bcdcc9a460 Merge hr/main into fix/goat-horns; drop duplicate horn tooltip (main has instrument_line)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 19:41:50 +05:00
levzzzandClaude Sonnet 5.5 6ca4b32d06 Fix main's test build: Aabb in_water stub in end_gateway, duplicate tests module and Items::load args in creatures
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 19:41:45 +05:00
levzzzandClaude Sonnet 5.5 d8b0934f65 Merge hr/main into fix/crossbow-firework-impact
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 19:41:13 +05:00
levzzz a2429b8864 Merge remote-tracking branch 'hr/main' into fix/pr-4083 2026-10-30 19:38:58 +05:00
levzzz 06460237d9 Merge hr/main into fix-2885-wolfwet 2026-10-30 19:38:57 +05:00
levzzz 22263abf91 Merge remote-tracking branch 'hr/main' into fix/pr-2577 2026-10-30 19:38:52 +05:00
levzzz 352d59f617 Merge pull request #3163 from echo-ilovech3ss/fix/sulfur-cube-spawn-egg-size
Sulfur cubes: synchronize size metadata and adult egg spawns
2026-10-30 19:38:00 +05:00
levzzzandClaude Sonnet 5.5 83a84b2637 Merge main; truncate the account type line in the redesigned chip
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 19:37:48 +05:00
levzzz 2fa88ac250 Merge remote-tracking branch 'hr/main' into fix/pr-3951 2026-10-30 19:37:22 +05:00
levzzz ce517e179a Merge pull request #3950 from kacpherek/fix/split-blocks
Block parity: candles, levers, redstone ore dust, note block heads, pots, bells, dripstone, hanging signs, vaults
2026-10-30 19:37:20 +05:00
Ludovic MarieandClaude Opus 5.5 3e2bcb00bc Fix main's test build: one tests module per file, Items::load and in_water signatures in tests
Merging #4222/#4082 and #4259 left two `mod tests` in game/creatures.rs, the
pearl test calling Items::load without its PackOverlay argument, and
end_gateway's ProjectileWorld test impl with the old in_water(Vec3) signature.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 15:36:54 +01:00
levzzz c27711cf2e Merge pull request #4282 from d3grando/fix-2826
Many mobs no longer grow the renderer's staging memory until it runs out
2026-10-30 19:36:43 +05:00
levzzz 0056f3445c Merge pull request #4275 from MSedgeMC/fix/4130-thrown-sprite-lift
Draw thrown items where vanilla puts them
2026-10-30 19:36:27 +05:00
levzzz 51b2104c1d Merge pull request #4228 from levzzz5154/fix/mob-ai-oracle-heap
parity: give the mob_ai oracle an 8g heap (4g runs out on a fresh run)
2026-10-30 19:36:10 +05:00
levzzz e2f04717c4 Merge pull request #4227 from abduvaliy-engineer/fix/spawner-data-sync
Sync spawner mob previews after block data commands
2026-10-30 19:36:00 +05:00
levzzz b8988e03b4 Merge pull request #4213 from d3grando/fix-3514-equipment-break-events
Tools and armour break with their sound and crumbs on servers
2026-10-30 19:35:36 +05:00
levzzz 9382a17fed Merge pull request #4209 from d3grando/fix-3514-conversion-keeps-gear
Drowned, zombie and stray conversions keep gear, name and flags
2026-10-30 19:35:19 +05:00
levzzz 15df84b505 Merge pull request #4208 from d3grando/fix-3520-read-timeout
Time out a server that stops answering, with vanilla's disconnect reasons
2026-10-30 19:35:03 +05:00
levzzz 8682bd5781 Merge remote-tracking branch 'hr/main' into fix/pr-3951 2026-10-30 19:35:00 +05:00
levzzzandClaude Sonnet 5.5 0da29407d1 Merge hr/main into fix/split-rendering; drop jeb_ sheep hunks (covered by #4274)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 19:35:00 +05:00
levzzz bdcc1d9f39 Merge pull request #4204 from d3grando/fix-3520-spectator-tracking
Spectating players are hidden from players who aren't spectators
2026-10-30 19:34:46 +05:00
levzzzandClaude Sonnet 5.5 2e2c11005a Replace the both-players console teleport step with single-target steps
The multi-target cross-dimension tracking gap is a separate issue.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 19:34:44 +05:00
levzzz bf5b9b089e Merge remote-tracking branch 'hr/main' into fix/pr-3550 2026-10-30 19:34:39 +05:00
levzzz 3caf55ae8a Merge pull request #4160 from JulesB40/perf/mimalloc-allocator
Chunk generation 18% faster on many cores: mimalloc as the game's allocator
2026-10-30 19:34:30 +05:00
levzzz 96824f711d Merge pull request #4144 from Fauxvale/fix/far-watery-and-nearly-full
Far terrain: kelp is water, and powder snow and paths are kept
2026-10-30 19:34:12 +05:00
levzzz 6daaf0449a Merge pull request #4110 from DUzzL/fix/issue-4094-block-break-speed
Apply the block_break_speed attribute to mining speed
2026-10-30 19:33:54 +05:00
levzzz 8fbe40df70 Merge pull request #4103 from DUzzL/fix/issue-4091-attack-speed
Read the attack speed base from the player's attribute
2026-10-30 19:33:37 +05:00
levzzz 02dc9e2e30 Merge pull request #4084 from d3grando/fix-2783
Runtime spawns run Mob.finalizeSpawn and wither skeletons hit for 4
2026-10-30 19:33:19 +05:00
levzzz f15c9098b6 Merge pull request #4406 from posok124521/fix/trident-block-clip
Thrown tridents: clip blocks with vanilla's centre ray, not the 0.5 box
2026-10-30 19:30:52 +05:00
levzzz bdbcbf2970 Merge pull request #4353 from CocofireHD/fix/shulker-container-sync
Shulker boxes show their contents to the player who holds them
2026-10-30 19:30:32 +05:00
levzzz 7a5bbcd7c8 Merge pull request #4328 from repositorykreml1n/codex/fix-tnt-duper-3856
TNT: stop client piston replay from creating a second primed entity
2026-10-30 19:30:01 +05:00
levzzz ed0d4931b0 Merge pull request #4325 from MSedgeMC/fix/4273-brush-arm-pose
Pose a brushing arm like vanilla, in both hands
2026-10-30 19:29:40 +05:00
levzzz 8f022a0b27 Merge pull request #4297 from hhamaj/fix/lunge-keeps-air-motion
A server's copy of a player jumps with them, so Lunge keeps the jump
2026-10-30 19:29:14 +05:00
levzzz e07b94681b Merge pull request #4274 from MSedgeMC/fix/3958-jeb-sheep
Render the jeb_ sheep's wool colour, as vanilla does
2026-10-30 19:28:02 +05:00
levzzz c679ef53ea Merge pull request #4252 from CocofireHD/fix/item-name-display-name
Item names in command feedback follow the item_name component
2026-10-30 19:27:22 +05:00
levzzz 7bc7f9e783 Merge pull request #4222 from hhamaj/fix/pearl-turns-wind-charge
A pearl turns the wind charge it hits, which then speeds up
2026-10-30 19:26:39 +05:00
levzzz 19327a55b0 Merge pull request #4219 from d3grando/fix-3517-corrupt-leveldat-list
List worlds with an unreadable level.dat and offer recovery
2026-10-30 19:26:05 +05:00
levzzz df1874cced Merge pull request #4206 from DenisHumen/fix/frog-walk-anim
Frogs walk their legs at vanilla's rate
2026-10-30 19:23:57 +05:00
levzzz 726f588668 Merge pull request #4183 from Username59138/fix/command-block-one-data-path
Command blocks: one data path; the command reaches only the player who opens it
2026-10-30 19:23:16 +05:00
levzzz dbc84adbd3 Merge pull request #4082 from d3grando/fix-3072-pearl
Thrown pearls feel the water their box touches, as vanilla's isInWater
2026-10-30 19:20:37 +05:00
levzzz dcc393acec Merge pull request #4073 from d3grando/fix-2866
Swapping the same item into the off hand plays the re-equip animation
2026-10-30 19:20:16 +05:00
levzzz bb6985ecb7 Merge pull request #4068 from d3grando/fix-3183
Glint reads the clock and options once per frame, not per item
2026-10-30 19:19:41 +05:00
levzzz 574d031d14 Merge pull request #4064 from oscargzss/nonconformant-adapter-retry
renderer: try a backend again with non-conformant adapters
2026-10-30 19:19:20 +05:00
levzzz 5edb5defbb Merge pull request #4052 from d3grando/fix-3393-optab
Creative inventory: the Operator Utilities tab for operators
2026-10-30 19:18:58 +05:00
levzzz 91dc405a0f Merge pull request #4048 from ult1mq/codex/lod-retirement
Fix detail requests for retiring fine LOD leaves
2026-10-30 19:18:14 +05:00
levzzz 587f81f9c6 Merge pull request #4019 from d3grando/fix-3788
Pose plugins hide the player's own body again
2026-10-30 19:17:34 +05:00
levzzz 73be91512c Merge pull request #4010 from WhyFovius/fix/fullscreen-loading-crash
Renderer: fullscreen loading crash (Validation acquire + animated sprites layout)
2026-10-30 19:17:15 +05:00
levzzz d10f82a7cb Merge pull request #3999 from d3grando/fix-2786
Light a column again when an edit darkens it beside an unlit one
2026-10-30 19:16:56 +05:00
levzzz 17dd36e93a Merge pull request #3994 from d3grando/fix-2740
Applying a resource pack no longer freezes the window
2026-10-30 19:16:37 +05:00
levzzz 81d38acadc Merge pull request #3936 from abit-foggy/fix/intel-gen11-section-flicker
fix(renderer): use flat draws on Intel Gen11 Vulkan to prevent section flicker (#3529)
2026-10-30 19:16:17 +05:00
levzzz 62ddcb7909 Merge pull request #3721 from xFedeT/fix/skeleton-path-stops-in-shade
Skeletons: a path out of the shade stops at the first node the sky sees
2026-10-30 19:15:58 +05:00
levzzz c3db4a63d5 Merge pull request #4262 from d3grando/fix-3514-pearl-gateway
Ender pearls go through End gateways
2026-10-30 19:14:35 +05:00
levzzz ffae67874b Merge pull request #4259 from d3grando/fix-3514-tame-wolf-kill-credit
Tame wolves' kills count for their owner
2026-10-30 19:14:17 +05:00
levzzz a52ce752a0 Merge pull request #4247 from d3grando/fix-3518-tag-query
F3+I copies the server's data on servers and LAN
2026-10-30 19:13:57 +05:00
levzzz 17bd76282b Merge pull request #4243 from d3grando/fix-3518-sound-slider-preview
Volume sliders play a preview sound on the title screen's options
2026-10-30 19:13:35 +05:00
levzzz 174df925ca Merge pull request #4241 from d3grando/fix-3513-enderman-carried-drop
Endermen drop the block they carry when killed
2026-10-30 19:13:18 +05:00
levzzz cb77d4cb54 Merge pull request #4239 from d3grando/fix-3518-set-camera
Spectators on a server see through the entity they spectate
2026-10-30 19:12:56 +05:00
levzzz cba5d53333 Merge pull request #4236 from d3grando/fix-3514-explosions-break-decorations
Explosions break paintings, cushions and armour stands
2026-10-30 19:12:38 +05:00
levzzz 50f2ca1636 Merge pull request #4229 from d3grando/fix-3518-custom-chat-completions
Chat completes the server's custom chat completions
2026-10-30 19:12:20 +05:00
levzzz 79efd6a2dc Merge pull request #4226 from d3grando/fix-3512-armadillo-breeding
Armadillos breed, follow spider eyes and their parents
2026-10-30 19:12:03 +05:00
levzzz 22115dfb11 Merge pull request #4225 from d3grando/fix-3513-cube-hurts-golem
Slimes and magma cubes hurt the iron golems they touch
2026-10-30 19:11:47 +05:00
levzzz 34abe889db Merge pull request #4224 from d3grando/fix-2920
Riders move their horses on servers, and jump them
2026-10-30 19:11:31 +05:00
Ludovic Marie 3ecec2ca7b Merge branch 'pt1-3490' into pt1-3491 2026-10-30 15:02:27 +01:00
Ludovic Marie 6b44f2ba99 Merge branch 'pt1-3489' into pt1-3490 2026-10-30 15:02:27 +01:00
Ludovic Marie f8f276748b Merge branch 'pt1-3488' into pt1-3489 2026-10-30 15:02:26 +01:00
Ludovic MarieandClaude Opus 5.5 736d22009e native_world_read: a block's bounds are its world's
main's read_block took the build range from Dim::min_y and max_y, which
this branch replaces with each level's shape: it now reads the bounds
of the world it reads from (the level's own, data packs included).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 15:01:35 +01:00
Ludovic Marie 32bb54e90c Merge remote-tracking branch 'origin/main' into pt1-3488 2026-10-30 14:58:25 +01:00
Ludovic Marie 22ad79ba01 Merge pull request #4410 from horizon-rust/fix/mod-submit-errors
🤖 Agent: Merged by Ludovic's AI agent (Claude). The registry now answers refused submissions after the upload (drained), sends 413 as JSON, and returns 504 'GitHub is slow' on timeouts. Proof: pr_ready --quick green, and the crate's own tests (mock GitHub, 413, timeout, a TCP drain test that fails without the fix). Railway redeploys horizon-mod-registry from main through its watchPatterns.
2026-10-30 14:52:08 +01:00
Ludovic Marie 235e3e97c6 Merge pull request #4409 from horizon-rust/chore/telemetry-drop-hub-suggestions
🤖 Agent: telemetry server only (its own workspace): cargo fmt, clippy -D warnings clean and cargo test all pass there; pr_ready --quick passes for the rest (Python tests, game workspace). Removes the hub's suggestion endpoints, now without a caller (horizon-site#21, kira#85). skip-release.
2026-10-30 14:52:04 +01:00
levzzzandClaude Opus 5.5 94a93ab7aa Native mods: server tick Start fires before any level; the tick clock ticks once per server tick
`ServerTickStart` now fires at the top of `tick_server`, before the first level's streaming
and world update, where NeoForge fires `ServerTickEvent.Pre`. Before, it fired inside the first
level's `tick`.

The tick rate manager now ticks once per server tick, before the levels, as
`MinecraftServer.tickServer` does; each level reuses its answer, like `ServerLevel.tick` reading
`runsNormally`. Before, every extra dimension called `world_runs` again, so a `/tick step` was
spent on the first level and the others stayed frozen.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 18:49:47 +05:00
Ludovic Marie a827346dd5 Merge pull request #4399 from horizon-rust/feat/launcher-night-new-instance
🤖 Agent: Launcher redesign R6 (New instance with Horizon, Vanilla and Modded), approved by Ludovic. Full pr_ready green, verify and launcher CI green on this head. Contains #4382, #4391 and #4392; lands after them.
2026-10-30 14:48:44 +01:00
Ludovic Marie b853fd4599 Merge pull request #4392 from horizon-rust/feat/launcher-night-sign-in
🤖 Agent: Launcher redesign R5 (sign-in sheet), approved by Ludovic. Full pr_ready green, verify and launcher CI green on this head. Contains #4382 and #4391; lands after them.
2026-10-30 14:48:40 +01:00
Ludovic Marie f10edd4f40 Merge pull request #4391 from horizon-rust/feat/launcher-night-steps
🤖 Agent: Launcher redesign R4b (Play's steps while it gets ready), approved by Ludovic. Full pr_ready green, verify and launcher CI green on this head. Contains #4382; lands after it.
2026-10-30 14:48:37 +01:00
Ludovic Marie 52ff5ebdc6 Merge pull request #4382 from horizon-rust/feat/launcher-night-home
🤖 Agent: Launcher redesign R4 (Home's hero), approved by Ludovic after the screenshots. Full pr_ready green, verify and launcher CI green on this head. First of the stack #4382 → #4391 → #4392 → #4399.
2026-10-30 14:48:33 +01:00
Ludovic MarieandClaude Opus 5.5 4e9ddb17d9 Telemetry server: drop the hub's suggestion endpoints
The website's suggest form is gone (horizon-site#21) and Kira no longer relays it
(kira#85): roadmap suggestions come only from #horizon-ideas posts. This removes
POST /hub/suggest, GET /hub/suggestions, the hub_suggestions_per_day and hub_token
settings (HORIZON_TELEMETRY_HUB_SUGGESTIONS_PER_DAY, HORIZON_TELEMETRY_HUB_TOKEN),
and their rows in the server's README and roadmap/README.md. The rate-limit test now
uses bug reports; the keep-days expiry is tested on the store.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 14:44:09 +01:00
chi4aandDeepSeek 4.1 Flash 726d9e86ef Thrown tridents: clip blocks with vanilla's centre ray, not the 0.5 box
The server tick tested blocks with an AABB sweep of the trident's 0.5 x 0.5 box
and a per-axis moved != velocity test, so a trident passing up to 0.25 blocks to
the side of a block stuck in mid-air beside it. Use AbstractArrow.tick's
zero-width level().clip(...) and AbstractArrow.onHitBlock's 0.05 pull-back
along Math.signum, in ground and shakeTime, on the server and on the client's
predicted copy.

Fixes #4365

Co-Authored-By: DeepSeek 4.1 Flash (DeepSeek Harness) <[email protected]>
2026-10-30 15:41:24 +02:00
Ludovic MarieandClaude Opus 5.5 b086d4298b Mod registry: answer refused submissions after the upload, JSON 413, name a slow GitHub
A submission refused before its body is read (signed out, CSRF, the hourly limit) or partway through (a file over
64 MiB) answered and closed the connection while the browser was still sending the file. The browser then reports a
network error, and the form says "The service didn't answer" instead of the reason. The service now reads the rest
of the upload (up to its limit) before it answers.

A file over the limit gets 413 with a JSON {error}, as every other refusal, instead of a 400.

GitHub calls get 30 s each and the file's upload 5 minutes (it had one 60 s timeout for everything, a 64 MiB upload
included). A call that times out answers 504 "GitHub is slow right now: try again in a few minutes" instead of the
generic 502.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 14:35:03 +01:00
levzzz d2186eb9aa Merge pull request #3981 from arismoko/native-block-write-observation
Expose native server block change observations
2026-10-30 18:30:39 +05:00
levzzz 4ca814d896 Merge pull request #3941 from arismoko/native-neighbour-observation
Expose native neighbour-change observations
2026-10-30 18:30:30 +05:00
levzzz 41672b1221 Merge pull request #3923 from arismoko/native-server-block-read
Expose read-only native server block queries
2026-10-30 18:30:20 +05:00
levzzz 44471a42a8 Merge pull request #3878 from arismoko/native-lifecycle-server-ticks
Expose native server tick hooks
2026-10-30 18:30:11 +05:00
Ashura006andCursor Agent 8a806d23e0 Cull display entities with the width/height frustum box
Matches Display.updateCulling: width or height 0 keeps distance-only
noCulling; otherwise EntityRenderer.shouldRender uses the interpolated
AABB inflated by 0.5 for text, block and item displays.

Co-Authored-By: Cursor Agent <[email protected]>
2026-10-30 16:30:01 +03:00
Ludovic Marie e262d68fcb Merge pull request #3551 from GIGABAIT93/feat/launch-api-client
🤖 Agent: Merged by Ludovic's AI agent (Claude) after review against #3545 and a proof on macOS: full pr_ready on main + the whole Launch API stack (parity 111/112, 0 failed), at this head pr_ready --quick, parity on the changed files, lan_e2e chest and eat on both paths, and a real end to end (prepare into a scratch --output, then horizon-ctl launch with --game-dir/--home/--quickPlaySingleplayer in isolated homes). Thanks GIGABAIT93 for the Launch API and the quick answers to the review.
2026-10-30 14:26:59 +01:00
levzzzandClaude Opus 5.5 85dbd835d6 Launcher: build native mods made for different Horizon versions, after "Build anyway"
Mods pinning different Horizon commits used to be refused. They often still apply and
compile, so the build now picks the newest pinned commit (by commit time, from GitHub),
lists each mod made for another one, and builds only once the player chooses "Build
anyway" (CLI: native-build --allow-version-mismatch). Those mods are repinned on the
build's own copy, like hook-point mods. A failed apply or compile then says the mods were
made for other versions.

horizon-mixins pins that differ resolve to the newest of them and the launcher's own,
never one older than a mod was made with.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 18:25:41 +05:00
Ludovic Marie 941c4498a2 Merge branch 'feat/launcher-night-sign-in' into feat/launcher-night-new-instance
# Conflicts:
#	docs/design-system.md
#	launcher/lang/de.json
#	launcher/lang/es.json
#	launcher/lang/fr.json
#	launcher/lang/pl.json
#	launcher/lang/ru.json
#	launcher/lang/uk.json
#	launcher/lang/zh.json
#	launcher/src/main.rs
2026-10-30 14:24:26 +01:00
Ludovic Marie 16ae712381 Merge branch 'feat/launcher-night-steps' into feat/launcher-night-sign-in
# Conflicts:
#	docs/design-system.md
#	launcher/lang/de.json
#	launcher/lang/es.json
#	launcher/lang/fr.json
#	launcher/lang/pl.json
#	launcher/lang/ru.json
#	launcher/lang/uk.json
#	launcher/lang/zh.json
#	launcher/src/main.rs
2026-10-30 14:23:54 +01:00
Ludovic Marie 69937e5495 Merge branch 'feat/launcher-night-home' into feat/launcher-night-steps 2026-10-30 14:23:16 +01:00
Ludovic Marie 486e3001d7 Merge remote-tracking branch 'origin/main' into feat/launcher-night-home 2026-10-30 14:23:09 +01:00
Ludovic Marie edeecb4971 Merge branch 'feat/launcher-night-home' into feat/launcher-night-new-instance 2026-10-30 14:09:30 +01:00
Ludovic Marie 5e2d9e758b Merge branch 'feat/launcher-night-home' into feat/launcher-night-sign-in 2026-10-30 14:09:30 +01:00
Ludovic Marie f26519bb53 Merge branch 'feat/launcher-night-home' into feat/launcher-night-steps 2026-10-30 14:09:30 +01:00
Ludovic MarieandClaude Opus 5.5 c7cc6e1256 Launcher: Home says Ready to play only when Play would start the game
Not while the version needs preparing, prepares, waits for an account that
owns the game, or runs (review: it showed beside Needs preparing and over
the steps at 34%).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 14:09:10 +01:00
DUzzL fd21d6ee82 Cover no-BOM and partial-BOM pack.mcmeta (#4388) 2026-10-30 14:08:19 +01:00
Ludovic MarieandClaude Opus 5.5 e2479b2272 Launcher: New instance with Horizon, Vanilla and Modded kinds (R6)
The New instance dialog gets the night look (an opaque plate cut in steps,
night buttons) and tabs for the kind. Vanilla and Modded make a Java
instance: the version comes from Mojang's public list (search, Snapshots,
Old; the newest release chosen), Modded picks Fabric or Quilt at its
newest stable version (asked of the loader's service on Create, so an
unsupported version says so in the dialog). The name follows the choice
("Fabric 1.21.4") until the player types one. Horizon instances are made as
before. The game itself still comes with the first Play, for an account
that owns it. HORIZON_LAUNCHER_PAGE=new-instance opens it for screenshots.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 14:03:46 +01:00
Ludovic Marie d5f484c89f Merge pull request #4387 from horizon-rust/fix/windows-credential-manager-full
🤖 Agent: merging after CI. Launcher-only fix: Windows Credential Manager error 8 (store full) now says what is wrong and how to make room, and a save that stops partway keeps the old sign-in instead of a half-written one. Unit-tested with a fake store that fills up; pr_ready --quick green.
2026-10-30 14:00:04 +01:00
DUzzL c274dad88d Read pack.mcmeta with a UTF-8 byte order mark (#4388) 2026-10-30 13:59:36 +01:00
Ludovic MarieandClaude Opus 5.5 66f4bfbaae Launcher: say when Windows Credential Manager is full, and keep the old sign-in when a save stops partway
Windows players saw "Platform secure storage failure: Windows error code 8" when signing in
(#4313, #4366). CredWriteW returns ERROR_NOT_ENOUGH_MEMORY (8) once the user's Credential
Manager reaches its undocumented total size, for an item of any size; the Xbox app and the
Minecraft Launcher are known to fill it with XblGrts/Xbl| items. The launcher now says the store
is full and how to make room, instead of the bare code.

A secret is kept in several items; a write that failed after the first piece left new pieces in
front of old ones, which read back as no secret (signed out at the next start). The old secret
now goes back when a write stops partway.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 13:52:19 +01:00
Ludovic Marie e4472a7423 Merge pull request #4232 from horizon-rust/perf/load-time-faces
🤖 Agent: verify and both parity jobs are green at c8ee23f2b (merged-head rerun passed at 12:35Z); approved by rdbtCVS. Queued for the merger.
2026-10-30 13:50:33 +01:00
Ludovic MarieandClaude Opus 5.5 0cbb5bae35 Launcher: the sign-in sheet in the night look (R5)
The owner gate's screen becomes a sheet: an opaque plate cut in steps over
the dimmed launcher. "Sign in to play", why (the account that owns Java
Edition, like other launchers; no Minecraft install needed, Horizon
downloads it from Mojang for that account), the code in mono on a raised
box with Copy code, Open link as the main action, Not now, and "Waiting for
Microsoft… the window goes on by itself." The link reads as typed
(microsoft.com/link). The gate itself is unchanged: when it shows, what it
asks, and what Play does without an owner.
HORIZON_LAUNCHER_PAGE=sign-in shows the sheet with a made-up code for
screenshots; nothing asks Microsoft.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 13:43:34 +01:00
Ludovic MarieandClaude Opus 5.5 c81de0f908 Launcher: translate the steps' strings, drop the old preparing line
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 13:36:20 +01:00
simonandClaude Opus 5.5 69ec4ccdd6 Keep the cursor and the items right under fast menu clicks
Rapid clicks, as the Mouse Tweaks wheel sends, could leave a stack in the
cursor, and in creative mode add real items. The server's inventory sync echoed
slots a click in another menu had settled, onto clicks predicted since, and it
never compared the click's state id (handleContainerClick does, and answers a
stale click with the whole menu). The crafting table answered every click with
the whole menu, which undid predictions. The client took state ids from windows
other than the open one, and in creative sent its predictions as inventory edits.

The wheel's clicks assumed the first of them worked: on a slot just emptied, as
when a furnace burns its fuel, the right click that followed picked up half a
stack. It now places with a one-slot drag, which does nothing with an empty hand.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 22:35:54 +10:00
simonandClaude Opus 5.5 217fb7af0d Run the Mouse Tweaks wheel and drags in furnaces and crafting tables
The gate only allowed the inventory and chest-like menus, so nothing moved
in furnaces, crafting tables, hoppers and dispensers. The wheel now takes its
target from the menu engine's quickMoveStack, so fuel, inputs and result slots
follow vanilla's routing, and every action is still ordinary slot clicks.

Fixes #4312

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 22:35:54 +10:00
Ludovic MarieandClaude Opus 5.5 5a42da4fe1 Launcher: test the time left and the steps' order
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 13:32:17 +01:00
Ludovic MarieandClaude Opus 5.5 2b78aa1735 Launcher: Play's steps while it gets ready, in the night look (R4b)
While a version prepares, Play reads "Getting ready…" with the download's
percentage, Cancel beside it while a download from Mojang runs. Under them:
the bar, what is happening ("Downloading Minecraft 26.3 from Mojang · 1,754
of 5,160 files") with the time left from the download's pace, and the
steps: game files, Java, sounds, prepare, and play when Play was pressed.
backend::PrepareStep is set by the preparation as it moves on. The progress
bar takes the night look (6 px, plate track, accent fill) everywhere.
HORIZON_LAUNCHER_PAGE=getting-ready shows the state for screenshots.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 13:32:17 +01:00
Ludovic MarieandClaude Opus 5.5 95825f818c Launcher: translate Folder and Version, drop the strings Home no longer has
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 13:32:07 +01:00
Ludovic Marie 5c34936e1b Merge pull request #4242 from horizon-rust/perf/dedicated-no-block-models
🤖 Agent: verify and both parity jobs are green at 3a11501e2 (the rerun passed dedicated_server and world_spawn#3); approved by rdbtCVS. Queued for the merger.
2026-10-30 13:31:55 +01:00
GIGABAIT93andClaude Opus 5.5 267e7063d5 Launch API: promise play only for an owner, name the option in errors (#3545)
- `--name` leaves OPTIONS: the game still takes it, but the contract doesn't
  promise offline play. The guide's first step is now the owner rule, and a
  session the game can't read is stated as a fact, not an option.
- A bad value names its option (`Horizon: --width: invalid digit ...`), since
  a launcher shows that line to the player.
- Session errors say "the session", true for --session-stdin too.
- --quickPlaySingleplayer takes one folder name of saves/, as vanilla's level
  id; a path is refused. --world still takes a path for harnesses.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 14:26:24 +02:00
DUzzL 8a196eeb77 Copper golems: send the chest lid block event to guests too 2026-10-30 13:20:50 +01:00
Ludovic MarieandClaude Opus 5.5 b32541cb88 Map proto sections through the column layout
Main's level-shape work replaced vanillagen's fixed MIN_Y and SECTIONS
with ColumnLayout, so the branch merged with main no longer built.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 13:17:29 +01:00
Ludovic Marie 1df4c50f81 Merge pull request #4032 from horizon-rust/feat/launcher-night-shell
🤖 Agent: R3 night frame (sidebar, top bar, account chip). Ludovic approved the style on 2026-10-30; main merged in, pr_ready --quick green (launcher clippy, 278 launcher tests), CI green on fe89da2a2. Merging.
2026-10-30 13:17:16 +01:00
Ludovic Marie 7fb48c7154 Merge remote-tracking branch 'origin/main' into fix/light-edge-neighbours 2026-10-30 13:15:37 +01:00
Ludovic MarieandClaude Opus 5.5 ca7e8bed1a Launch API: rustfmt the exit code test
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 13:11:41 +01:00
Ludovic MarieandClaude Opus 5.5 416678ba17 Launch API: test the exit codes on the real program (#3545)
tests/launch_api.rs runs horizon-client: --launch-api prints JSON and opens no
log; a refused command line (unknown option, bad value, missing value) exits 2
without a crash report; an error exits 1 with the report's path as the last
stderr line, under a relative --home, and creates a relative --game-dir
without writing saves or options.txt where the game was started. Paths have
spaces, as launchers' instance folders do.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 13:11:16 +01:00
Ludovic MarieandClaude Opus 5.5 bbc9c46c17 Launcher: Home's hero in the night look (R4)
The selected instance's name in the display cut, a caption naming what it
plays and whether it is ready, when it was played, and the update line.
Play, the version picker, Mods and Folder in one row as night buttons
(shell::action: main, raised, quiet). A plate on the right holds a
release's notes line (not a Nightly's build line) and Join a friend, which
leaves the rows below. "Host a server" goes: Servers is in the top bar.
The picker names a Nightly as "Nightly · ba6344a" instead of its tag.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 13:10:19 +01:00
Federico TaglianiandClaude Sonnet 5.5 1e14e33704 Explosive sulfur cubes light their fuse beside redstone power
SulfurCube.primeWhenOnPoweredPosition: each tick an explosive cube that is
alive and not primed checks the best neighbour signal at its block and
primes (SignalGetter.getBestOwnOrNeighbourSignal; no block has an own signal).
lan_e2e check sulfur_cube_power.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 13:00:05 +01:00
iLostName 7ee787f8de item sprites: another namespace's animated texture packs its first frame and animates
A server pack's animated item texture (lobby:item/..., frames stacked in one PNG) was packed whole into the GUI atlas: the path check kept the namespace, so models drawn from it (item display NPCs) sampled every frame at once, in stripes. It now cuts the mcmeta's first frame and animates like vanilla's own.
2026-10-30 12:44:42 +01:00
iLostName 737d74f592 joining a world: the player model and command registries are read once, not at every join
Each join parsed entity-models.json twice for the player's model, walked every block state for /setblock's completions and parsed the 1.6 MB command registries export again on the render thread: about 160 ms of one frozen frame per join. None of them changes while the game runs, so each is read once per resources root or block registry (the player model already as the world resources load), and the join itself now takes about 20 ms.
2026-10-30 12:44:34 +01:00
Ludovic Marie fe89da2a2c Merge remote-tracking branch 'origin/main' into feat/launcher-night-shell 2026-10-30 12:41:22 +01:00
DUzzL 1a37932efd Make crossbow piglins shoot instead of meleeing
register_piglin ran before the spawn weapon was equipped, so the crossbow goal was never added and the melee goal took over. Always register the crossbow goal (it checks the held item) and keep the melee goal off while a crossbow is held, as MeleeAttack does for usable projectile weapons. Fixes #4356.
2026-10-30 12:39:15 +01:00
Ludovic Marie 0a341cc353 Merge pull request #3487 from ThatCakeIsAPie/feat/level-shape-8
🤖 Agent: verified on main + this head. I merged main in. goals.rs keeps main's restricted check and max_h, now with the world's bounds. nether.rs keeps main's ghast fly-to target. main's new occupied_pois_in_range reads the world's bounds too. One harness failed: use_item_on. GameLevel's build range now reads the world's shape, but the dispense fixture only set the dimension, so a bed exploding in a Nether or End case broke the block at y -1, below the level. I added one line so the fixture sets the shape from the case's dimension, as enter_dimension does (f0651e754). Checks: 107 harnesses, dedicated_server, pr_ready and lan_e2e (worldspawn, light, levels, distance, portals, chest, forced-levels) passed on the head before that fix. On this head, the 32 harnesses that depend on the fixture (use_item_on among them) and pr_ready pass. Queued to merge; #3488 follows.
2026-10-30 12:33:13 +01:00
Federico TaglianiandClaude Sonnet 5.5 5866611176 Port map: SetInstrumentFunction.run is ported
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 12:19:59 +01:00
CocofireHDandHermes Agent da4db61ba9 Shulker boxes show their contents to the player who holds them
`ItemContainerContents` travels as the `minecraft:container` component, and the
client already decodes it into the tooltip's contents lines. The encoder that
hands a stack from the integrated or LAN server to a player never wrote it, so a
box that held items listed none: only "Shulker Box" in the tooltip, however full
it was (#2979).

Write the component as `ItemContainerContents.STREAM_CODEC` does: the slot
count, then one optional template per slot, each inner stack through the same
encoder so its own name, count and components survive.

Co-Authored-By: Hermes Agent <[email protected]>
2026-10-30 12:16:58 +01:00
Federico TaglianiandClaude Sonnet 5.5 fe8c64382d Loot: set_instrument puts the picked instrument on the item (a goat horn's tune)
SetInstrumentFunction drew the random option and dropped it, so a goat horn
from a loot table (pillager outpost chests) had no instrument.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 12:16:37 +01:00
Ludovic Marie 71571ed2cc Merge branch 'pt1-3490' into pt1-3491 2026-10-30 12:14:41 +01:00
Ludovic Marie 9d23d4e542 Merge branch 'pt1-3489' into pt1-3490 2026-10-30 12:14:40 +01:00
Ludovic Marie 2c39ef7cbf Merge branch 'pt1-3488' into pt1-3489 2026-10-30 12:14:40 +01:00
Ludovic Marie 21ecb7f80b Merge branch 'pt1-3487' into pt1-3488 2026-10-30 12:14:40 +01:00
Federico TaglianiandClaude Sonnet 5.5 5f7338178c Port map: four rows of #3515 that are already ported; an item frame keeps to the build height
OminousBottleAmplifier.addToTooltip, SuspiciousStewEffects.addToTooltip and
CrossbowItem.createProjectile (the crossbow hit sound) are in the game; a
frame may go on a vertical face (ItemFrameItem.mayPlace) and only needs the
build height, which place_item_frame now checks.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 12:02:31 +01:00
Ludovic MarieandClaude Opus 5.5 f0651e7540 Dispense fixture: the world's shape follows the case's dimension
GameLevel's build range now reads the world's shape, so a case in the
Nether or the End must set it as enter_dimension does: a bed exploding
there broke the block at y -1, below the level (use_item_on).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 12:00:25 +01:00
Federico TaglianiandClaude Sonnet 5.5 1c27a0c66d clippy: is_multiple_of in CyclingSlot
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 11:58:10 +01:00
Federico TaglianiandClaude Sonnet 5.5 cfcd6c9112 Smithing table: the empty slots cycle their icons, as CyclingSlotBackground does
The template slot cycles the armour trim and netherite upgrade template
icons; with a template in the table the base slot cycles what it takes (the
11 tools and armour of the netherite upgrade, the four armour pieces of a
trim) and the additions slot the ingot or the seven trim materials, one icon
every 30 ticks with a 4 tick fade. It showed one fixed netherite icon.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 11:53:06 +01:00
DUzzL c172ab7dae Drop unverified vanilla claim from the slider getSprite ledger line 2026-10-30 11:51:52 +01:00
DUzzL cf5290e835 Outline the slider track while dragged 2026-10-30 11:44:54 +01:00
Ludovic Marie a1dc00d466 Merge branch 'pt1-3490' into pt1-3491 2026-10-30 11:39:01 +01:00
Ludovic Marie fb51619741 Merge branch 'pt1-3489' into pt1-3490 2026-10-30 11:39:00 +01:00
Ludovic Marie 2c74f84b97 Merge branch 'pt1-3488' into pt1-3489 2026-10-30 11:39:00 +01:00
Ludovic Marie cc1e38ef22 Merge branch 'pt1-3487' into pt1-3488 2026-10-30 11:39:00 +01:00
Ludovic Marie 47a3b39fa9 Merge pull request #3486 from ThatCakeIsAPie/feat/level-shape-7
🤖 Agent: verified on main + this head. I merged main in (through the carried #3485). The crate split had moved chunk.rs, lod.rs and minimap.rs to horizon-client-render, so this PR's changes to them are reapplied there. Checks: 121 of the 122 harnesses this change can affect pass. dedicated_server differed once on a single light section in one column, the intermittent mismatch already seen on #2608, and passed on rerun. pr_ready and lan_e2e (worldspawn, light, levels, distance, portals, chest, forced-levels) pass. chunk_load_bench gives the same meshes as main, and meshing time is the same (median 42.4 vs 42.5 µs per section over 6 pairs). The random-tick cache allocates its Vec once per cached chunk, not per tick. Queued to merge; #3487 follows.
2026-10-30 11:38:20 +01:00
Ludovic MarieandClaude Opus 5.5 2867be0d53 Merge main into level-shape-8
goals.rs keeps main's restricted check and max_h, with the world's
bounds; nether.rs keeps main's ghast fly-to target (no heightmap mirror).
main's occupied_pois_in_range reads the world's bounds too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 11:37:14 +01:00
MSedgeMC 8a378f441c Pose a brushing arm like vanilla, in both hands
Vanilla's AvatarRenderer builds the arm pose per hand and gives a brush
that is in use the BRUSH pose, whose HumanoidModel case drops the arm
twice as far as an ordinary item: xRot * 0.5 - pi/5 rather than - pi/10,
with yRot zeroed. Horizon had no Brush pose, so a brushing player stood
there with an ordinary item arm while the dust flashed.

The pose is selected from the literal item id with the same using-item
predicate the bow, trident and crossbow arms already use, and the off-hand
ladder gets the matching arm, since brushing works from the off hand too
and vanilla poses that hand the same way. Brush is one-handed and does not
affect the off hand, so shields, bows and tridents keep their paths.

The first-person sweep is not here: PR #3951 already implements it.
2026-10-30 15:51:23 +05:30
v3nn7andCodex 7090cd2d38 Project entity shadows onto partial block bounds
Co-Authored-By: Codex <[email protected]>
2026-10-30 11:20:04 +01:00
Ludovic Marie 9a0e718599 Merge pull request #3656 from jaszkus/fix/waterlogged-bucket
🤖 Agent: Merged by Ludovic's AI agent (Claude) after its proof run: buckets place and collect water in waterlogged blocks, as vanilla does.
2026-10-30 11:17:03 +01:00
v3nn7andCodex 66cc52fd9d Keep debug overlay off the title screen
Co-Authored-By: Codex <[email protected]>
2026-10-30 11:12:38 +01:00
DUzzL adc6e8626e Update port map note for the slider track outline 2026-10-30 11:11:18 +01:00
DUzzL 3bf35d81c8 Draw the slider track outline only for focus, not hover 2026-10-30 11:06:39 +01:00
JulesB40andClaude Opus 5.5 191fc3302d lan_e2e rocket-ceilings: a star rocket must rise before it bursts
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 10:40:50 +01:00
JulesB40andClaude Opus 5.5 4e86e200a5 Fireworks: every free rocket with explosions goes off on a block
FireworkRocketEntity.tick checks each rocket's move against blocks
(getHitResultOnMoveVector, COLLIDER shapes), not only a rocket shot at an
angle, and onHitBlock explodes it when it has explosions. A rocket launched
from the ground stayed stuck under a ceiling until its lifetime; it now
bursts there. The block hit comes from the ray rocket_struck already casts,
so an angled rocket uses it too instead of its box's collision.
lan_e2e's rocket-ceilings check covers it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 10:38:06 +01:00
Ludovic MarieandClaude Opus 5.5 d24853c0a0 Send a column once its neighbours reach INITIALIZE_LIGHT (#4294)
A server sent a column as soon as it was lit, and its light layers
counted only the neighbours already loaded. Vanilla's ChunkStatus.LIGHT
needs every neighbour at INITIALIZE_LIGHT, and its light storage counts
their sections. So a column loaded with its saved light next to a proto
chunk still being made went out without the top light section that
proto's blocks add. dedicated_server failed 5 of 5 on playhorizon since
an idle dedicated server keeps no spawn area (#4095).

A column now waits until each neighbour is loaded or a decorated proto
chunk, and a proto neighbour's non-air sections (its TerrainChunk
counts, read when sent) go into the light layers. Nothing is kept per
column.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 10:35:54 +01:00
jaszkusandjaszkus's AI agent 3da531255a Fix the bucket test after the barrier case
The barrier section leaves a barrier at the test position, so the following 'Emptying water into air makes a source' step ran against a non-air block and failed for a non-creative player. Restore air there; bucket_empty is unchanged.

Co-Authored-By: jaszkus's AI agent <[email protected]>
2026-10-30 10:27:41 +01:00
Ludovic Marie e84a47c069 Merge pull request #3485 from ThatCakeIsAPie/feat/level-shape-6
🤖 Agent: verified on main + this head. I merged main in (through the carried #3484); save.rs keeps main's mob imports. Checks: the 52 harnesses this change can affect, dedicated_server, server_entities, server_dimension_players, pr_ready and lan_e2e (worldspawn, light, levels, distance, portals, chest, forced-levels: chunk packets to a LAN guest in each level) pass. The changes are per chunk, not per block. Queued to merge; #3486 follows.
2026-10-30 10:21:17 +01:00
JulesB40andClaude Opus 5.5 835733c7fc lan_e2e rocket-walls: measure each rocket's life in client ticks
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 10:19:41 +01:00
JulesB40andClaude Opus 5.5 5d4016ca61 lan_e2e rocket-walls: count the rocket every tick in one ctl process
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 10:19:41 +01:00
JulesB40andClaude Opus 5.5 48055aa98f Fireworks: a plain rocket shot at an angle flies past the first block
FireworkRocketEntity.onHitBlock explodes only a rocket with explosions
(hasExplosion). A plain rocket out of a crossbow or a dispenser went off
with a poof at the first block it touched; it now flies on to its lifetime,
as in vanilla. Rockets with explosions still burst on impact. lan_e2e's
rocket-walls check covers both.

Fixes #4281

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 10:19:41 +01:00
Ludovic Marie ba6344a59c Merge pull request #4217 from horizon-rust/fix/keepalive-timeout
🤖 Agent: verify and parity green at c3601b74f (the merged-head parity rerun passed); approved by rdbtCVS. Queued for the merger.
2026-10-30 09:49:11 +01:00
Ludovic Marie 483d832a31 Merge pull request #3484 from ThatCakeIsAPie/feat/level-shape-5
🤖 Agent: verified on main + this head. I merged main in (through the carried #3483). save.rs keeps main's mob imports. LevelShape::for_dir, which the carried #3481 had moved beside the type for the crate split, is gone, as this PR intends: SaveDir::new takes the level's shape. Checks: the 108 harnesses this change can affect, dedicated_server, pr_ready and lan_e2e (worldspawn, light, levels, distance, portals, chest, forced-levels) pass. Queued to merge; #3485 follows.
2026-10-30 09:43:13 +01:00
hhamajandClaude Opus 5.5 9465fb9cb7 A server's copy of a player jumps with them, so Lunge keeps the jump
handlePlayerPositionChange calls jumpFromGround when a player on the
ground moves up without being on the ground. Horizon only charged the
jump's food exhaustion, so the server's copy fell from rest, and the
velocity a jab's impulse sends the player replaced their jump with that
fall: Lunge in the air pushed them down.

jump_from_ground already charges the exhaustion and counts the jump
statistic, which a server's players never got.

Fixes #4278

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 11:41:22 +03:00
ludovicthenot 01c6de15a3 Native mods: a hook point for item tooltips (API 4)
native_tooltip hears every item tooltip the game shows, with the stack and its lines, which a mod can add to, change or take out of. Fixes #4087.
2026-10-30 09:19:37 +01:00
Ludovic Marie 45982faa5c Merge pull request #4245 from horizon-rust/perf/one-loot-data
🤖 Agent: all checks green including parity; approved by rdbtCVS; no comments. Queued for the merger.
2026-10-30 09:11:26 +01:00
MSedgeMC c361096ab0 Draw thrown items where vanilla puts them
Vanilla's thrown snowball, egg and ender pearl are drawn by
ThrownItemRenderer, which only scales and billboards the item: the visible
lift comes from item/generated's ground transform, translation [0, 2, 0]
of 16 units, i.e. 0.125 blocks scaled by the renderer's scale (1.0 for the
throwables, 0.75 and 3.0 for the fireballs). Horizon's hand-rolled
billboard centred the sprite on the entity, so every thrown item drew
0.125 blocks low.

The quad now takes that lift, gated to the kinds vanilla draws with
ThrownItemRenderer: snowball, egg, ender pearl and both fireballs. Llama
spit shares this quad here, but vanilla draws it from
LlamaSpitRenderer with its own translate(0, 0.15, 0) along world up, so it
is deliberately not lifted.

Spawn position, eye height, rotation and velocity already matched vanilla
(the spawn differs by 1.5e-9 blocks), so this is a rendering offset only.
The test pins exact vertex bounds: 99.875..100.375 at scale 1.0,
99.625..101.125 at 3.0, llama spit at no lift, and the rise following the
billboard's own up axis rather than world up.

Not covered here: eye of ender has the same 0.125 offset at its own call
site (game/end.rs eye_geometry) and is left as a follow-up. XP bottles
already take the item-model path, which applies the same ground transform,
so the report's XP-bottle half is not explained by this change.
2026-10-30 13:38:18 +05:30
MSedgeMC fb8e62bc7e Render the jeb_ sheep's wool colour, as vanilla does
SheepRenderer gives a sheep named exactly "jeb_" the lerped dye colour
(ColorLerper.Type.SHEEP: 16 colours, 25 ticks each, white as 0xFFE6E6E6)
and keeps its undercoat. Horizon read no name at all, so the egg did
nothing.

The name test matches MobRenderer.checkMagicName (exact, custom name), the
lerp is Mth.lerpInt's floor per channel, and the age threaded in is the
render state's ageInTicks (tick count plus the partial tick), so the hue
moves per frame instead of stepping at 20 Hz.

The colour vectors came out of the 26.3 jar and were re-derived
independently before the tests were written; jeb_wool_lerps_through_the_
sixteen_dye_colours pins 0xE6E6E6, 0xD0A37D, 0xBA6015, 0x953A8D, 0xDDDDDD
and the 400-tick wrap, and the layer test covers the dyed, baby and
sheared cases.

Known gap, not introduced here: a sheared jeb_ (or dyed) sheep still loses
its undercoat. Vanilla's SheepWoolUndercoatLayer has no sheared guard
while Horizon's outer arm does, which is pre-existing and left for its own
issue.
2026-10-30 13:38:04 +05:30
Ludovic Marie 5d80bf5b89 Merge pull request #3483 from ThatCakeIsAPie/feat/level-shape-4
🤖 Agent: verified on main + this head. I merged main in (through the carried #3482). The crate split had moved gfx.rs, gfx/resident.rs, mesher.rs, streaming.rs and world.rs to horizon-client-render, so this PR's changes to them are reapplied there. World::set keeps main's narrower remesh marking (only the sections a write can reach), now with the chunk's own min_y and section count. Checks: the 108 harnesses this change can affect, dedicated_server, pr_ready and lan_e2e (worldspawn, light, levels, distance, portals, chest, forced-levels) pass. chunk_load_bench gives the same meshes as main, and meshing time is within the machine's noise. Queued to merge; #3484 follows.
2026-10-30 09:04:16 +01:00
Ludovic MarieandClaude Opus 5.5 fb8321177b Pass the world to nav_move_to_path in the callers main added
Main's piglin WalkAway goal and MoveThroughVillageGoal still called the
two-argument form.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 09:01:29 +01:00
Ludovic Marie 3bff52e242 Merge remote-tracking branch 'origin/main' into fix-3721 2026-10-30 08:59:22 +01:00
d3grandoandClaude Opus 5.5 95d9303204 Ender pearls go through End gateways
A thrown ender pearl flew straight through an End gateway: the gateway
passes in game/end.rs only collected dropped items and mobs. Pearls now
join them (EndGatewayBlock.entityInside, Entity.handlePortal): the pearl
lands at the exit with no motion and rotation 0
(EndGatewayBlock.getPortalDestination for a ThrownEnderpearl), waits in
the arrivals queue while the exit loads, keeps its landing chunk loaded
for TicketType.PORTAL's 300 ticks (placePortalTicket), and then takes
its owner where it lands. ThrownEnderpearl.onInsideBlock fires the
owner's enter_block trigger (Remote Getaway), for a guest as them.

Part of #3514.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 14:44:47 +07:00
d3grandoandClaude Opus 5.5 1e8f93a692 Check tame wolf kill credit in the command execution harness
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 14:39:25 +07:00
d3grandoandClaude Opus 5.5 034191391b Credit a tame wolf's kills to its owner
LivingEntity.resolvePlayerResponsibleForDamage: a hit by a tame wolf sets
the victim's last-hurt-by-player to the wolf's owner for 100 ticks, so the
kill drops experience and player-only loot, and the owner, when in the
world, gets ServerPlayer.awardKillScore (mob_kills, totalKillCount, team
kills, player_killed_entity). The killed statistic stays the causing
entity's (Player.killedEntity), so a mob's kill no longer adds it, and
Raider.die's hero and Villager.tellWitnessesThatIWasMurdered, which also
follow the causing entity, skip a kill whose blow came from a mob.

Applied after a mob's melee hit and after /damage with a causing entity.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 14:39:25 +07:00
d3grandoandClaude Opus 5.5 d225a5fdf7 Merge origin/main into fix-3513-cube-hurts-golem
mobs.rs: this branch's MobEvent::CubeHurtMob and main's StabDismount, both kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 14:38:42 +07:00
CocofireHDandHermes Agent 03c8dd0d98 Item names in command feedback follow the item_name component
ItemStack.getDisplayName appends getHoverName, and getItemName prefers the
`minecraft:item_name` component over the item's own name (Item.getName), so
/give and the other item commands name a renamed stack after that component.
stack_display_name only read `custom_name`, so a datapack- or server-renamed
item was reported under its plain item name ("[Diamond]" for a diamond whose
item_name is "ItemName"). Read the component first, as vanilla does.

Co-Authored-By: Hermes Agent (deepseek-v4.1-flash) <[email protected]>
2026-10-30 08:33:54 +01:00
d3grandoandClaude Opus 5.5 e66a24edd4 lan_e2e: pet_death check for the owner's death message
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 14:31:26 +07:00
d3grandoandClaude Opus 5.5 df71f965b0 A tame pet's death tells its owner how it died
TamableAnimal.die sends the owner, when showDeathMessages is on and the
owner is online in any dimension, the pet's CombatTracker.getDeathMessage
("Rex was slain by Zombie"). Horizon's mobs had no combat tracker and
mob_died had no such step, so the owner was never told.

Mobs now keep a CombatTracker (mobs::combat): Mob::damage records each hit
that reaches the health (not one wolf armor takes), LivingEntity.tick's
recheckStatus forgets them after 100 ticks (300 in a fight), and /kill
records its generic_kill hit (LivingEntity.kill). mob_died tells a tame
wolf, cat, parrot or nautilus's owner, the host or a guest by UUID, a
message built by the player's own getDeathMessage code from those hits,
with the kill credit (getKillCredit) and the name of a creeper that blew
up. /damage by a player makes them the mob's lastHurtByPlayer, as
LivingEntity.hurtServer does.

Fixes #3514

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 14:31:26 +07:00
Ludovic Marie bb64067197 Merge pull request #4200 from horizon-rust/fix/suggestions-one-per-tick
🤖 Agent: parity rerun green (the earlier dedicated_server light-layers failure was a load flake); approved by rdbtCVS; no blocking comments. Queued for the merger.
2026-10-30 08:29:23 +01:00
Ludovic Marie cfab69e790 Merge pull request #4233 from horizon-rust/fix/claim-agent-prefix
🤖 Agent: /claim accepts agents' '🤖 Agent:' prefix; 480 Python tests pass.
2026-10-30 08:25:35 +01:00
Ludovic MarieandClaude Opus 5.5 2c526aa767 Load the loot data once when a world opens with the packs world generation used
World generation loads the loot data with no packs while the world is
prepared; opening the world then forgot it and loaded a second copy, which
the generator's copy kept alive beside it (8 MB for the whole run). Now
opening a world keeps the loaded copy when its root and packs are the same.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 08:23:55 +01:00
d3grandoandClaude Opus 5.5 912b671416 Volume sliders play a preview sound on the title screen's options
Vanilla's sound sliders (Options.createSoundSliderOptionInstance) call
SoundPreviewHandler.preview when there is no level: each category plays
its own UI sound at the slider's volume (zombie ambient for Hostile
Mobs, cow ambient for Friendly Mobs, thunder for Weather...), a preview
still playing is not restarted, and moving another category's slider
stops the previous one. Horizon had no preview at all.

Port SoundPreviewHandler (sound_preview.rs), report a changed category
volume from the options screen (Event::Volume, only for a new value as
OptionInstance.set), and play the preview from the game when the
options were opened from the title screen.

Part of #3518.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 14:22:23 +07:00
Ludovic MarieandClaude Opus 5.5 3a11501e23 Dedicated server: bake no block models, which only the renderer draws
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 08:19:39 +01:00
d3grandoandClaude Opus 5.5 3c6999d700 Spectators on a server see through the entity they spectate
ClientboundSetCameraPacket (/spectate, a spectator's click) was decoded as
an unknown packet, so the view stayed on the player while the server kept
that player on the camera entity: the view did not turn with the mob, sat
at the player's eye height inside the mob's body, and the client's own
moves made the server rubber-band it ("moved too quickly").

Follow ClientPacketListener.handleSetCamera / Minecraft.setCameraEntity:
the camera entity's id is kept until the player's own id, a login or a
respawn puts the view back. While another entity is the camera the view
is aligned with it (Camera.alignWithEntity: its head's yaw as
LivingEntity.getViewYRot, its eye height eased by Camera.tick), the entity is not drawn in first person, the pick starts
from its eyes, and the player neither moves nor sends moves
(LocalPlayer.applyInput / sendPosition check isControlledCamera); the
input packet still goes out, so sneaking lets go. A spectator's click
now sends ServerboundSpectatorActionPacket (Minecraft.startAttack,
MultiPlayerGameMode.spectate / spectatorNoAction).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 14:19:25 +07:00
Ludovic Marie d129fb7cfe Merge pull request #3482 from ThatCakeIsAPie/feat/level-shape-3
🤖 Agent: verified on main + this head. I merged main in (through the carried #3481); it merged cleanly. Checks: the 108 harnesses this change can affect, dedicated_server, pr_ready and lan_e2e (light, levels, distance, portals, chest, forced-levels) pass. worldspawn fails only when it runs after levels, on main from before this stack as well: the harness gives the guest its own spawnpoint (#4234), so that isn't this PR. The light flood fill reads the level's column instead of constants: chunk_load_bench main vs this branch gives the same best time for generating and lighting (28.95 ms per column) and the same meshes. Queued to merge; #3483 follows.
2026-10-30 08:19:07 +01:00
Ludovic MarieandClaude Opus 5.5 92e956be80 /claim: accept the "🤖 Agent:" prefix agents put on every comment
Agents start each comment with "🤖 Agent:" (CLAUDE.md), so their
"🤖 Agent: /claim" was never seen: the workflow only started on comments
beginning with /claim, and parse() read the first line as is. rdbt
noticed agents' claims missing (2026-10-30).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 08:16:24 +01:00
d3grandoandClaude Opus 5.5 956bd64c5d Death loot parity: endermen carrying each holdable block
VanillaEntityDeathLootOracle sets the carried block, and the corpus kills
endermen carrying every enderman_holdable block, by a player with
Looting and by generic damage.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 14:11:35 +07:00
d3grandoandClaude Opus 5.5 7a1a5e8e88 Drop a killed enderman's carried block
Enderman.dropCustomDeathLoot rolls the carried block state's own drops
with a diamond axe enchanted by the enderman_loot_drop provider (Silk
Touch I) and spawns them after Monster's equipment drops. Horizon's
death drops never read the carried state, so the block was lost.

mobs::drops::die now yields a CarriedBlock drop in that place, and the
game resolves it through enderman::carried_block_drops (the block's
loot table with the silk touch axe, the enderman as this entity, from
the table's random sequence).

Part of #3513 (the Enderman.dropCustomDeathLoot row).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 14:11:33 +07:00
levzzzandClaude Opus 5.5 186540eb84 parity: give the mob_ai oracle an 8g heap
VanillaMobAiOracle ran out of its 4g heap (OutOfMemoryError: Java heap
space, 34 times in one run) within about 3 minutes of a fresh run on main,
with nothing else running. Runs that reused cached oracle results kept
passing, which hid it until the scenarios changed. With 8g the fresh run
passes in 2.9 minutes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 12:09:41 +05:00
abduvaliy-hbaiandOpenAI Codex 4b14acc1f6 Sync block entity data edits to connected clients
Mark block entity NBT changes dirty and queue an update even when the block state is unchanged, so spawner mob previews refresh after data commands. Add an isolated screenshot regression for zombie/pig/zombie transitions.

Co-Authored-By: OpenAI Codex <[email protected]>
2026-10-30 12:07:20 +05:00
d3grandoandClaude Opus 5.5 16356bdc57 Explosions break paintings, cushions and armour stands
The explosion entity pass only reached players, mobs, items, primed TNT,
minecarts and item frames, so a blast left paintings, cushions and armour
stands standing. Vanilla's ServerExplosion.hurtEntities hurts them too:
BlockAttachedEntity.hurtServer kills a painting or cushion and drops its
item, and ArmorStand.hurtServer with an IS_EXPLOSION source runs
brokenByAnything (its equipment pops, the stand item does not) and kill.
An invisible or marker stand is spared (ArmorStand.ignoreExplosion and
hurtServer), and without mobGriefing a block-keeping or mob-caused blast
spares them all (shouldAffectBlocklikeEntities, the Mob source check);
item frames now share that gate, which also counts a projectile's owner.

Vanilla lists the entities in reach before hurting any, so the items these
entities drop are not caught by the same blast. Frames and the new
decorations now break after the item pass, so their drops survive instead
of being destroyed at once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 14:07:16 +07:00
d3grandoandClaude Opus 5.5 6be3dad37b lan_e2e: tag-query check for an operator guest's F3+I
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 14:05:51 +07:00
d3grandoandClaude Opus 5.5 ef024a082c F3+I copies the server's data on servers and LAN
On a connection (a server, a LAN world, and single player, whose world
runs on its own server thread) F3+I copied the client's partial copy of
the block or mob and called it server-side: a chest lost its items, a mob
its tags and brain. Vanilla's KeyboardHandler.copyRecreateCommand asks the
server through DebugQueryHandler (ServerboundBlockEntityTagQueryPacket,
ServerboundEntityTagQueryPacket) and copies the ClientboundTagQueryPacket
answer to the newest query.

Add the three packets, the query state on the connection and its answer,
and the server side for guests (ServerGamePacketListenerImpl
.handleBlockEntityTagQuery and handleEntityTagQuery, for game masters
only). Part of #3520 (its handleBlockEntityTagQuery and
handleEntityTagQuery rows).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 14:05:51 +07:00
d3grandoandClaude Opus 5.5 e9eda298fd Complete chat with the server's custom chat completions
ClientboundCustomChatCompletionsPacket was only an id constant, so the
names and tags proxies and plugins add with it (players on other backend
servers, chat tags) never showed when Tab completes chat. Decode it, keep
the connection's set like ClientSuggestionProvider.modifyCustomCompletions
(ADD, REMOVE, SET; an unknown action id is ADD), clear it on a
reconfiguration, and complete chat from getCustomTabSuggestions: the
players and the custom completions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 14:05:27 +07:00
Ludovic MarieandClaude Opus 5.5 c8ee23f2b8 Keep no face shapes from the load-time passes over the collision and support tables
analyse_shape and the cached support flags computed every shape's six faces
through face_shape, which caches them on the shape for good: about 39 MB that
nothing reads again. They now use face_shape_transient; runtime queries still
cache.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 08:04:59 +01:00
d3grandoandClaude Opus 5.5 958522ce67 Let armadillos breed, follow spider eyes and their parents
ArmadilloAi.initIdleActivity runs AnimalMakeLove(1.0), then a RunOne of
FollowTemptation(1.25, armadillo_food, close enough at 1 block for a
baby and 2 for an adult) and BabyFollowAdult(5..16, 1.25). The
armadillo's goals had none of them, so spider eyes gave hearts but no
baby, armadillos ignored a player holding them, and babies wandered off.

Add Breed, Tempt and FollowParent, each wrapped so that it only runs in
the IDLE activity: not while ArmadilloAi.updateActivity picks PANIC
(danger in mind and not panicking) and not while it is a ball.

Part of #3512

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 14:03:02 +07:00
levzzz b1dfde280b Merge pull request #3948 from kacpherek/fix/split-spear-ai-golem
Mobs use spears; iron golems keep to their village
2026-10-30 12:00:15 +05:00
d3grandoandClaude Opus 5.5 84ac601f3a Slimes and magma cubes hurt the iron golems they touch
AbstractCubeMob.push(entity) calls dealDamage on an IronGolem whose
pushEntities takes the cube, but Horizon only ported the playerTouch path,
so cubes chased golems (they target them) without ever hurting them.

The cube's ai_step now hits every alive iron golem whose box overlaps its
own (EntitySelector.pushableBy, doTeamsAllowDamage, hasLineOfSight) for
getAttackDamage with a mobAttack source, unless the cube cannot deal damage
(a tiny slime, or a NoAI cube, which is not isEffectiveAi). A new
CubeHurtMob event plays entity.slime.attack only when the hit landed, as
dealDamage does after hurtServer; its two pitch draws from the cube's
random happen even for a silent cube.

Part of #3513.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 13:59:53 +07:00
d3grandoandClaude Opus 5.5 aff1d9864f The mount a rider's client moves ignores the server's moves of it
ClientPacketListener.handleMoveEntity and handleEntityPositionSync leave
an entity the client is authoritative for where it is; only
handleTeleportEntity puts it somewhere else, at once. The steps the
server's moves queued while the rider drove the horse replayed after the
dismount: the horse jumped back about five blocks on a vanilla server.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 13:59:23 +07:00
levzzzandClaude Opus 5.5 1bd934d3fb Merge main into fix/split-spear-ai-golem
lan.rs: keep both the spear hit event (2) and main's fox eating event (45).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 11:51:46 +05:00
hhamajandClaude Opus 5.5 2d41c9d432 A pearl turns the wind charge it hits, which then speeds up
Projectile.onHit calls onRedirectProjectile on a redirectable target:
AIM_DEFLECT along the thrower's look, the thrower its owner, acceleration
power 0.1. #3599 made the pearl teleport but left the charge as it was.
A wind charge now runs applyInertia (power 0, inertia 1 in and out of
water), so the power it gets from the turn takes effect.

The harness needs a still charge the pearl can't miss, so /summon and
saved worlds now load both wind charges, and selectors see them.

Fixes #3299

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 09:51:13 +03:00
levzzzandClaude Opus 5.5 03498ad1c7 Merge main into fix/split-spear-ai-golem
piglin.rs: keep main's piglin/hoglin brain memories and add this branch's spear memories to them; the fight activity keeps the spear behaviours before the melee one and main's NotRiding repellent goal; piglin_pose_holding takes both main's passenger flag and the spear.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 11:50:00 +05:00
levzzz fbd7288a1d Merge pull request #3949 from kacpherek/fix/split-mob-sounds-behaviour
Mob sounds and behaviour: fox, zoglin, turtle, iron golem, sheep, cat, nautilus, pig and more as vanilla
2026-10-30 11:48:46 +05:00
levzzz 6966a69d36 Merge pull request #3946 from kacpherek/fix/split-agelock-goat-allay
Goats long jump between ledges, golden dandelions lock a baby's growth, allays remember a note block
2026-10-30 11:48:36 +05:00
Ludovic Marie e4fb44e067 Merge pull request #4185 from horizon-rust/fix/guest-inbox-cap
🤖 Agent: all checks green on 5a017c900 (inbox capped in packets and bytes; A/B in the description). Queued.
2026-10-30 07:45:06 +01:00
levzzzandClaude Opus 5.5 0c441c9009 Merge main into fix/split-mob-sounds-behaviour
ai.rs: main's piglin_ambient/hoglin_ambient now pick the angry and retreat sounds from the brain's activity; keep those and add this branch's zoglin angry sound.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 11:41:48 +05:00
Ludovic Marie c48d6773c5 Merge pull request #3481 from ThatCakeIsAPie/feat/level-shape-2
🤖 Agent: verified on main + this head. I merged main into the branch: the crate split had moved chunk.rs to horizon-client-render, so the LevelShape helpers this PR uses from save.rs are pub now and LevelShape::for_dir sits beside the type (an impl in horizon-client on a type of horizon-client-render no longer compiles). Checks: the 108 harnesses this change can affect, dedicated_server, pr_ready and lan_e2e (light, levels, distance, worldspawn, portals, chest, forced-levels) pass. chunk_load_bench main vs this branch: same meshes (checksum), mesh time unchanged (42.0–44.2 vs 42.7–43.2 µs per section). Queued to merge; the rest of the level-shape stack follows in order.
2026-10-30 07:41:33 +01:00
levzzz 2160cd016a Merge pull request #3791 from xFedeT/fix/flyers-scan
Ghast: target position, move control timing, look angle and shot sounds as vanilla
2026-10-30 11:39:28 +05:00
levzzz a99ef86dc6 Merge pull request #3942 from kacpherek/fix/split-piglin-hoglin
Piglins and hoglins retreat, retaliate, grunt and ride like vanilla
2026-10-30 11:39:12 +05:00
d3grandoandClaude Opus 5.5 699fae6296 Riders move their horses on servers, and jump them
On a vanilla or Paper server the controlling passenger's client moves a
saddled horse, donkey, mule or camel (Entity.isLocalInstanceAuthoritative,
LivingEntity.travelRidden), reports it with ServerboundMoveVehiclePacket and
sends START_RIDING_JUMP on a released jump (LocalPlayer.sendRidingJump). The
server only turns it (travelRidden without canSimulateMovement). Horizon's
client only charged the jump bar and waited for the server to move the
horse, so on those servers the horse never moved nor jumped (#2920).

The client now ticks the mount it controls with the rider's input, takes
its synced speed and jump strength, sends its moves and the riding jump, and
puts it back on the server's ClientboundMoveVehiclePacket. Horizon's own
server (single player's server thread, LAN, dedicated) accepts a guest's
MoveVehicle for its horse with handleMoveVehicle's checks, only turns the
horse on its tick, and syncs a horse's rolled jump strength.

Fixes #2920

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 13:37:32 +07:00
Ludovic Marie 37f449f91f Merge branch 'pt1-3490' into pt1-3491 2026-10-30 07:33:51 +01:00
d3grandoandClaude Opus 5.5 9bdb5ec7fd List worlds with an unreadable level.dat and offer recovery
A world whose level.dat could not be read (cut short by a crash during a
save, say) was left out of Select World, although level.dat_old would load
it, so the player believed the world was gone.

list_worlds now follows LevelStorageSource.findLevelCandidates and
readLevelSummary: any folder with a level.dat or level.dat_old is a world,
and when level.dat does not read it is listed as a CorruptedLevelSummary
(the folder name, red "Failed to load world summary", "Attempt to Recover";
Edit and Re-Create off). Opening it, like any world whose level.dat does
not read (WorldOpenFlows.openWorldLoadLevelData), shows
RecoverWorldDataScreen with the state of level.dat and level.dat_old
(collectIssue/buildInfo); Attempt to Restore runs restoreLevelDataFromOld
(the broken file kept as level.dat_corrupted_<time>) and ends on the
"Recovery done" confirm or failure alert. Before, opening such a world from
the list could not happen, and opening one with nothing readable would have
started a fresh level in its folder.

Part of #3517

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 13:33:33 +07:00
d3grandoandClaude Opus 5.5 9432147489 A chat message the server deletes becomes the deleted marker
ClientboundDeleteChatPacket (31) was only a constant: Horizon never decoded
it, and the PlayerChat handler dropped the signature a deletion names a
message by, so a line a moderation plugin deleted stayed on screen.

Decode the packet (MessageSignature.Packed), keep the connection's
MessageSignatureCache (unpack the last seen of each PlayerChat, then push it
and the signature, as ClientPacketListener.handlePlayerChat does), and keep
each player message's signature in the chat. handleDeleteChat: a message
still held back by Chat Delay never shows (removeFromDelayedMessageQueue);
a shown one becomes the grey italic chat.deleted_marker line once it has
shown 60 ticks (ChatComponent.deleteMessageOrDelay, with the delayed queue
ChatComponent.tick processes). An unknown packed id disconnects with
multiplayer.disconnect.invalid_packet, as vanilla does.

Fixes #3518

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 13:30:38 +07:00
Ludovic MarieandClaude Opus 5.5 c3601b74f3 Server: the game thread is the keep-alive timeout's only judge; kick, then close a second later
The writer thread's own check raced it and logged "Disconnected" instead of
vanilla's "Timed out".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 07:30:07 +01:00
Ludovic Marie 824953813a Merge branch 'pt1-3489' into pt1-3490 2026-10-30 07:29:40 +01:00
Ludovic Marie 04cbf91533 Merge branch 'pt1-3488' into pt1-3489 2026-10-30 07:29:25 +01:00
Ludovic MarieandClaude Opus 5.5 3b584979a8 Merge main (through the carried #3487) into level-shape-9
Keeps both sides: main's world_root and LAN online mode beside the level
shapes, and main's content-identity check before the registry packets,
which now carry the levels' dimension types.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 07:27:48 +01:00
d3grandoandClaude Opus 5.5 d5fd62c298 Merge origin/main into fix-2755
game/explosion.rs: main's new interaction parameter for explosion_hurt_entities and this branch's returned player pushes are both kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 13:25:00 +07:00
Ludovic MarieandClaude Opus 5.5 265bb903d7 Merge main (through the carried #3486) into level-shape-8
The crate split moved chunk.rs, collisions.rs and world.rs to
horizon-client-render: this commit's changes are reapplied there.
render_tick.rs keeps main's heightmap reads for rain splashes, with the
world's bottom in place of MIN_Y; main's section_mesh_pending (moving
pistons) keys sections from the level's column as well.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 07:24:36 +01:00
d3grandoandClaude Opus 5.5 3891dd9410 Break sound and crumbs for equipment a server says broke
A vanilla server never plays an item's break itself:
LivingEntity.onEquippedItemBroken broadcasts the entity event that
entityEventForEquipmentBreak gives for the slot (47 main hand, 48 off
hand, 49 to 52 head to feet, 65 body, 68 saddle) and each client's
LivingEntity.handleEntityEvent runs breakItem on the stack it still has
in that slot. The remote client had no case for these events, so on a
server a breaking pickaxe, armour piece or wolf armour was silent and
left no crumbs, for this player and for everyone else.

Handle them: find the stack in the slot (the own inventory, or the
mob's or other player's equipment), play its break_sound component at
the entity's feet unless the entity is silent, and spawn the five item
crumbs of spawnItemParticles. Entity.DATA_SILENT is now kept for
remote entities so the silent check works.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 13:22:55 +07:00
Ludovic Marie 68f036059e Merge pull request #4181 from horizon-rust/tools/bots-abusive-client
🤖 Agent: all checks green on 6edf1ff46 (horizon-bots only, skip-release). Queued.
2026-10-30 07:22:09 +01:00
Ludovic MarieandClaude Opus 5.5 0b73217d3d Merge main (through the carried #3485) into level-shape-7
The crate split moved chunk.rs, lod.rs and minimap.rs to
horizon-client-render: this commit's changes are reapplied there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 07:22:02 +01:00
d3grandoandClaude Opus 5.5 1dd92e5f84 Drowned, zombie and stray conversions keep gear, name and flags
Zombie to drowned, husk to zombie and skeleton to stray spawned a fresh,
spawn-finalized mob through MobEvent::SpawnKind with only baby, yaw and
persistence, so the old mob's armour, held items, name tag, effects,
NoAI/Silent and lead were lost (a name-tagged zombie that drowned came
back as an unnamed drowned).

Vanilla's ConversionTracker.doConversion calls Mob.convertTo(type,
ConversionParams.single(this, true, true)): ConversionType.SINGLE and
convertCommon copy all of that onto a mob made without finalizeSpawn,
and Zombie's tracker then runs handleAttributes(special, CONVERSION).
mobs/conversion.rs ports SINGLE + convertCommon, the undead conversions
emit a new MobEvent::Convert carrying the old mob, and Game::convert_to
builds the new mob from it, moves riders onto it and rolls the zombie
attributes. The conversion sound is skipped for a silent mob, as the
level event is.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 13:20:25 +07:00
Ludovic MarieandClaude Opus 5.5 99998b9f3c Merge main (through the carried #3484) into level-shape-6
Keeps main's mobs imports in save.rs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 07:20:00 +01:00
Ludovic MarieandClaude Opus 5.5 c2db12a1a0 Merge main (through the carried #3483) into level-shape-5
Keeps main's mobs imports in save.rs. LevelShape::for_dir, which the
carried #3481 moved to chunk.rs for the crate split, goes as this
commit removes it: SaveDir::new takes the level's shape instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 07:19:04 +01:00
d3grandoandClaude Opus 5.5 350d5dbe2d Send and handle ClientboundChunksBiomesPacket so /fillbiome recolours loaded chunks
/fillbiome changed the server's biomes but no client was told: the packet
existed only as an id, the server never sent it and the client had no
handler, so grass, leaves and water kept the old colour until the column
was sent again (single player on its server thread, LAN guests, dedicated
servers).

- horizon-protocol: ChunksBiomes / ChunkBiomeData
  (ClientboundChunksBiomesPacket.STREAM_CODEC: ChunkPos long, byteArray
  of 2 MiB holding each section's biome container).
- Server: cmd_fillbiome calls Hub::resend_biomes with the changed columns
  in FillBiomeCommand's z-then-x order (ChunkMap.resendBiomesForChunks:
  one packet per player in the level, with the columns it was sent).
- Client: handleChunksBiomes replaces the loaded column's biomes
  (ClientChunkCache.replaceBiomes / LevelChunk.replaceBiomes) and marks
  every section of it and its eight neighbours dirty (setSectionDirty).

Part of #3518 (ClientPacketListener.handleChunksBiomes)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 13:18:50 +07:00
DenisHumenandClaude Opus 5.5 dcd86510f5 Frogs walk their legs at vanilla's rate
Frog.updateWalkAnimation overrides the base: the walk target is
min(distance * 25, 1), and 0 while the jump animation is started.
Horizon used the generic min(distance * 4, 1), so a frog's slow steps
barely moved its legs.

Fixes #2848

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 08:18:47 +02:00
d3grandoandClaude Opus 5.5 91aa9c790f Get off a strider onto the shore, not into the lava beside it
Dismounting used one rule for every mount: a spot either side of the
mount's body, then its back, checking only for full blocks at the feet
and head. Getting off a strider on a lava lake put the rider beside it in
the lava even when the shore was in front of them.

Strider.getDismountLocationForPassenger: walk the columns along the
rider's facing and 22.5 and 45 degrees either side
(Entity.getCollisionHorizontalEscapeVector), from the top of the
strider's box down to half a block below its feet; skip lava, keep blocks
with a valid floor (BlockGetter.getBlockFloorHeight,
DismountHelper.isBlockFloorValid) where a standing, crouching or
crawling box fits (Player.getDismountPoses, DismountHelper.canDismountTo),
and take that pose. With none, land on top of the strider.

The block collision shape and canDismountTo move out of the respawn
anchor's safe-location check so both share them.

Part of #3513.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 13:17:31 +07:00
repositorykreml1nandCodex b87f65b1b6 TNT: cover client replay and preserved server duplication
Add four regression tests for issue #3856: client neighbor updates and placement leave TNT alone, server priming is not limited per tick, and a piston duper retains its TNT block while creating exactly one server entity and no client entity.

Verified against nightly-2026-10-29-4baa571 with prepared Java 26.3 resources.

Co-Authored-By: Codex <[email protected]>
2026-10-30 09:17:05 +03:00
Ludovic MarieandClaude Opus 5.5 0c149c7d1c Merge main (through the carried #3482) into level-shape-4
The crate split moved gfx.rs, gfx/resident.rs, mesher.rs, streaming.rs and
world.rs to horizon-client-render: this commit's changes are reapplied there.
World::set keeps main's narrower remesh marking (only the sections a write
can reach) with the chunk's own min_y and section count.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 07:15:27 +01:00
repositorykreml1nandCodex df1a26d2bd TNT: prime powered blocks only on the server
Match vanilla TntBlock.prime: client-side piston replay must not create a second primed TNT or remove its block. Server-side TNT duplication remains unchanged.

Refs horizon-rust/horizon#3856.

Co-Authored-By: Codex <[email protected]>
2026-10-30 09:14:38 +03:00
arismoko 05275d7682 Expose native server block change observations 2026-10-30 01:13:03 -05:00
arismoko 907b5729b1 Expose native neighbour-change observations 2026-10-30 01:13:03 -05:00
arismoko c2670e7bd2 Expose read-only native server block queries 2026-10-30 01:13:03 -05:00
arismoko 2a6ae514f8 Expose native server tick hooks 2026-10-30 01:13:03 -05:00
Ludovic MarieandClaude Opus 5.5 5fb90b440c Server: time out a client that stops answering keep-alives, even while its writer is blocked
The writer thread sent and checked the keep-alives; a client that stopped
reading blocked it in a write, so it was never timed out and held its slot.
The game thread now checks the keep-alive clock once a second and closes the
socket, which ends the blocked write.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 07:11:58 +01:00
d3grandoandClaude Opus 5.5 e445e0edf6 Spectating players are tracked only by other spectators
ChunkMap.TrackedEntity.updatePlayer pairs an entity with a player only
when Entity.broadcastToPlayer allows it, and ServerPlayer's override hides
a spectator from every player who is not a spectator (a spectating viewer
sees a player whose camera is its own, which a LAN guest's always is).
The hub's tracker had no such check, so a guest in spectator mode stayed
paired with everyone: its AddEntity, equipment and nametag still reached
the other players, and their crosshair still picked it.

Player states now carry whether the player is a spectator, viewers too,
and the pair check follows broadcastToPlayer. Going in or out of spectator
mode checks the player's pairs again (vanilla's ChunkMap.move does it at
the player's next move), so the others lose it, or get it back with its
armour, at once.

Part of #3520

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 13:08:40 +07:00
d3grandoandClaude Opus 5.5 4f03c8a873 Time out a server that stops answering, with vanilla's disconnect reasons
The multiplayer connection only had a connect timeout: once joined, a
server that froze or dropped off the network without a TCP reset left
the player in a frozen world forever. Vanilla's client channel starts
with ReadTimeoutHandler(30) (Connection$1.initChannel), so the client
socket now gets a 30 s read timeout.

A lost connection also showed Horizon's raw error text (on Windows the
localized OS message). Connection.exceptionCaught's reasons replace it:
disconnect.timeout ("Timed out") for the read timeout,
disconnect.genericReason ("Internal Exception: ...") for any other
failure, and disconnect.endOfStream when the server closed the stream
(Connection.channelInactive). The integrated server's in-memory pipe
keeps no timeout, as vanilla's local channel has none.

Part of #3520 (Connection#exceptionCaught).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 13:08:10 +07:00
Ludovic Marie bd9b325872 Merge pull request #3674 from d3grando/fix-3129
🤖 Agent: Ludovic's AI agent (Claude), proof. With your check fix (one loaf each, bites read once they settle), `lan_e2e` `eating` and `eat` pass 2 runs out of 2 on the server thread and 2 out of 2 `--in-frame`. That was in a union with #3706 and #3551 merged into main at a6aa6a071: 111 of 112 affected harnesses passed, none failed, and clippy and the tests passed. Queued.
2026-10-30 07:07:53 +01:00
Ludovic Marie b51637616b Merge pull request #3706 from arismoko/upstream/native-lifecycle
🤖 Agent: Ludovic's AI agent (Claude), proof. Thanks for taking up the review points (the context now carries only authority and epoch, and the crash paths are documented). This head was in a union with #3674 and #3551 merged into main at a6aa6a071. `pr_ready`: 111 of 112 affected harnesses passed, none failed; the 112th is the LAN suite, which runs by name only. clippy passed, and 1541 tests passed. `lan_e2e` (chest, eat, eating) passes twice on the server thread and twice `--in-frame`. Your container proof covers the dedicated runs and identical saves. Queued.
2026-10-30 07:04:11 +01:00
Ludovic MarieandClaude Opus 5.5 5a017c9006 lan_bot: queue test packets with their size
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 07:02:33 +01:00
Ludovic Marie c18e893143 Merge branch 'pt1-3481' into pt1-3482 2026-10-30 06:46:22 +01:00
Alexander KrylovandHermes Agent ccb85be48e Launcher: a version stops counting as installed when its removal starts
backend::remove dropped the .installed marker whenever remove_dir_all reached it,
so a second removal finishing first re-read installed and put the half-deleted
version back in the list that selection_after_removal and Play read.

Co-Authored-By: Hermes Agent (Nous Research) <[email protected]>
2026-10-30 08:38:06 +03:00
Ludovic MarieandClaude Opus 5.5 b9f8ea2f27 Server: answer one command suggestion request a tick, the latest (ServerCommandSuggestionsProvider)
A client asking 100 times a tick took the server to 16 TPS: every request was parsed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 06:33:55 +01:00
Ludovic MarieandClaude Opus 5.5 536c3b90fd LevelShape helpers are pub, and for_dir sits beside the type
Since the crate split, chunk.rs is in horizon-client-render while save.rs
(horizon-client) reads min_section, section_count, has_section and
for_dir, so they are pub and for_dir moves out of save.rs's impl block.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 06:33:02 +01:00
Kacpherek 0917285a33 Merge remote-tracking branch 'origin/main' into fix/split-misc-a 2026-10-30 06:32:04 +01:00
Kacpherek b886586ca6 Merge remote-tracking branch 'origin/main' into fix/split-misc-a
# Conflicts:
#	crates/horizon-client/src/entity_nbt.rs
#	crates/horizon-client/src/game.rs
#	crates/horizon-client/src/game/advancements.rs
#	crates/horizon-client/src/game/allays.rs
#	crates/horizon-client/src/game/armor_stands.rs
#	crates/horizon-client/src/game/lan_actions.rs
#	crates/horizon-client/src/game/remote_projectiles.rs
#	crates/horizon-client/src/mobs/leash.rs
2026-10-30 06:32:04 +01:00
Ludovic MarieandClaude Opus 5.5 4abef77bba Server: cap a player's waiting packets in bytes too (16 MB)
400 full books a tick passed the packet count while holding hundreds of MB.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 06:31:48 +01:00
Kacpherek 2061f797ba Share stand_if_possible between the rear goal and the rider's jump 2026-10-30 06:31:44 +01:00
Kacpherek 3f690a811c Walk a camel's legs only while it stands and does not dash
A camel's legs used the default walk: they kept swinging while it sat or dashed and eased in at 0.4. Camel.updateWalkAnimation aims at 6 times the distance moved (at most 1) only in the standing pose with no dash animation running, otherwise at zero, and eases at 0.2. The remote client's own walk update uses it for camels too.
2026-10-30 06:31:39 +01:00
Kacpherek 381e2e9a84 Stand a sitting camel up when its lead pulls taut
A leashed sitting camel stayed down however hard the lead pulled. Camel.onElasticLeashPull stands it up when it is sitting, not changing pose, and the standing box fits where it is (canCamelChangePose, wouldNotSuffocateAtTargetPose). AbstractHorse.onElasticLeashPull, which it calls first, also ends a horse's grazing.
2026-10-30 06:31:39 +01:00
Kacpherek f4b7a899b8 Let a horse slide on the rider's keys after a jump while it rears
A horse that landed from a small hop while still rearing ignored the keys until the rear ended, and a donkey or mule never reared on a jump. AbstractHorse.onPlayerJump sets allowStandSliding and calls standIfPossible (every horse that can rear), getRiddenInput only zeroes the input while the horse is standing on the ground without a jump pending and without allowStandSliding, and tick clears it once the horse stands no more.
2026-10-30 06:31:39 +01:00
Kacpherek dff7cc1dda Slide a rider back and up while its horse rears
A horse, donkey, mule or undead horse that reared kept its rider at the fixed seat. AbstractHorse.getPassengerAttachmentPoint adds (0, 0.15, -0.7) times the previous tick's stand animation (standAnimO) to the seat, turned with the horse. The player and a mob rider both slide.
2026-10-30 06:31:39 +01:00
Kacpherek fa27fb4088 Seat camel riders by the camel's sit and stand animation
The rider's seat on a camel was a fixed height for sitting and standing, built from the old full-height box, and a mob rider sat at the top of the box when the camel sat. Camel.getPassengerAttachmentPoint takes the body anchor from the current pose box and lerps it through the sit and stand transitions (getBodyAnchorAnimationYOffset), at the camel's age scale. The player and a mob rider both use it now.
2026-10-30 06:31:39 +01:00
Kacpherek d59d8e7147 Shrink a sitting camel's hitbox to its sitting size
A camel that sat down kept its standing box, so it blocked and was hit as if it still stood. Camel.getDefaultDimensions gives Pose.SITTING an adult box 1.43 lower with eyes at 0.845, and a baby box 0.425 tall with eyes at 0.41. Mob::awake_dims now follows the camel's synced pose, on the server and on a client.
2026-10-30 06:31:39 +01:00
Kacpherek b2ba13377b Hurt a llama and its riders only for falls of six blocks
A llama landed with the generic fall sound and hurt on any damaging fall. Llama.causeFallDamage makes no fall sound, and hurts the llama and hands the fall to its riders only when the fall is six blocks or more.
2026-10-30 06:31:39 +01:00
Kacpherek 3379afe807 Pass a mount's fall damage on to its riders
A rider took no damage when the mob under it landed hard, and a mob on a mount's back never felt it either. Entity.propagateFallToPassengers hands the fall to every passenger (LivingEntity.causeFallDamage first, AbstractHorse.causeFallDamage after its own hurt and only when hurt), and each passenger runs its own causeFallDamage with its own safe distance. A mount now raises a fall event the game turns into Player.causeFallDamage for the local player and server players, and the mob causeFallDamage for a mob rider.
2026-10-30 06:31:30 +01:00
Ludovic Marie bc3383d1bf Merge remote-tracking branch 'origin/main' into pt1-3481 2026-10-30 06:31:05 +01:00
Ludovic Marie b76ae35f5b Merge pull request #3480 from ThatCakeIsAPie/feat/level-shape-1
🤖 Agent: pr-triage-1 (Ludovic's AI agent, Claude), not Ludovic himself. I merged main into this branch (eb3f03d7f, a merge commit, fast-forward). The only conflict was `lib.rs`'s re-export list: `section_mask` now sits beside main's `potent_sulfur` and `split_layout`. The full proof the orchestrator asked for, on this head merged into today's main: - the 121 vanilla harnesses this branch can reach pass, and `dedicated_server` too; - pr_ready passes; - lan_e2e passes on the server-thread host: light, levels, distance, portals, chest, forced-levels and worldspawn. In-frame is deprecated now. worldspawn failed once on timing, then passed 2/2. Speed: the masks only grow from 4 to 32 bytes, in per-section bookkeeping (dirty sections, the light log, LOD detail columns). There is no allocation and no per-block work, so frame and tick costs stay the same. Queued for merge. #3481 comes next, once this one is in.
2026-10-30 06:30:54 +01:00
Kacpherek 1a4ee0e7ee Release the probe lock when a world is checked for being open elsewhere
Checking a world on the title screen takes the session lock for an instant; hand it back explicitly, as SessionLock does, so a quit world is never listed as locked. Drop the stale note that powder snow climbing is not ported for rabbits.
2026-10-30 06:30:14 +01:00
Kacpherek 1e5aaec352 Skip the note block head sound on a client level 2026-10-30 06:29:39 +01:00
Kacpherek 360582703d Merge origin/main into fix/split-rendering 2026-10-30 06:29:18 +01:00
Kacpherek cb0be4adbe Merge remote-tracking branch 'origin/main' into fix/split-misc-b
# Conflicts:
#	crates/horizon-client/src/game/remote_mob_data.rs
#	crates/horizon-client/src/game/remote_projectiles.rs
2026-10-30 06:28:40 +01:00
Kacpherek 43777b9d16 Stub the redstone ore dust in the remote mining fixture 2026-10-30 06:28:23 +01:00
Kacpherek ef917292ed Merge remote-tracking branch 'origin/main' into fix/split-blocks
# Conflicts:
#	crates/horizon-client/src/game/remote.rs
2026-10-30 06:28:07 +01:00
Ludovic Marie c6bf75b3b1 Merge pull request #3740 from UMCEKO/mods/oracle-item-components
🤖 Agent: Ludovic's AI agent (Claude), proof. The real NeoForge pack test above covers this PR's exporter. On a 3-mod pack it wasn't developed against, the exported item facts matched 52 of 52 values read with vanilla's own commands on the same server, without the exporter. CI verify is green. Queued, first in the stack's order.
2026-10-30 06:21:42 +01:00
Ludovic Marie 08e7c00806 Merge remote-tracking branch 'origin/main' into upd-3721
# Conflicts:
#	tools/test_mob_ai_parity.py
2026-10-30 06:14:43 +01:00
Ludovic Marie a6aa6a071a Merge pull request #4142 from horizon-rust/perf/idle-generator-scratch
🤖 Agent: verified by server-tick-1. A chunk worker idle for 5 s frees its generator's density scratch and lookup caches (caches only, results unchanged), and the last idle worker returns freed memory to the OS once; −71 MB idle RSS on Linux. pr_ready green.
2026-10-30 06:10:05 +01:00
levzzzandClaude Opus 5.5 c9a87963ef Merge main into fix/split-agelock-goat-allay
frog.rs: keep the goat jump cooldown and main's vanilla memory id long_jump_cooling_down.
remote_mob_data.rs: keep the tadpole AGE_LOCKED line beside main's mooshroom comment.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 10:07:25 +05:00
Ludovic MarieandClaude Opus 5.5 6edf1ff467 horizon-bots: costly floods (use, click, suggest, book, sign, recipe) and --no-read
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 05:58:24 +01:00
levzzz 33f417fb32 Merge pull request #4051 from d3grando/fix-3199
A camel and the husk on its back no longer push each other
2026-10-30 09:55:26 +05:00
Ludovic Marie ee883db4b9 Merge pull request #4117 from horizon-rust/perf/shared-advancement-tree
🤖 Agent: verified by server-tick-1, after merging main. ServerAdvancements and the game's criteria share one advancement tree (Tree::shared, Weak-held) when the world's packs bring no advancement files; with pack advancements each loads its own, as main does. −9 MB idle RSS on Linux. pr_ready green.
2026-10-30 05:55:06 +01:00
My NameandClaude Opus 5.5 7e6da998fa README: the creative toolbar keys are wired
The known issues still said C/X aren't wired to the hotbar loader; they are
since 85f34393f (game/creative_hotbar.rs), and #3693 added the Saved Hotbars tab.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 07:52:38 +03:00
levzzz f11bbea3b1 Merge pull request #3881 from TJKDev1/fix/own-head-pitch-follows-mouse
Third person: the player's head pitch follows the mouse between ticks
2026-10-30 09:48:58 +05:00
My NameandClaude Opus 5.5 dbce6420c6 Command blocks: one data path; the command reaches only the player who opens it
#3582 and #3748 fixed the same bug (#3614) twice. The server now sends the
command only through `lan_open_command_block` (ServerPlayer.openCommandBlock),
no longer in every chunk and block update (CommandBlockEntity keeps the empty
getUpdateTag), and the open edit screen refreshes its fields in one place
(CommandBlockEditScreen.updateGui). docs/rust-parity.md: the toolbar keys and
the Saved Hotbars tab are wired since #3693.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 07:44:42 +03:00
levzzzandClaude Opus 5.5 bb0bf9e1c8 Pass PackOverlay::NONE to Items::load in the same-vehicle push test
Main added a PackOverlay argument to Items::load after this branch was written.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 09:44:29 +05:00
levzzz a6a734da85 Merge commit 'refs/pull/4051/head' of https://github.com/horizon-rust/horizon into HEAD 2026-10-30 09:39:36 +05:00
levzzzandClaude Opus 5.5 3b82d4770f Merge main into fix/own-head-pitch-follows-mouse
Keeps both look_at_rotation (main) and position_packet_pitch (this branch) in remote.rs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 09:39:17 +05:00
Ludovic MarieandClaude Opus 5.5 fa50f136fe Server: disconnect a player whose packets pile up past a second of its budget
The per-player inbox had no limit: a client sending 10 000 packets a tick
grew the server by about 1 GB a minute (#4179).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 05:38:59 +01:00
Ludovic MarieandClaude Opus 5.5 eb3f03d7f3 Merge main into this branch (split_layout and potent_sulfur re-exports)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 05:38:07 +01:00
Ludovic Marie 061751a023 Merge pull request #4095 from horizon-rust/carry/fusseltv-idle-spawn-area
🤖 Agent: pr-triage-1 (Ludovic's AI agent, Claude), not Ludovic himself. Proof of this head merged into today's main (101d3b0be, which now has #3300, #2698 and #3802): - the 108 vanilla harnesses this branch can reach pass, `dispenser` and `dedicated_server` included; - pr_ready passes; - lan_e2e passes: worldspawn, forced-levels, distance, spawned, levels, light, mobs. Queued for merge.
2026-10-30 05:33:12 +01:00
Ludovic Marie 5851a80ce0 Merge pull request #3735 from xFedeT/fix/zombified-piglin-turtle-egg-goal
🤖 Agent: Ludovic's AI agent (Claude), triage. #3712 landed with a mob_ai case of its own, so I merged main into your branch again (no rebase). The only conflict was the case list in `tools/test_mob_ai_parity.py`, and both sides are kept. `parity.py mob_ai` passes on main with this and #3721/#3735 merged. Requeued.
2026-10-30 05:24:41 +01:00
Ludovic Marie bf6c0b8a24 Merge pull request #4078 from horizon-rust/perf/shared-face-visibility
🤖 Agent: the parity rerun is green (dedicated_server's ender pearl step passed; the 03:10 failure was load). Requeued, same head.
2026-10-30 05:19:39 +01:00
Ludovic Marie 05f5c2197b Merge pull request #4092 from horizon-rust/perf/shared-feature-block-tags
🤖 Agent: verified by server-tick-1. Worldgen binds the feature block tags once (GeneratorData::feature_block_bindings) and shares them through Arcs; the maps' readers are unchanged, so decoration gives the same result. −11.6 MB allocated on the dedicated server. pr_ready green; parity 152/153, the failing dispenser case comes from main (golem PRs #4022/#3959), not from this change.
2026-10-30 05:17:46 +01:00
Ludovic MarieandClaude Opus 5.5 3ffa45a5cf horizon-bots: flood-chunks climbs to cruising height first
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 05:17:03 +01:00
Ludovic Marie 05114a3673 Merge remote-tracking branch 'origin/main' into upd-3735
# Conflicts:
#	tools/test_mob_ai_parity.py
2026-10-30 05:14:03 +01:00
Ludovic Marie 9ee6b293d4 Merge remote-tracking branch 'origin/main' into upd-3721
# Conflicts:
#	tools/test_mob_ai_parity.py
2026-10-30 05:14:02 +01:00
Ludovic MarieandClaude Opus 5.5 d322e068e2 horizon-bots: flood-chunks, one legal move a tick that never waits for chunks
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 04:54:54 +01:00
Ludovic Marie df583d34af Merge pull request #4056 from DUzzL/fix/issue-4037-armadillo-campfire
🤖 Agent: merging DUzzL's campfire contact damage for mobs (tested in game on both single-player paths: armadillos, cows and sheep burn on lit campfires, Infested spawns silverfish). Thanks!
2026-10-30 04:49:27 +01:00
Ludovic Marie 737657443d Merge pull request #3712 from xFedeT/fix/villager-grows-up-brain
🤖 Agent: Ludovic's AI agent (Claude), triage. #3729 landed with mob_ai cases of its own. I merged main into your branch (no rebase). The only conflict was where the new cases go in `tools/test_mob_ai_parity.py`, and both sets are kept. The Rust merged clean, so the proof above still holds. Requeued at the merged head.
2026-10-30 04:44:09 +01:00
Ludovic Marie 101d3b0bec Merge pull request #3773 from xFedeT/fix/cat-goals
🤖 Agent: Ludovic's AI agent (Claude), proof. This PR was in a union of five mob PRs (#3712, #3721, #3729, #3735, #3773) merged into current main. `parity.py --changed origin/main`: 55 of 55 affected harnesses passed, `mob_ai` included. `horizon-client` lib tests: 726 passed. clippy `-D warnings` is clean. The only conflicts were the new cases in `tools/test_mob_ai_parity.py`, as resolved on your branch. Queued.
2026-10-30 04:32:06 +01:00
Ludovic Marie 0359138d94 Merge pull request #2698 from horizon-rust/cg20/fusseltv-worldgen-mobs
🤖 Agent: pr-triage-1 (Ludovic's AI agent, Claude), not Ludovic himself. Since sirrayi's review, I merged main into this branch twice; the last merge is 655b331b1. In the merges: - `VanillaTerrain` keeps main's world presets (2607d06f9). This branch only adds `region_random` and `spawn_generated`, and its tests call `for_dimension` without the preset argument. - Main's goat and frog code (`goat_init_memories`, the goat ram cooldown, the frog's long jump) used main's memory names, while this branch saves vanilla's ids. Both now use vanilla's: `long_jump_cooling_down` and `ram_cooldown_ticks`. - main's mooshroom kind test sits beside #2544's baby villager test. Tested on today's main: - With #3802, #4095 and #3300 together: 123 of the 125 harnesses this branch can reach pass, along with pr_ready and lan_e2e (mobs, spawned, worldspawn, drops). The 2 failures don't come from this branch: `dispenser` passes on main plus this branch alone, and `command_exec` failed because the vanilla server was under load. - On this head alone: `dispenser`, `finalize_spawn`, `natural_spawn` and `mob_ai` pass, and the 48 harnesses that cover goat.rs, frog.rs and finalize.rs pass 48/48. Queued for merge. When it merges, GitHub marks @FusselTV's #2544 and #2586 as merged.
2026-10-30 04:32:02 +01:00
Ludovic Marie b5ec91342e Merge remote-tracking branch 'origin/main' into upd-3735
# Conflicts:
#	tools/test_mob_ai_parity.py
2026-10-30 04:32:00 +01:00
Ludovic Marie f1eedfcb40 Merge remote-tracking branch 'origin/main' into upd-3721
# Conflicts:
#	tools/test_mob_ai_parity.py
2026-10-30 04:31:59 +01:00
Ludovic Marie 6883b74274 Merge remote-tracking branch 'origin/main' into upd-3712
# Conflicts:
#	tools/test_mob_ai_parity.py
2026-10-30 04:31:58 +01:00
Ludovic MarieandClaude Opus 5.5 d9e5234fa3 horizon-bots: abusive client behaviours (flood-move, flood-acks, flood-packets) to test a server's limits
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 04:27:58 +01:00
d3grandoandClaude Opus 5.5 9aeb985305 lan_e2e eating: one loaf each, and read the bites once they settle
The eater held the use for 2.2 s with two loaves: the held use started
the second loaf and let go of it a few ticks in, around its second bite
(Consumable.shouldEmitParticlesAndSounds: every 4 ticks once 7 of 32 are
past). That bite reaches the watcher from the server, whose use runs on
its own ticks behind the eater's client, so read 10 ticks after the hold
the watcher could still be one short (9 of 10, only when the eater drew
that bite).

Each player now eats a single loaf, so the count is the loaf's 6 bites
plus the last bite and FoodProperties' sound, and both sides' counts
are read once neither has changed for 20 ticks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 10:26:33 +07:00
Ludovic MarieandClaude Opus 5.5 0ec337f17e Merge main into this branch (world data packs' advancements: a tree is shared only without pack advancements)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 04:17:22 +01:00
Ludovic Marie a93ffc2f36 Merge pull request #3847 from horizon-rust/perf/spawner-idle
🤖 Agent: verified by server-tick-1: a spawner asks for an alive player in range before the spawn level is built, as BaseSpawner.serverTick returns first thing without one (no draw, no change); natural_level 1.6 % → 0.5 % of the tick thread at 100 bots; verify green, clippy -p horizon-client clean (main's log_display and axolotl test failures are main's); merging once CI parity passes.
2026-10-30 04:16:53 +01:00
Ludovic Marie 6e0605ad33 Merge pull request #4161 from horizon-rust/fix/lan-e2e-gateway-exact
🤖 Agent: queuing the lan_e2e levels test fix (#4145): the End gateway's ExactTeleport key and closing the guest's credits; levels passes on main's binary, pr_ready green.
2026-10-30 03:54:35 +01:00
Ludovic Marie 3bd99f79ae Merge pull request #3300 from masa-masa-0314/fix/datapack-recipe-loot-tags
🤖 Agent: pr-triage-1 (Ludovic's AI agent, Claude), not Ludovic himself. @masa-masa-0314, this PR is on the maintainer's priority list, so instead of asking you again I merged main into your branch myself. Your commits are not rewritten; it took three main merges today, the last one at ada669266. In the conflicts: - main's new code (cushions, crafted-recipe triggers, creative slots, item use) now reads the world's tables through your `self.items()`, `world_items!`, `world_stations!` and `world_recipes!`; - main's new tests pass `PackOverlay::NONE`; - `game/mod_render.rs` stays deleted, as main removed the wasm mod UI. Tested together with #3802, #4095 and #2698 on today's main: - 123 of the 125 vanilla harnesses this branch can reach pass. `dispenser` fails because of another PR in that set; it passes on main plus this PR alone. `command_exec`'s failure was the vanilla server under load; on this head it matches 902/902. - pr_ready passes. - lan_e2e passes (crafting, recipes, drops, mobs, spawned, cushions). Queued for merge. Thank you for the data-pack work!
2026-10-30 03:54:30 +01:00
Ludovic MarieandClaude Opus 5.5 655b331b1e Merge main into this branch (goat memory init, mooshroom kinds test)
Main's goat_init_memories, goat ram and frog jump code keep their brain
memories under main's names; this branch saves them under vanilla's ids.
Both now use vanilla's: long_jump_cooling_down and ram_cooldown_ticks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 03:53:15 +01:00
levzzz a46ce6898b Merge pull request #3729 from xFedeT/fix/constructor-path-maluses
Mobs: the path maluses vanilla's constructors set (fire, lava, powder snow, cocoa, trapdoors)
2026-10-30 07:50:58 +05:00
Ludovic Marie 8a7cd0deaf Merge pull request #4089 from horizon-rust/fix/command-exec-oracle-settle
🤖 Agent: fixes main's red command_exec (oracle timeout under load); passed fresh locally on current main.
2026-10-30 03:49:50 +01:00
Ludovic Marie 6269b7a21e Merge pull request #4136 from horizon-rust/fix/portal-overlay-cooldown
🤖 Agent: queuing the portal trip fixes (Discord: Nether portal overlay stuck after a dimension change; End portal leaving the player in the air): the overlay fades in the arrival portal, and the player stays on the loading screen until the exit is found. Tested in game on both paths; lan_e2e portals passes. pr_ready is green except dispenser, main's regression from #3959 fixed by #4120.
2026-10-30 03:46:07 +01:00
Ludovic Marie c5410785c0 Merge pull request #3748 from bunchy7s/fix/command-block-screen
🤖 Agent: Ludovic's AI agent (Claude), proof. This PR was in a union of 16 needs-proof PRs merged into main at 1dde830ba. Parity: 195 of 196 affected harnesses passed, none failed. clippy and rustfmt passed. `lan_e2e --check commands` passes on the server thread and `--in-frame`. The command block's edit screen refreshing from the server's data is covered there. Queued.
2026-10-30 03:42:24 +01:00
Ludovic MarieandClaude Opus 5.5 ada669266f Merge main into this branch (creative display slots)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 03:30:02 +01:00
JulesB40andClaude Opus 5.5 85ff723581 Allocator: say which heaps mi_collect frees
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 03:21:13 +01:00
JulesB40andClaude Opus 5.5 5b695d5a26 Allocator: give free pages back at once
With mimalloc's default 1 s purge delay the server held 26% and the client
37% more memory than with the system heap. Purging at once keeps the server
within 3% and the client within 9%, and generation keeps most of its speed-up
(+18% chunks a second on 24 workers, +3% on one).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 03:21:13 +01:00
JulesB40andClaude Opus 5.5 800e7cef33 Game: mimalloc as the global allocator
World generation, meshing and the tick allocate and free small blocks on
every worker at once, and the system heap serialised them: on Windows
RtlAllocateHeap/RtlFreeHeap were 16% of chunkgen_bench's CPU. mimalloc keeps
a heap per thread. release_free_memory also gives mimalloc's free pages back.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 03:21:13 +01:00
Ludovic Marie b9c54ecd50 Merge pull request #4027 from horizon-rust/perf/dedicated-no-sprite-pixels
🤖 Agent: verified by server-tick-1. Stacked on #4009: a dedicated server keeps the block models and sprite layers but no texture pixels or animation frames, which only the renderer reads; −28 MB idle RSS on Linux. dedicated_server passes locally; merge after #4009.
2026-10-30 03:12:58 +01:00
Ludovic MarieandClaude Opus 5.5 24bea8540d Make lan_e2e levels' guest_end step match vanilla's End exit
The End gateway's exact flag is `ExactTeleport` in TheEndGatewayBlockEntity's
NBT; `exact_teleport` was ignored, so the gateway searched for a landing and
left the guest away from the spawn platform. The guest's first exit from the
End then rolls the credits (ServerPlayer.showEndCredits) and only closing
them takes it home, as the portals step already does for the host.

Fixes #4145

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 03:03:16 +01:00
d3grandoandClaude Opus 5.5 633cd1dbce Merge origin/main into fix-3393-optab
creative.rs, with #3693's Saved Hotbars tab: Tab gains hotbar, set in Exported and Tab::header. Neither side's tab skip is kept: the hotbar tab now shows (#3693), and an empty category tab, the operator tab without permissions among them, is left out by its stacks after the permission filter (this branch), so the exporter's visible flag is no longer read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 08:55:23 +07:00
Ludovic MarieandClaude Opus 5.5 f03c1771af Drop the old level's pending teleport when a portal trip starts
Its late acceptance set the player's position back to the old level's
coordinates, so a trip that started right after a teleport waited forever for
chunks around the exit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 02:45:25 +01:00
levzzz 25f9cd3a99 Merge pull request #3875 from xFedeT/fix/boat-paddle-input-latch
Boats: steer with the input latched on the previous tick
2026-10-30 06:44:08 +05:00
Ludovic MarieandClaude Opus 5.5 f257391453 Chunk workers: give freed memory back once every worker is idle
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 02:42:50 +01:00
Ludovic MarieandClaude Opus 5.5 e497995b44 Chunk workers: free the generator's scratch buffers after 5 s with nothing to do
Each streaming worker keeps its generator's density scratch buffers and
lookup caches between jobs, megabytes per worker, for as long as the world
is open: about 51 MB on the Mac mini's dedicated server with nobody on. A
worker that has waited 5 s with an empty queue now frees them (and the
mesher's face cache); the next job makes them again. Results do not change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 02:42:50 +01:00
d3grandoandClaude Opus 5.5 03ba7662d5 Merge origin/main into fix-2740
game/server_packs.rs: main's WORLD_PACK_ID is kept; PackReload and RELOAD_LINES stay in game/packs.rs, where this branch moved them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 08:37:34 +07:00
Ludovic MarieandClaude Opus 5.5 2c91574bbb Ignore a portal traveller's old moves until it lands
Without the teleport change_level used to send at once, moves the client had
sent from the old level were taken as positions in the new one, and the level
loaded its chunks there instead of around the exit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 02:37:29 +01:00
levzzzandClaude Opus 5.5 f0ac52bf7f Merge main into fix/boat-paddle-input-latch (resolve tools/lan_e2e.py)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 06:35:03 +05:00
levzzz 1f3ccb0fc3 Merge pull request #3747 from xFedeT/fix/break-effects-for-popped-blocks
Break effects: a block that pops off when its support is mined plays its sound and particles for the miner
2026-10-30 06:30:23 +05:00
Ludovic Marie fcbb0d627a Merge pull request #4120 from horizon-rust/fix/golem-base-any-head
🤖 Agent: fixes main's red dispenser (golem base check from #3959); pr_ready green, 33 harnesses pass.
2026-10-30 02:28:55 +01:00
levzzz 30666b33b6 Merge pull request #3655 from jaszkus/feat/debug-stick
Add the Debug Stick
2026-10-30 06:24:29 +05:00
levzzz ada67586d0 Merge pull request #3642 from iLostName/off-hand-waits-for-main-hand
off hand: filling a composter or using bone meal ends the click before the off-hand torch
2026-10-30 06:24:12 +05:00
levzzzandClaude Opus 5.5 6ca9531468 Merge main into fix/boat-paddle-input-latch (resolve tools/lan_e2e.py)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 06:22:44 +05:00
levzzzandClaude Opus 5.5 972719f088 Merge main into fix/break-effects-for-popped-blocks (resolve tools/lan_e2e.py)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 06:22:23 +05:00
levzzz b548c70594 Merge pull request #4018 from xFedeT/fix/wind-burst-smash
Mace smash on another player: Wind Burst launches the attacker, the fall stops
2026-10-30 06:18:40 +05:00
Ludovic Marie 4fef8a8682 Merge pull request #3921 from horizon-rust/feat/parity-headline
🤖 Agent: merging the parity headline (#3859 step 5): verify green, gap tests pass, the site built against it shows the paragraph without markers.
2026-10-30 02:18:15 +01:00
levzzzandClaude Sonnet 5.5 a80678b890 Merge main into fix/split-mob-sounds-behaviour (resolve game/creatures.rs, game/potions.rs, mobs/leash.rs)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 06:16:25 +05:00
levzzz be8a82a40b Merge pull request #3955 from kacpherek/fix/split-animals
Animals behave like vanilla: turtles, goats, foxes, bees, axolotls, camels and horses
2026-10-30 06:13:52 +05:00
levzzz e54e8003e5 Merge pull request #3756 from horizon-rust/fix/server-brand-horizon
Server brand: Horizon's server names itself "horizon"
2026-10-30 06:13:35 +05:00
levzzzandClaude Sonnet 5.5 bc31cef0a7 Merge main into feat/debug-stick (no conflicts)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 06:08:52 +05:00
levzzzandClaude Sonnet 5.5 2b2a8bedd4 Merge main into off-hand-waits-for-main-hand (no conflicts)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 06:08:11 +05:00
levzzzandClaude Sonnet 5.5 6db70a1ae4 Merge main into fix/boat-paddle-input-latch (resolve tools/lan_e2e.py)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 06:07:50 +05:00
levzzzandClaude Sonnet 5.5 0d5cd6a591 Merge main into fix/break-effects-for-popped-blocks (resolve tools/lan_e2e.py)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 06:07:30 +05:00
levzzzandClaude Sonnet 5.5 6d67bf43bb Merge main into fix/wind-burst-smash (resolve tools/lan_e2e.py)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 06:07:11 +05:00
levzzz 6d59158973 Merge pull request #3643 from iLostName/crossbow-near-tnt-minecart
minecart: right-clicking a tnt minecart uses the held item, so a crossbow shoots at it
2026-10-30 06:06:30 +05:00
levzzz 647050d7aa Merge pull request #3953 from kacpherek/fix/split-screens
Menus, tooltips, world opening and chat now behave like vanilla
2026-10-30 06:05:42 +05:00
levzzz 1c333aa336 Merge pull request #3944 from kacpherek/fix/split-sulfur-glowsquid-water
Sulfur geysers and potent sulfur, glow squid dark ticks, and splash water bottles that douse fire
2026-10-30 06:05:24 +05:00
levzzz 41d772380a Merge pull request #3952 from kacpherek/fix/split-shelves-signs
Signs run the click commands in their text, as vanilla
2026-10-30 06:05:08 +05:00
levzzz df00ca8693 Merge pull request #3954 from kacpherek/fix/split-server
Fix server and LAN-host behaviour: spam kicks, straw beds, shulkers, ravagers, item frames, advancements and tab list
2026-10-30 06:04:51 +05:00
levzzz 589164c071 Merge pull request #3693 from Username59138/feat/creative-saved-hotbars
Creative inventory: the Saved Hotbars tab, as vanilla shows it
2026-10-30 06:04:34 +05:00
levzzz ed196ffd66 Merge pull request #4015 from d3grando/fix-3393-fallingblock
Falling sand and gravel ride bubble columns
2026-10-30 06:01:50 +05:00
levzzz 00480831ce Merge pull request #3995 from xFedeT/fix/fishing-hook-smooth
Fishing hook on a server's client moves between the tracker's updates, as FishingHook.tick does
2026-10-30 05:57:43 +05:00
levzzz 2fa595676e Merge pull request #3645 from iLostName/pillar-place-sound
block placement: a click on a block is handled before the move behind it, so pillar blocks are heard
2026-10-30 05:49:32 +05:00
FauxandClaude Opus 5.5 edefd8ef0c Far terrain: kelp is water, and powder snow and paths are kept
A chunk's summary skipped blocks that neither draw solid nor collide as a
full block. Kelp and seagrass reaching the surface left holes in the far
sea, and patches of powder snow left holes in mountains (paths, farmland
and stairs dips).

- Blocks holding water that aren't kept (kelp, seagrass, bubble columns,
  waterlogged ones) are drawn as water, so the water is one span.
- Powder snow, dirt paths, farmland, honey blocks and stairs are kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012gFJzABp1uePB4gm32PuaC
2026-10-29 17:48:18 -07:00
levzzz d3338640bc Merge pull request #4002 from DUzzL/fix/issue-3997-guest-arrow-pickup
Arrows can be picked up by LAN guests and the single-player window (#3997)
2026-10-30 05:38:17 +05:00
Aria Figueredo ea10a17842 Expose native world lifecycle hooks 2026-10-29 19:36:15 -05:00
Ludovic Marie fcb14be442 Merge pull request #4100 from horizon-rust/fix/no-official-server-in-harness-runs
🤖 Agent: Ludovic's AI agent (Claude), pr-triage-3. Harness and horizon-ctl runs no longer add the official server to servers.dat in the working directory (the repo root) or send the players ping; before/after checked with a fixture run in a scratch folder. Queued.
2026-10-30 01:32:33 +01:00
levzzz f1c0ab982a Merge pull request #4040 from phexuss/fix/remote-look-at
Turn the player when a server sends PlayerLookAt
2026-10-30 05:32:12 +05:00
DUzzL 91bd434281 Apply block_break_speed attribute to mining speed
Read the player's minecraft:block_break_speed attribute and multiply the destroy speed by it in both the server mining tick and the client's destroy-progress prediction, matching Player.getDestroySpeed.

Fixes #4094.
2026-10-30 01:32:11 +01:00
levzzz 173d00dadb Merge pull request #3668 from martipops/fix/damage-other-players
/damage hurts players other than the one running it
2026-10-30 05:31:56 +05:00
levzzz ea7e58787d Merge pull request #3675 from d3grando/fix-3236
Mooshrooms keep their colour: save Type, sync DATA_TYPE at 18
2026-10-30 05:31:39 +05:00
levzzzandClaude Sonnet 5.5 7ce7388582 Merge main into fix/split-animals (resolve crates/horizon-client/src/mobs/living.rs)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 05:30:56 +05:00
levzzzandClaude Sonnet 5.5 6fea98f668 Merge main into fix/split-spear-ai-golem (resolve crates/horizon-client/src/mobs/goals.rs)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 05:29:40 +05:00
levzzzandClaude Sonnet 5.5 3ee203767a Merge main into fix/own-head-pitch-follows-mouse (resolve crates/horizon-client/src/game/perspective.rs)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 05:28:23 +05:00
levzzz a013e649c9 Merge pull request #4014 from DUzzL/fix/issue-4003-guest-trial-omen
Trial/Bad Omen of server players make trial spawners ominous
2026-10-30 05:28:08 +05:00
levzzzandClaude Sonnet 5.5 b78e407c12 Merge main into fix/split-agelock-goat-allay (resolve crates/horizon-client/src/mobs/ai.rs)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 05:26:51 +05:00
levzzzandClaude Sonnet 5.5 9858aec68b Merge main into fix/split-piglin-hoglin (resolve crates/horizon-client/src/game/creatures.rs, mobs.rs)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 05:25:06 +05:00
levzzzandClaude Sonnet 5.5 7852c700f1 Merge main into fix-3199 (resolve crates/horizon-client/src/mobs/ai.rs, camel.rs)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 05:23:23 +05:00
Ludovic MarieandClaude Opus 5.5 14fad0786e Game: harness and horizon-ctl runs don't add the official server or ping
The official server's servers.dat entry and its marker go into the game
folder, which is the working directory, and the "N playing now" ping
starts at the same place. The guard skipped servers, benchmarks,
offscreen and frame-limited runs, but not a harness's fixture
(HORIZON_DISPENSE_FIXTURE, HORIZON_SCULK_FIXTURE, HORIZON_COMMAND_SCRIPT,
HORIZON_NET_REPORT) or a run horizon-ctl drives. Harnesses start those
in the source checkout, so a parity run left servers.dat and
horizon_official_server.txt in the repo root and counted itself as a
player. The guard now reuses synchronous_startup, which already names
every one of these runs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 01:23:18 +01:00
levzzz 0dfa513424 Merge pull request #4043 from DUzzL/fix/issue-4031-fall-damage-sound
Fall damage plays its sound in multiplayer and for LAN guests
2026-10-30 05:22:21 +05:00
Federico TaglianiandClaude Sonnet 5.5 735cdab711 Merge origin/main into fix/skeleton-path-stops-in-shade
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 01:21:32 +01:00
DUzzL ce91a02d84 Use the player's attack_speed base for the attack cooldown (#4091) 2026-10-30 01:20:23 +01:00
levzzzandClaude Sonnet 5.5 51c10dd31d Merge main into fix/villager-grows-up-brain (resolve tools/test_mob_ai_parity.py)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 05:20:20 +05:00
levzzzandClaude Sonnet 5.5 0d9399ead9 Merge main into fix/constructor-path-maluses (resolve tools/test_mob_ai_parity.py)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 05:20:03 +05:00
Ludovic MarieandClaude Opus 5.5 923f425f19 Advancements: load the tree once for the server's packets and the game's criteria
ServerAdvancements (the advancement packets a server sends) and the game
that runs the criteria each read and parsed every advancement file into a
tree of their own: 7 MB each, the same twice. Tree::shared keeps one per
data folder while anyone holds it, and both use it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 01:20:01 +01:00
levzzzandClaude Sonnet 5.5 2be6cda974 Merge main into fix/zombified-piglin-turtle-egg-goal (resolve tools/test_mob_ai_parity.py)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 05:19:36 +05:00
levzzzandClaude Sonnet 5.5 9ad9d087ef Merge main into fix/boat-paddle-input-latch (resolve tools/lan_e2e.py)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 05:18:24 +05:00
levzzz 79593d80b6 Merge pull request #3659 from d3grando/fix-3091
Let parrots fly: flying navigation and move control, flapping and gliding
2026-10-30 05:18:18 +05:00
levzzzandClaude Sonnet 5.5 58853fdf50 Merge main into fix/wind-burst-smash (resolve tools/lan_e2e.py)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 05:18:06 +05:00
levzzzandClaude Sonnet 5.5 834819ddf4 Merge main into fix/fishing-hook-smooth (resolve tools/lan_e2e.py)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 05:17:45 +05:00
levzzzandClaude Sonnet 5.5 7835010339 Merge main into fix/break-effects-for-popped-blocks (resolve tools/lan_e2e.py)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 05:17:22 +05:00
levzzz 590542c5ee Merge pull request #4004 from d3grando/fix-3006
Both mouse buttons at once replace the block in creative
2026-10-30 05:16:53 +05:00
Federico TaglianiandClaude Sonnet 5.5 8f7c959679 Navigation: trimPath runs in moveTo, before the node count check
PathNavigation.moveTo trims the path first and refuses it when the trim
leaves no node. The trim was deferred to the next nav_tick, so move_to
answered true for a tick and goals started on a path that was already empty.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 01:14:41 +01:00
Ludovic Marie 4cb754474d Merge pull request #3732 from xFedeT/fix/wither-skeleton-parity
🤖 Agent: Ludovic's AI agent (Claude), triage. Wither skeleton: its piglin target goal comes first among the priority 3 goals (vanilla's registerGoals order). levzzz5154's main merge touched only the mob_ai case list; the Rust change is the same as on the CI-parity-green head, and verify is green. Requeued.
2026-10-30 01:13:47 +01:00
Ludovic Marie 0855cc910f Merge pull request #3850 from Fauxvale/fix/far-open-water-light
🤖 Agent: Ludovic's AI agent (Claude), triage. Far terrain: no dark band in the sea where chunks were loaded: checked against vanilla, and proven in union pt3-w3 (29 PRs, Mac mini): pr_ready full, parity 109/110 affected passed (lan_integration runs nightly). Queued.
2026-10-30 01:13:42 +01:00
Ludovic Marie 793337b0ed Merge pull request #3892 from matyden/telemetry/scrub-user-named-user
🤖 Agent: Ludovic's AI agent (Claude), triage. Telemetry: a user named "user" keeps the <user> label whole: checked against vanilla, and proven in union pt3-w3 (29 PRs, Mac mini): pr_ready full, parity 109/110 affected passed (lan_integration runs nightly). Queued.
2026-10-30 01:13:38 +01:00
Ludovic Marie a603c95eba Merge pull request #3802 from ThatCakeIsAPie/fix/datapack-block-state-providers
🤖 Agent: Ludovic's AI agent (Claude), triage. Data packs: a pack's block state providers join the state_providers bundle: checked against vanilla, and proven in union pt3-w3 (29 PRs, Mac mini): pr_ready full, parity 109/110 affected passed (lan_integration runs nightly). Queued.
2026-10-30 01:13:34 +01:00
Ludovic Marie 564b8a4b9e Merge pull request #3599 from doodlyyousuf/fix/pearl-hits-wind-charge
🤖 Agent: Ludovic's AI agent (Claude), triage. Let thrown pearls hit wind charges: checked against vanilla, and proven in union pt3-w3 (29 PRs, Mac mini): pr_ready full, parity 109/110 affected passed (lan_integration runs nightly). Queued.
2026-10-30 01:13:30 +01:00
Ludovic MarieandClaude Opus 5.5 a16097dd96 Merge main into this branch (cushion placement checks, lan_bot sync test)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 01:11:09 +01:00
Ludovic MarieandClaude Opus 5.5 4c802c1342 Merge main into this branch
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 01:08:59 +01:00
Ludovic Marie 304a3ca76e Merge pull request #3371 from horizon-rust/draft/remove-wasm-mods-docs
🤖 Agent: WebAssembly removal 4/4 (docs), on #3353, merged up to date with main (roadmap: main's, with the native-mod wording reapplied; docs-only on top of the union proven in proven.txt). Merge after #3353; horizon-site#6 follows.
2026-10-30 01:08:50 +01:00
Federico TaglianiandClaude Sonnet 5.5 4ef3c1f54a Merge origin/main into fix/skeleton-path-stops-in-shade
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 01:08:27 +01:00
levzzz d163f38b6a Merge pull request #4005 from d3grando/fix-3117
Cushions swing the arm when placed and let a seated player change seats
2026-10-30 05:08:20 +05:00
levzzz e2fa940581 Merge pull request #3607 from degepie/fix/issue-3024-worn-armor-glint
Armour: worn pieces and the elytra show the enchantment glint (#3024)
2026-10-30 05:06:49 +05:00
Ludovic MarieandClaude Opus 5.5 a32ab2c5e4 Merge main into this branch (world presets, worldgen data packs, noise clamp)
Main now builds a world's preset itself (2607d06f9): VanillaTerrain keeps
main's for_world/for_world_with signatures, this branch adds region_random
and spawn_generated beside them, and its tests call for_dimension without
the preset argument.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 01:06:35 +01:00
Ludovic Marie 03b464ec0e Merge pull request #3902 from DUzzL/fix/issue-3882-defer-dataversion-stamp
🤖 Agent: Ludovic's AI agent (Claude), triage. Stamp DataVersion only after the world data is upgraded: checked against vanilla, and proven in union pt3-w3 (29 PRs, Mac mini): pr_ready full, parity 109/110 affected passed (lan_integration runs nightly). Queued.
2026-10-30 01:06:35 +01:00
Ludovic Marie 186095dd37 Merge pull request #3908 from DUzzL/fix/issue-3883-camel-pose-tick
🤖 Agent: Ludovic's AI agent (Claude), triage. Fix camel freeze after spawn and LastPoseTick saved as a sign: checked against vanilla, and proven in union pt3-w3 (29 PRs, Mac mini): pr_ready full, parity 109/110 affected passed (lan_integration runs nightly). Queued.
2026-10-30 01:06:30 +01:00
levzzz a4f0482bd9 Merge pull request #3792 from GIGABAIT93/fix/npc-skins
Player entities keep the skin they found: NPCs show theirs
2026-10-30 05:06:24 +05:00
Ludovic MarieandClaude Opus 5.5 2ba6caa289 Golems: a pumpkin's base check takes any block at the head
canSpawnGolem (a dispenser's carved pumpkin) and the setBlock that places a
head ask before the head is there, with vanilla's base patterns (" ", "#",
"#") and ("~ ~", "###", "~#~"), whose head cell takes any block. #3959's
find_pattern required the head there too, so a dispenser no longer built a
snow or iron golem: dispenser parity failed on main (carved_pumpkin, 1 of
6000 cases).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 01:06:05 +01:00
Federico Tagliani 5f5d0434cb Merge remote-tracking branch 'origin/main' into fix/cat-goals 2026-10-30 01:05:14 +01:00
Federico TaglianiandClaude Sonnet 5.5 11159a1ed5 Merge fork/fix/cat-goals (maintainer's merge of main)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 01:05:13 +01:00
levzzz bf8d58facd Merge pull request #4045 from d3grando/fix-3684-hitbox
A small player's server box follows minecraft:scale
2026-10-30 05:04:26 +05:00
Ludovic MarieandClaude Opus 5.5 a8e3cebc5f Merge main into this branch (wasm mod UI removed, item use slows sprint, crafted-recipe triggers, world presets)
Main's new code reads the world's tables (self.items(), world_stations!,
world_recipes!); main's new tests pass PackOverlay::NONE.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 01:03:05 +01:00
Ludovic MarieandClaude Opus 5.5 30fcf2c30c command_exec oracle: wait for entities by the clock, not 400 ticks
Vanilla loads entity sections on other threads, so on a loaded runner
400 ticks (~2 s) ran out before the chunks around the player were
entity-ticking: the oracle threw "entities around the player did not
load" and main's parity has failed on command_exec since 2026-10-29 22:05.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 01:01:05 +01:00
levzzz 9d72c1ddcd Merge pull request #3716 from xFedeT/fix/merchant-closes-out-of-range
Villagers: the trade screen closes when the trader is gone or out of reach
2026-10-30 05:00:59 +05:00
levzzz 62caef810a Merge pull request #3934 from DUzzL/fix/issue-3912-turtle-ambient
Turtle: silent in water, in the air and as a baby
2026-10-30 05:00:41 +05:00
Federico TaglianiandClaude Sonnet 5.5 1c16f98098 Merge origin/main into fix/cat-goals: the sprint now comes from main
main's feline_server_ai_step sets the cat's sprint and Mob::movement_speed
adds the +30% for it, so the cat arm of custom_server_ai_step, the sprint dust
draws and the speed_bonus arm (a second +30%) are dropped; the avoidance goal
order and the CatAvoidEntityGoal probe name stay.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 01:00:39 +01:00
levzzz 69d2086e7d Merge pull request #3623 from degepie/fix/issue-3026-fish-schools
Fish form schools: port FollowFlockLeaderGoal (#3026)
2026-10-30 05:00:16 +05:00
levzzz 0829657bcc Merge pull request #3868 from spidercraft/feat/lan-online-mode
LAN and friends worlds authenticate guests when the host is signed in: their skins and capes show
2026-10-30 04:59:38 +05:00
Ludovic MarieandClaude Opus 5.5 88e79c1119 Keep a portal traveller on the loading screen until its exit is found
Vanilla finds a portal's exit (the End platform, the Nether portal, the spawn
column after the End) before ServerPlayer.teleport sends the Respawn packet.
Horizon finds it once the destination has loaded, and meanwhile showed the
client at the approximate point: in the air above the End's void or at the
raw world spawn. The client now gets its position, LEVEL_CHUNKS_LOAD_START
and the portal sound only when the trip lands, so it stays on its level
loading screen as in vanilla.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 00:58:15 +01:00
Ludovic Marie 1dde830baf Merge pull request #3353 from horizon-rust/draft/remove-wasm-mods-launcher
🤖 Agent: WebAssembly removal 3/4 (launcher: a WebAssembly mod needs a native port), on #3351; proven with #3351 and #3371 on union/wasm-removal (proven.txt). Launcher clippy and its 275 tests pass. Merge after #3351.
2026-10-30 00:56:58 +01:00
Ludovic Marie 588ca0cd22 Merge pull request #3152 from senjinthedragon/hdr-screenshot
🤖 Agent: pr-triage-1 (Ludovic's AI agent, Claude), not Ludovic himself. I merged main into your branch (a fast-forward merge commit, 0e4f8e279; none of your commits rewritten). Since this PR was opened, main changed the HDR parameters (black level, UI brightness, tiers: 20 floats) and screenshots (`ScreenshotRequest`, world icons). In the merge: - `Hdr::params` fills main's layout for both the swapchain and your HDR10 capture; - only full-frame screenshots get the `-hdr.png` copy, not world icons; - the docs sentence moved into main's HDR paragraph. Tested on this head merged into main: - The harnesses it can reach pass (59/60). The one failure, `command_exec`'s `/data get` `custom_name`, comes from main. - fmt, clippy and the render tests pass. - On macOS (HDR10 output), a screenshot wrote both PNGs: the HDR one is 16-bit RGB with cICP 9/16/0/1 and cLLI 1000/203. Queued for merge.
2026-10-30 00:56:54 +01:00
Ludovic Marie 4488cda84f Merge pull request #3808 from doodlyyousuf/fix/release-notes-canonical-repo
🤖 Agent: Ludovic's AI agent (Claude), triage. Tooling only: release notes always link horizon-rust/horizon, even when a fork's CI builds them. verify is green. Queued.
2026-10-30 00:56:51 +01:00
Ludovic Marie 2a8c60b6df Merge pull request #3351 from horizon-rust/draft/remove-wasm-mods-crates
🤖 Agent: WebAssembly removal 2/4 (crates: runtime, SDK, official WebAssembly mods), on #3350, merged up to date with main c7065027b. Workspace compiles (--all-targets --locked). Merge after #3350.
2026-10-30 00:56:47 +01:00
levzzz 4693954aa1 Merge pull request #4016 from d3grando/fix-3393-eggs
Thrown eggs and snowballs turn with the camera, no flip looking straight up
2026-10-30 04:56:16 +05:00
Ludovic MarieandClaude Opus 5.5 2fd01bd8bd Merge main (0208c75ef) into the docs layer
The roadmap: main's (Now at most 8 items) with this layer's native-mod
wording reapplied; the WebAssembly runtime is removed, not being removed.
docs/README.md: main's data pack upgrade line kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 00:55:10 +01:00
levzzzandClaude Sonnet 5.5 ba5585da84 Merge main into fix/npc-skins (resolve crates/horizon-client/src/game/remote.rs)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 04:53:10 +05:00
Ludovic Marie d409f691dc Merge remote-tracking branch 'origin/main' into upd-3642
# Conflicts:
#	crates/horizon-client/src/game/remote.rs
2026-10-30 00:52:43 +01:00
d3grandoandClaude Opus 5.5 4d1f533af6 Creative tab selection test: give the category tab a stack
The fixture's CATEGORY tab was empty, and an empty category tab is now
hidden (CreativeModeTab.shouldDisplay), so tab 0 was no longer the tab the
test selects. It now holds a stone stack.

Part of #3393.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 06:52:26 +07:00
Ludovic Marie 0208c75ef4 Merge pull request #3979 from DUzzL/fix/issue-3975-owners-doc
🤖 Agent: Ludovic's AI agent (Claude), triage. Docs only: a server.properties → server.toml page for owners, linked from docs/README. verify is green. Queued.
2026-10-30 00:51:53 +01:00
levzzzandClaude Sonnet 5.5 cc683c75f0 Merge main into fix/issue-3024-worn-armor-glint (resolve crates/horizon-client/src/game/perspective.rs)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 04:51:24 +05:00
Ludovic Marie 57e49b068e Merge remote-tracking branch 'origin/main' into upd-3655
# Conflicts:
#	tests/test_remote_mining.py
2026-10-30 00:50:35 +01:00
d3grandoandClaude Opus 5.5 89f40134b2 Merge origin/main into fix-3199
mobs/ai.rs: this branch's same_vehicle_push_tests and main's tests appended after it are both kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 06:50:11 +07:00
levzzzandClaude Sonnet 5.5 490a33aea9 Merge main into fix/issue-3912-turtle-ambient (resolve crates/horizon-client/src/mobs/ai.rs)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 04:48:40 +05:00
Ludovic MarieandClaude Opus 5.5 7cce0bf15b Keep the portal cooldown on a server's client so the overlay fades in the arrival portal
handleRespawn gives the new LocalPlayer the server's portalCooldown, and the
client's setAsInsidePortal only restarts it while the player stands in the
arrival portal. Horizon sent 0 and ignored it, so the purple overlay built up
again and stayed on screen after a dimension change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 00:48:17 +01:00
Ludovic MarieandClaude Opus 5.5 a536b00c30 Worldgen: bind the feature block tags once, shared by decoration, structures and live features
Decoration, structure placement and live features each built their own
FeatureBlockBindings, binding every block and every block tag to its state
set: 5.5 MB each, the same three times. GeneratorData now binds them once
(feature_block_bindings) and the bindings share the maps through Arcs. Each
decorated region also cloned the whole tag map; it now shares it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 00:48:07 +01:00
Alexander KrylovandHermes Agent 24c323960e Launcher: keep removable beside its own doc comment
The new fn sat between selection_after_removal's doc comment and that
function, so the comment documented the wrong one.

Co-Authored-By: Hermes Agent (Nous Research) <[email protected]>
2026-10-30 02:46:21 +03:00
levzzzandClaude Sonnet 5.5 4289f22f00 Merge main into fix/merchant-closes-out-of-range (resolve tools/lan_e2e.py)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 04:46:19 +05:00
Ludovic Marie 71527fa938 Merge remote-tracking branch 'origin/main' into upd-4016
# Conflicts:
#	crates/horizon-client/src/game/creatures.rs
2026-10-30 00:42:49 +01:00
levzzzandClaude Sonnet 5.5 e4d8570fbc Merge main into fix/villager-grows-up-brain (resolve tools/test_mob_ai_parity.py)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 04:42:41 +05:00
levzzzandClaude Sonnet 5.5 4e3a161ac6 Merge main into fix/constructor-path-maluses (resolve tools/test_mob_ai_parity.py)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 04:41:45 +05:00
levzzzandClaude Sonnet 5.5 6cd8cc4987 Merge main into fix/wither-skeleton-parity (resolve tools/test_mob_ai_parity.py)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 04:41:08 +05:00
levzzzandClaude Sonnet 5.5 30da32b83c Merge main into fix/zombified-piglin-turtle-egg-goal (resolve tools/test_mob_ai_parity.py)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 04:40:41 +05:00
d3grandoandClaude Opus 5.5 f84b88b2e9 Thrown pearls feel the water their box touches, as vanilla's isInWater
Projectile::tick chose the water inertia (0.8) from the fluid of the block
at the projectile's feet, every tick including the first. Vanilla's
ThrowableProjectile.applyInertia and AbstractHurtingProjectile.applyInertia
read Entity.isInWater (wasTouchingWater), which the previous tick's
Entity.baseTick -> updateFluidInteraction set from the deflated bounding
box after the move (EntityFluidInteraction.update: some water surface at or
above the box's bottom), and which is still false on the first tick.

So a pearl thrown under water lost a fifth of its speed on the first tick
(it lands about 6.0 blocks away instead of 7.4), one skimming just above a
pool slowed as if under water, and one whose box dipped into the next
column's water did not slow at all.

The projectile now keeps touching_water from the box after each move
(ProjWorld reads it through MobWorld::fluids, the mobs' port of the same
test); llama spit, whose base tick runs before its move, tests its box at
the start of the tick. Client-side arrows test their box too.

Part of #3072.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 06:40:21 +07:00
levzzzandClaude Sonnet 5.5 173e278206 Merge main into fix/flyers-scan (resolve tools/test_mob_ai_parity.py)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-30 04:40:15 +05:00
d3grandoandClaude Opus 5.5 6b8e3b8f5f Runtime spawns run Mob.finalizeSpawn and wither skeletons hit for 4
Mobs spawned while the game runs (/summon, spawn eggs, spawners, natural
spawns, raids) go through the reduced spawning::finalize, which skipped
Mob.finalizeSpawn and WitherSkeleton.finalizeSpawn:

- no mob got the random_spawn_bonus follow range modifier, and none was
  ever left-handed (vanilla: 5 percent);
- wither skeletons kept the default 2.0 attack damage instead of 4.0.

Move the Mob.finalizeSpawn body into finalize::mob_spawn, shared by the
worldgen Ctx::mob, the summoned iron golem and now the runtime finalize
(every mob but the cave spider, whose finalizeSpawn does not call super),
and set the wither skeleton's attack damage base to 4.0. A bred baby
(Animal.spawnChildFromBreeding: getBreedOffspring runs no finalizeSpawn)
drops the bonus and the left hand again, as it already drops the sound
variant.

Part of #2783.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 06:37:46 +07:00
d3grandoandClaude Opus 5.5 0b0a91e4d4 Mob AI parity: a wolf shaking dry and a wolf in the rain
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 06:37:22 +07:00
d3grandoandClaude Opus 5.5 5ee04257c5 Wet wolves darken and shake off the water on clients
A wolf's wet and shake state lived only in the server's ai_step, so a
client of a server (the default single player on its server thread, a
LAN guest) never saw a wolf darken in water or rain, nor shake dry.

Split Wolf.tick's wet and shaking part out so both sides run it: the
client knows on its own when the wolf is in water or rain (isWet), and
follows the server's entity events 8 (start shaking, broadcast by
Wolf.aiStep) and 56 (cancel, from Wolf.tick back in water or rain) in
Wolf.handleEntityEvent. The shake now starts and plays its sound in the
same tick as vanilla, and the splash offsets come from the wolf's random
on both sides, as Wolf.tick draws them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 06:37:22 +07:00
levzzz d6adbe1cb5 Merge pull request #4057 from degepie/fix/issue-3422-shield-slowdown
A raised shield keeps a sprint from starting, as in vanilla (#3422)
2026-10-30 04:37:03 +05:00
levzzz bc93f7da59 Merge pull request #4063 from arismoko/fix/command-loot-name-parity
Preserve item modifier custom name components
2026-10-30 04:36:46 +05:00
levzzz 8b843008eb Merge pull request #3776 from GIGABAIT93/fix/text-display-passengers
Text displays ride their vehicles: an NPC's name sits over its head
2026-10-30 04:36:36 +05:00
levzzz 8bd015284b Merge pull request #3605 from deloskiytbackup/fix/pumpkin-head-rendering
Render: draw carved pumpkins and mob heads on player and humanoid heads
2026-10-30 04:36:20 +05:00
levzzz b97e677cbc Merge pull request #3998 from d3grando/fix-3829
Players and heads keep their skins on busy servers
2026-10-30 04:36:04 +05:00
levzzz 117fbcd1aa Merge pull request #3922 from GIGABAIT93/feat/remote-player-scale
Other players and mannequins take their minecraft:scale
2026-10-30 04:35:35 +05:00
levzzz 5bafa93fa0 Merge pull request #4020 from DenisHumen/fix/sleep-camera
Sleeping: lie 0.125 above the bed's top, as vanilla does
2026-10-30 04:35:18 +05:00
levzzz ae4660dfdf Merge pull request #4021 from phexuss/fix/station-scrollbar-drag
Drag the stonecutter and villager trade scrollers
2026-10-30 04:35:02 +05:00
levzzz 141b1e0cf5 Merge pull request #4026 from JustKarkat/test/text-display-shadow-parity
Add shadow_color coverage to the text display render parity test
2026-10-30 04:34:45 +05:00
levzzz bf4d46df7e Merge pull request #3594 from d3grando/fix-3503
Paintings: the item's variant is placed and named in its tooltip
2026-10-30 04:34:28 +05:00
levzzz 4bf451bd2d Merge pull request #3611 from degepie/fix/issue-3027-adventure-ghost-blocks
Adventure: don't predict breaking a block the player may not break (#3027)
2026-10-30 04:33:59 +05:00
Ludovic MarieandClaude Opus 5.5 31ad980443 Merge main: main's new tab test builds a Tab with hotbar false
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 00:33:49 +01:00
levzzz 4c8178f4fd Merge pull request #3620 from iLostName/pearl-through-end-crystal
ender pearl: one that hits an end crystal still takes its thrower there
2026-10-30 04:33:43 +05:00
levzzz f38db18183 Merge pull request #3624 from deloskiytbackup/fix/tool-break-sound
Audio: play break sound and track stats when tools break while mining
2026-10-30 04:33:26 +05:00
levzzz 919c6803c5 Merge pull request #3647 from iLostName/elder-curse-skips-cursed
elder guardian: a player already cursed isn't cursed again every minute
2026-10-30 04:33:10 +05:00
levzzz abce5d7864 Merge pull request #4044 from DenisHumen/fix/armor-stand-swing
Armor stands: placing one swings the hand, as vanilla does
2026-10-30 04:32:54 +05:00
levzzz 54ac508d90 Merge pull request #3686 from k3yh/fix/spawn-egg-entity-data
An op's spawn egg sets its entity data on a spawner
2026-10-30 04:32:37 +05:00
levzzz 2f6babf098 Merge pull request #3900 from DUzzL/fix/issue-3885-function-tag-dedupe
Fix O(n^2) function-tag resolution and tag cycles
2026-10-30 04:32:20 +05:00
levzzz df051f7089 Merge pull request #3906 from DUzzL/fix/issue-3889-explosion-drop-merge
Explosion drops merge by item, components and max stack size
2026-10-30 04:32:04 +05:00
DUzzL 084394a849 Keep campfire damage from making mobs panic 2026-10-30 00:32:02 +01:00
levzzz 706fc7aa13 Merge pull request #3907 from DUzzL/fix/issue-3884-recipe-count-range
Reject recipe result counts outside 1..=99 (Fixes #3884)
2026-10-30 04:31:55 +05:00
levzzz db0a98d645 Merge pull request #4017 from DUzzL/fix/issue-4013-blocked-fireball-no-ignite
Keep a shield-blocked small fireball from igniting its target
2026-10-30 04:31:26 +05:00
levzzz b8eb63db68 Merge pull request #4054 from DUzzL/fix/issue-4038-enderman-arrow-teleport
Arrows fly on when an enderman teleports away from them
2026-10-30 04:31:10 +05:00
Ludovic Marie e8d5059b6a Merge remote-tracking branch 'origin/main' into upd-3693 2026-10-30 00:31:02 +01:00
levzzz ce18dafd4e Merge pull request #3928 from xFedeT/fix/riptide-with-elytra
Riptide in rain works on a server's client: isInRain from its own chunks and weather
2026-10-30 04:30:26 +05:00
levzzz 971af532f9 Merge pull request #3991 from d3grando/fix-3393-darkness
Darkness dims the screen on servers and in single player
2026-10-30 04:30:10 +05:00
levzzz bdf9cb8eb0 Merge pull request #4029 from d3grando/fix-3810
No rain splashes or rain sound under a high roof
2026-10-30 04:29:42 +05:00
levzzz 1b90753fab Merge pull request #4033 from d3grando/fix-2780-wolfbeg
Wolves tilt their head at food they want
2026-10-30 04:29:26 +05:00
levzzz b890329854 Merge pull request #4035 from d3grando/fix-2893
Ender Dragon wings push the player only when their hit lands
2026-10-30 04:29:09 +05:00
levzzz e618347e38 Merge pull request #4036 from d3grando/fix-2780-babypet
Food grows a tamed baby cat or wolf instead of making it sit
2026-10-30 04:28:53 +05:00
d3grandoandClaude Opus 5.5 8c1f50f616 The Void superflat preset gets its stone start platform
FlatLevelGeneratorSettings.adjustGenerationSettings decorates a flat
world with its biome's placed features when `features` is on and the
world isn't all air, or its biome is the_void. The Void preset (the_void,
features, one air layer) so places the_void's only feature,
void_start_platform: a 33x33 stone square with cobblestone at 8, -61, 8.
FlatTerrain placed only the layers, so players fell into the void.

Biomes now keep each biome's `features` by step, FlatTerrain works out
the adjusted list and places void_start_platform (the ported
VoidStartPlatformFeature) when it is there. The other features, lakes
and structures are still not placed (#2912).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 06:28:52 +07:00
levzzz dbf445db2d Merge pull request #4053 from d3grando/fix-3616
Your body keeps up with the camera at Levitation 255
2026-10-30 04:28:37 +05:00
levzzz bf702cfe22 Merge pull request #3853 from DUzzL/fix/armor-stand-elytra-3843
Draw a worn elytra on armour stands
2026-10-30 04:28:20 +05:00
levzzz 03805b8eeb Merge pull request #3965 from GIGABAIT93/fix/shadow-scale
Entity shadows follow the entity's scale and age
2026-10-30 04:28:03 +05:00
levzzz c081525853 Merge pull request #3959 from DenisHumen/fix/golem-pattern-orientations
Golems: a snow or iron golem builds in any orientation, as vanilla does
2026-10-30 04:27:46 +05:00
levzzz 6a6acac27c Merge pull request #4022 from d3grando/fix-3098
Withers and golems build in any orientation, like vanilla
2026-10-30 04:27:30 +05:00
levzzz c5e9265bf0 Merge pull request #3797 from Bloodulon/pr/packs-overlay
Packs: read deflate entries to their end; skip a bad entry
2026-10-30 04:27:14 +05:00
levzzz 421834b82e Merge pull request #3799 from DenisHumen/fix/bucket-eye-block
Buckets and bottles pick up the water the eyes are in
2026-10-30 04:26:58 +05:00
levzzz a98cf88458 Merge pull request #3865 from elythepreciouscat/fix/server-disconnect-saving-screen
Disconnect: do not show saving world screen on external server
2026-10-30 04:26:41 +05:00
levzzz 79aca92478 Merge pull request #3867 from bxnjxmin27/fix/3689-screenshot-while-chat
Screenshots: the key works with chat, a sign or a book open
2026-10-30 04:26:25 +05:00
levzzz 48d29b20f1 Merge pull request #3873 from DUzzL/fix/issue-3863-breed-advancement
Fix breeding advancement and statistic on the server thread
2026-10-30 04:26:09 +05:00
levzzz 0229716f22 Merge pull request #3895 from ccclosed/fix/mob-effect-attribute-modifiers
Mobs: apply Weakness, Slowness and Health Boost attribute modifiers
2026-10-30 04:25:52 +05:00
levzzz a3809490f6 Merge pull request #3898 from Bloodulon/pr/item-definitions
Client: load item model definitions from nested folders
2026-10-30 04:25:36 +05:00
levzzz 8e49a414c2 Merge pull request #3857 from DUzzL/fix/issue-3854-lever-piston
Fix lever dropping when placed on a piston's back
2026-10-30 04:24:46 +05:00
levzzz 33e56c7a56 Merge pull request #3851 from DUzzL/fix/axolotl-nbt-glowing-test-3840
Fix axolotl NBT test: query glowing effect by namespaced id
2026-10-30 04:24:18 +05:00
d3grandoandClaude Opus 5.5 413e6e856e Swapping the same item into the off hand plays the re-equip animation
FirstPersonHandsAndItems.shouldInstantlyReplaceVisibleItem keeps the
visible item when it is the same ItemStack object, or one that
matchesIgnoringComponents (count, item and components, with damage
ignored). Horizon stood in for the object by the slot, so the off hand,
always the same slot, kept showing a stack of the same item that the
swap key had replaced, whatever its count (#2866).

A swap now marks both hands as holding new stacks: at once in the local
game, and on a server (the thread one included) when the slot updates
that answer SWAP_ITEM_WITH_OFFHAND arrive. Those hands then compare by
matchesIgnoringComponents until they show the held stack again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 06:24:02 +07:00
Ludovic MarieandClaude Opus 5.5 23c5335910 Block entity rendering: reuse the meshes' face visibility instead of loading it again
BlockEntityRenderer loaded occlusion.nbt and the render definitions a second
time and built its own FaceVisibility, whose shapes then computed their faces
again: 13.6 MB of face shapes, twice. It now takes a clone of the mesh
tables' visibility, which shares the shapes and their cached faces.
Probes and tests that load the renderer alone still load their own.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 00:18:41 +01:00
Ludovic MarieandClaude Opus 5.5 37a1e8859f Merge main: RemoteTextDisplay::new takes what the display shows
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 00:18:16 +01:00
Ludovic MarieandClaude Opus 5.5 ae0512e299 Merge main: the composter's useItemOn result is an InteractionResult
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 00:17:37 +01:00
septydev c449d797bd Fix account chip text overflow 2026-10-30 01:17:01 +02:00
Ludovic Marie 6d666c30e2 Merge remote-tracking branch 'origin/main' into upd-3776 2026-10-30 00:16:56 +01:00
Ludovic Marie 8c3d85eb58 Merge remote-tracking branch 'origin/main' into upd-3642 2026-10-30 00:16:56 +01:00
oscargzss 8bbfc5cbf0 renderer: try a backend again with non-conformant adapters
wgpu hides every adapter whose driver reports Vulkan conformance version 0
unless `ALLOW_UNDERLYING_NONCOMPLIANT_ADAPTER` is set, and Mesa reports
0.0.0.0 for hasvk, which drives Ivy Bridge and Haswell. Such a GPU is told
it has no driver while Vulkan runs, and the only escape was the player's
environment variable.

`open_device` now asks a backend that offered no adapter at all a second
time with those adapters shown, and says in the log which adapter it took.
Every machine where a backend already gives an adapter is untouched.

Fixes #4059
2026-10-29 17:15:13 -06:00
Ludovic Marie 4bd1313677 Merge pull request #4049 from horizon-rust/fix/launcher-java-home-version
🤖 Agent: A Java instance's Home no longer shows Horizon's version picker or nightly updates; its chip names its own version and loader. Checked in the real launcher (scratch homes, Fabric Java instance and Horizon instance), launcher fmt/clippy/278 tests pass on this head.
2026-10-30 00:14:55 +01:00
Ludovic Marie 6eeeb454f5 Merge pull request #3805 from DenisHumen/fix/rea-vanilla-windows
🤖 Agent: Ludovic's AI agent (Claude), triage. Tooling only: `npx` is resolved by path (`npx.cmd` on Windows), with a clear error when it's missing. verify is green. Queued.
2026-10-30 00:14:52 +01:00
Ludovic Marie 4592a7e799 Merge remote-tracking branch 'origin/main' into upd-3655
# Conflicts:
#	crates/horizon-client/src/game/remote.rs
2026-10-30 00:14:42 +01:00
Ludovic Marie 5dc59b0f6a Merge remote-tracking branch 'origin/main' into upd-3748
# Conflicts:
#	crates/horizon-client/src/game/command_blocks.rs
2026-10-30 00:11:18 +01:00
DUzzL e93427276f Hurt mobs standing in a lit campfire (#4037)
CampfireBlock.entityInside hurts any living entity in a lit campfire for 1 (2 for soul campfires) with the campfire damage type, which is fire, makes mobs panic and does not knock back. Mobs ignored campfires entirely.
2026-10-30 00:11:15 +01:00
arismoko 8eb2ecfa76 Preserve loot name components in item commands 2026-10-29 18:10:27 -05:00
Ludovic Marie c3071c7b61 Merge pull request #3575 from d3grando/fix-3153
🤖 Agent: pr-triage-1 (Ludovic's AI agent, Claude), not Ludovic himself. Thanks for the fix: with the wither held in place the scenario now matches vanilla. On this head (f5de793b3) merged into current main, the harnesses this change can reach pass: `command_exec`'s wither spawn (4/4), wither breaks (9/9) and ender dragon (5/5) groups match vanilla. Its 2 remaining mismatches are `/data get` printing a `custom_name` as a component; they come from main and this PR doesn't touch them. fmt, clippy and the horizon-client tests pass too. Queued for merge.
2026-10-30 00:09:06 +01:00
DUzzL 80cb00a494 Arrows fly on when an enderman teleports away from them 2026-10-30 00:08:47 +01:00
d3grandoandClaude Opus 5.5 5550a6c327 Read the glint clock and options once per frame, not per item
Game::glint() and glint_ticks() read the clock and looked glintSpeed and
glintStrength up by name (a linear scan of the options table) for every
item submitted, so a frame with thousands of dropped items read the clock
thousands of times. Vanilla snapshots the options once per frame
(GameRenderer.extract -> extractOptions into OptionsRenderState) and
TextureTransform.setupGlintTexturing reads Util.getMillis() once per glint
render-type batch. Capture a GlintFrame at the start of each render() and
let world items, armour, held items and GUI items read it.

Fixes #3183

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 06:06:42 +07:00
Ludovic MarieandClaude Opus 5.5 fcea81151c Launcher: a Java instance's Home shows its own game, not Horizon's versions
Home drew Horizon's version picker ("No version" or a nightly) beside a Java instance's Play,
and offered Horizon's next nightly in its hero. A Java instance now shows neither: its chip
says its Minecraft version and loader ("Minecraft 1.21.1 · Fabric 0.16.9").

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 00:05:05 +01:00
d3grandoandClaude Opus 5.5 70e83d9f65 Don't assert that a zombie pushes the ridden camel
Entity.push(Entity) never moves an entity that isVehicle, so in vanilla
a camel carrying a husk is not pushed by a zombie either. The test now
checks only that the camel still pushes the zombie.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 06:04:11 +07:00
d3grandoandClaude Opus 5.5 14d453048e Your body keeps up with the camera at Levitation 255
The third-person model dropped its interpolation whenever it moved more
than 10 blocks in a tick, while the camera kept lerping from the old
position. Levitation 254/255 rises about 12 blocks a tick, so the body
sat a whole tick ahead of the camera and left the frame.

The model now lerps from the player's own old position, as vanilla's
EntityRenderer.extractRenderState does from Entity.xOld/yOld/zOld, the
same one Camera.setup uses. Teleports and respawns already reset that
old position, so they still jump without a sweep.

Fixes #3616

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 06:03:07 +07:00
Сидоренко Егор АлекчеевичandCodex db38f50b12 Fix detail requests for retiring fine LOD leaves
Seed the existing bounded request path with planned retiring leaves still missing saved detail, so full-detail geometry can retire after its replacement is ready.

Fixes #4039

Co-Authored-By: Codex (GPT-6) <[email protected]>
2026-10-30 02:01:27 +03:00
DUzzL 8a773bca20 Play the fall damage sound for multiplayer clients and LAN guests 2026-10-30 00:00:06 +01:00
Ludovic Marie 224b99b724 Merge pull request #3930 from DUzzL/fix/issue-3916-dead-code
🤖 Agent: Ludovic's AI agent (Claude), triage. Removes `ctov.rs`'s modular_compat code, which nothing calls any more (lithostitched owns that processor), with no change in behaviour. verify is green. Queued.
2026-10-29 23:59:44 +01:00
d3grandoandClaude Opus 5.5 d4a973f65f Creative inventory: the Operator Utilities tab for operators
The Operator Items Tab option was greyed out and nothing read it: the
creative export was built without permissions, so the operator tab had no
stacks and was dropped.

VanillaCreativeTabsExporter now builds the tabs with permissions and marks
the stacks only that build lists (permissions_only). Creative keeps every
exported stack and rebuilds its tabs and search tab for hasPermissions
(canUseGameMasterBlocks and the option), as CreativeModeInventoryScreen
does on opening and in containerTick (tryRefreshInvalidatedTabs): a
selected operator tab left empty gives way to the default tab. The option
is switchable again. test_creative_parity.py runs with and without
permissions.

Part of #3393.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 05:59:03 +07:00
Ludovic Marie e8ecd77cc8 Merge pull request #3879 from matyden/tools/port-publish-utf8
🤖 Agent: Ludovic's AI agent (Claude), triage. Tooling only: the issue body is written as UTF-8 whatever the code page. verify is green. Queued.
2026-10-29 23:57:20 +01:00
Ludovic Marie 97b6e16684 Merge pull request #3696 from xFedeT/fix/chicken-water-malus
🤖 Agent: Ludovic's AI agent (Claude), triage. Main gained another mob_ai case beside yours, so I merged main into your branch (no rebase). The only conflict was the new cases' place in `tools/test_mob_ai_parity.py`, and both are kept. Requeued at the merged head.
2026-10-29 23:57:16 +01:00
DenisHumenandClaude Opus 5.5 fdc7593180 Armor stands: placing one swings the hand, as vanilla does
ArmorStandItem.useOn returns SUCCESS once the stand fits (FAIL on a bottom
face or when something is in its box), and SUCCESS swings the hand. The
local placement now swings, and a server's client runs the same check in
startPrediction, before UseItemOn goes out, and swings when it holds.

armor_stand_spawn holds the checks both share.

Fixes #4024

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 00:57:02 +02:00
d3grandoandClaude Opus 5.5 152258bb83 server_knockback harness: creative players near a crystal and TNT
KnockbackClient records the push each ClientboundExplodePacket carries;
two cases put Bob in creative two blocks from an end crystal he hits and
from primed TNT.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 05:54:10 +07:00
d3grandoandClaude Opus 5.5 51cd5409da Creative players are pushed by explosions and crystals
ServerExplosion.hurtEntities puts each pushed player in hitPlayers and
ServerLevel.explode sends them that push in ClientboundExplodePacket. Horizon
pushed the server's copy only and sent it to the client with a hurt's motion
packet, which a creative player never gets: a crystal they hit left them
standing, and TNT replaced their motion with the server copy's. The pushes
now go in the explosion packet (deferred with it in a guest's turn), except
for a hurt player, whose motion packet already carries the push.

Fixes #2755 (its survival part was fixed by #2730).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 05:54:10 +07:00
Ludovic MarieandClaude Opus 5.5 0e4f8e2799 Merge main into hdr-screenshot (HDR tiers, black level, UI brightness, world icons)
Hdr::params now fills main's 20-float layout for both the swapchain and the
HDR10 capture; the capture keeps its own pipeline and parameters. Screenshots
use main's ScreenshotRequest and copy_frame; only full-frame requests (not
world icons) get the -hdr.png copy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 23:52:47 +01:00
Ludovic Marie 4464c5d64a Merge remote-tracking branch 'origin/main' into upd-3735
# Conflicts:
#	tools/test_mob_ai_parity.py
2026-10-29 23:52:44 +01:00
Ludovic Marie b0c2f375bb Merge remote-tracking branch 'origin/main' into upd-3729
# Conflicts:
#	tools/test_mob_ai_parity.py
2026-10-29 23:52:42 +01:00
Ludovic Marie 183e772727 Merge remote-tracking branch 'origin/main' into upd-3721
# Conflicts:
#	tools/test_mob_ai_parity.py
2026-10-29 23:52:39 +01:00
Ludovic Marie c41e95bf53 Merge remote-tracking branch 'origin/main' into upd-3712
# Conflicts:
#	tools/test_mob_ai_parity.py
2026-10-29 23:52:37 +01:00
Ludovic Marie 3887ceefec Merge origin/main into feat/launcher-night-shell 2026-10-29 23:48:53 +01:00
Ludovic MarieandClaude Opus 5.5 0d322f4fca Launcher: hover layers only while hovered, plates painted in one canvas
A row or tab that isn't hovered no longer builds its (invisible) hover plate, and plate::cut
paints its rectangles in one canvas instead of a div each: the sidebar and the top bar redraw
on every sky frame, so they cost a few elements instead of hundreds.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 23:48:04 +01:00
degepieandClaude Sonnet 5.5 b1dcbdc0eb A raised shield (or any item in use) stops a sprint from starting
LocalPlayer.canStartSprinting refuses while isSlowDueToUsingItem (an item in
use whose use_effects do not set can_sprint), and LocalPlayer.aiStep zeroes
the double-tap window while it holds. The sprint phase had the condition but
the player never fed it, so the sprint key or a double-tap of forward could
start a sprint with a shield up, which vanilla does not allow (measured: 0.055
blocks per tick against 0.043 for the shielded walk). Items now carry
use_effects.can_sprint (spears set it) and the window passes the state to the
sprint phase.

Fixes #3422

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UE3PMKbnTcxfBSeT5uQWCK
2026-10-30 03:46:46 +05:00
d3grandoandClaude Opus 5.5 450ff69b4e Food grows a tamed baby cat or wolf instead of making it sit
The owner's sit toggle on tamed wolves and cats only stood aside for food
an adult could breed with (age 0, not in love), so fish or meat on a tamed
baby flipped it between sitting and standing and it never grew.

Wolf.mobInteract and Cat.mobInteract call TamableAnimal/Animal.mobInteract
first and toggle setOrderedToSit only when that did not consume the click;
Animal.mobInteract takes the food from an adult that canFallInLove at age 0
or from a baby that canAgeUp (AgeableMob.canAgeUp: isBaby and not
isAgeLocked), growing it by getSpeedUpSecondsWhenFeeding.

mobs::ai::takes_food is that test, shared by the sit guards and
feed_animal (which now also leaves age-locked babies alone, as canAgeUp
does).

Part of #2780.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 05:46:18 +07:00
Ludovic Marie 3c8a73f86f Merge remote-tracking branch 'origin/main' into upd-3773
# Conflicts:
#	tools/test_mob_ai_parity.py
2026-10-29 23:46:15 +01:00
Ludovic Marie f58660a875 Merge remote-tracking branch 'origin/main' into upd-3732
# Conflicts:
#	tools/test_mob_ai_parity.py
2026-10-29 23:46:12 +01:00
Ludovic Marie 49aa9dd00b Merge remote-tracking branch 'origin/main' into upd-3696
# Conflicts:
#	tools/test_mob_ai_parity.py
2026-10-29 23:46:09 +01:00
d3grandoandClaude Opus 5.5 b3fdebcb92 Ender Dragon wings push the player only when their hit lands
EnderDragon.knockBack pushes the server's copy of every player in a wing's
zone each tick, but a player's own client only receives its velocity when a
hurt marks it (LivingEntity.hurtServer's markHurt, sent by
ServerEntity.sendChanges). Horizon added the push straight to the player's
velocity on every tick they stayed in the zone, perched dragon or not, so
players were flung several blocks per tick around the exit portal.

The push now goes out only with a 5-damage wing hit that lands outside the
hurt cooldown: never under a perched dragon (isSitting), and not within 2
ticks of a mob's hurt (getLastHurtByMobTimestamp() < tickCount - 2). The
vertical push is 0.2f widened, as in vanilla.

Fixes #2893

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 05:45:42 +07:00
d3grandoandClaude Opus 5.5 c744e51084 Keep same-vehicle mobs in the cramming count, and test the camel fix
Entity.push returns at once for isPassengerOfSameVehicle, but
EntitySelector.pushableBy does not drop such a mob: it still counts for
cramming in LivingEntity.pushEntities, and Warden.doPush still runs for
it before Entity.push. push_entities now skips only the push itself.

A unit test for each half of #3199 (a camel and its husk never push each
other; RandomSitting never starts with a husk on its back or with a
lead, and does with nothing or a slime there), with a shared test world
builder in mobs/world.rs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 05:44:16 +07:00
d3grandoandClaude Opus 5.5 7f1edb9263 A camel and the husk on its back no longer push each other
LivingEntity.pushEntities pushed every pushable mob overlapping the box,
the rider and its own vehicle included. A husk sits half a block toward
the camel's front (Camel.getPassengerAttachmentPoint), inside the camel's
box, so each tick it pushed the camel backwards and the camel pushed
back: the camel slid off tail first and kept speeding up. Entity.push
skips passengers of the same vehicle (isPassengerOfSameVehicle: the same
root vehicle); pushEntities now does too, through the vehicle every Seen
mob now carries.

CamelAi.RandomSitting also checked only for a player on the camel's back.
Vanilla needs no controlling passenger at all (hasControllingPassenger),
and a husk is one (Mob.getControllingPassenger: a mob rider outside
#non_controlling_rider), so a camel carrying a husk sat down at night with
the husk floating above it. The goal now checks the mob rider, and the
leash vanilla's checkExtraStartConditions also checks.

Fixes #3199

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 05:44:16 +07:00
d3grandoandClaude Opus 5.5 3ffaf67e22 Wolves tilt their head at food they want
BegGoal sets Wolf.DATA_INTERESTED_ID on the server, but the LAN host
never sent entry 20 and a client never read it, so every window
(single player joins its server thread the same way) kept the head
straight. Send the flag with its default, read it into the remote
wolf, and run the part of Wolf.tick both sides run on the client:
interestedAngle eases 0.4 of the way toward the flag each tick, which
getHeadRollAngle turns into the head's roll.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 05:43:53 +07:00
Claude 396ba2e5e7 Turn the player when a server sends PlayerLookAt
ClientboundPlayerLookAtPacket was decoded as an unknown packet, so
`/teleport ... facing` and `/rotate ... facing` on a server never turned
the camera. Decode it and port ClientPacketListener.handleLookAt:
Entity.lookAt from the player's feet or eyes towards the packet's entity
(its feet or eyes) when the client tracks it, else towards the point.

Part of #3518.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Rx5M6NS763D2WVnb2HmcTH
2026-10-29 22:42:00 +00:00
Ludovic MarieandClaude Opus 5.5 3d68cb4d71 Merge main: CustomHeadLayer beside main's player pumpkin (#3584)
head_item_geometry now draws the local player's and other players' head
items; main's player_pumpkin_geometry stays only for LAN guests drawn on
the in-frame host, whose models carry no worn stacks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 23:41:28 +01:00
Ludovic Marie bd665f28ad Merge pull request #3782 from xFedeT/fix/armor-stand-bubble-column
🤖 Agent: Ludovic's AI agent (Claude), triage. `travelInWater` (the 0.8 slowdown, then `getFluidFallingAdjustedMovement` with gravity/16) and the bubble column push for armour stands match vanilla. The per-tick water scan only covers the stand's own box. CI parity is green at this head. Queued.
2026-10-29 23:40:26 +01:00
JustKarkat 2982f6eb9a Add shadow_color coverage to the text display render parity test
Fixes #3531's render side landed in #3341; this adds the shadow cases its
branch carried for tools/test_text_display_render_parity.py so the
packed ARGB ints, the [r, g, b, a] lists and NO_SHADOW=0 are checked
against the vanilla TextDisplayRenderer oracle.
2026-10-29 17:40:25 -05:00
Ludovic Marie 499a08ba81 Merge pull request #3690 from xFedeT/fix/fish-random-swimming-parity
🤖 Agent: Ludovic's AI agent (Claude), triage. `WaterAnimal` and `AgeableWaterCreature` set the WATER malus to 0, and FishMoveControl's yaw uses `Mth.atan2` in degrees. CI parity (mob_ai with new fish cases) is green at this head. Queued.
2026-10-29 23:40:22 +01:00
Ludovic MarieandClaude Opus 5.5 10e715be15 Dedicated server: no block sprite pixels, which only the renderer reads
A dedicated server loads the block models and the sprites' layers, as before,
but no longer lays out the texture array's pixels or the animations' frames:
nothing draws them. The integrated server shares the window's resources and
is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 23:36:59 +01:00
Ludovic Marie 7f54b8abb4 Merge pull request #2705 from senjinthedragon/hdr-tiers
🤖 Agent: pr-triage-1: the parity run was cancelled (not failed); I reran it on this same head.
2026-10-29 23:36:18 +01:00
Ludovic Marie 573140cc5a Merge pull request #3639 from xFedeT/fix/wither-immune-to-wither-friends
🤖 Agent: Ludovic's AI agent (Claude), triage. `WitherBoss.hurtServer` ignores damage whose source entity is in `#wither_friends` (the undead), for explosions and wither skulls alike. CI parity is green at this head. Queued.
2026-10-29 23:35:00 +01:00
Ludovic Marie bdd6275570 Merge pull request #3722 from vvnikita74/fix/no-day-sleep-thunder-flag
🤖 Agent: Ludovic's AI agent (Claude), triage. Sleeping now follows the sky darkening (`skyDarken >= 4`, `isDarkOutside`) instead of a fixed time window or the thunder flag alone, so a thunderstorm at noon allows it and rain alone doesn't. CI parity is green at this head. Queued.
2026-10-29 23:34:55 +01:00
Ludovic Marie 588c0ea77a Merge pull request #3779 from leifiyoo/fix/powered-minecart-speed
🤖 Agent: Ludovic's AI agent (Claude), triage. `MinecartFurnace.push` is a Vec3, and `calculateNewPushAlong` (`projectedOn(...).normalize().scale(push.length())`) keeps its 3D length; saving drops y as `addAdditionalSaveData` does. CI parity is green at this head. Queued.
2026-10-29 23:34:52 +01:00
Ludovic Marie 3f08e59ad2 Merge pull request #3767 from leifiyoo/fix/template-block-entity
🤖 Agent: Ludovic's AI agent (Claude), triage. Matches `StructureTemplate.placeInWorld`, which sets a barrier wherever saved data goes, so the old block entity always goes and the template's data always loads. CI parity is green at this head. Queued.
2026-10-29 23:34:48 +01:00
Ludovic Marie 518ecfb511 Merge pull request #3750 from leifiyoo/fix/chunk-block-entity-replace
🤖 Agent: Ludovic's AI agent (Claude), triage. Read the whole diff: a loaded chunk's block entity replacing one at the same position keeps its ticker slot only if the new state ticks, as `LevelChunk.setBlockEntity` + `updateBlockEntityTicker` do. CI parity is green at this head. Queued.
2026-10-29 23:34:45 +01:00
d3grandoandClaude Opus 5.5 5b3b108515 A small player's server box follows minecraft:scale
The server's copy of a player never ran LivingEntity.refreshDirtyAttributes,
so after /attribute ... minecraft:scale it kept the old 0.6 x 1.8 box until
the pose changed: a small player was sent back from every wall they walked
along and suffocated next to one. guest_server_tick now runs aiStep's spin
countdown, refreshDirtyAttributes (onAttributeUpdated(SCALE) ->
refreshDimensions) and updatePlayerPose in vanilla's order, and in_wall
takes the eye box from the body's width (Entity.isInWall, width * 0.8)
instead of a fixed 0.48.

Part of #3684.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 05:34:25 +07:00
levzzz 6daad36de2 Merge pull request #3931 from arismoko/content-identity-handshake
Reject mismatched content block registries
2026-10-30 03:31:18 +05:00
Ludovic Marie 91635b6852 Merge pull request #3637 from horizon-rust/feat/launcher-night-sky
🤖 Agent: Redesign R2 (the animated night sky behind every page), stacked on #3636 which merged; approved by Ludovic 2026-10-29 (8 px/s clouds accepted); launcher fmt/clippy/tests and sky.rs tests pass on this head, CI green.
2026-10-29 23:30:36 +01:00
d3grandoandClaude Opus 5.5 58cdd754cd No rain splashes or rain sound under a high roof
ClientLevel.tickWeatherEffects reads the MOTION_BLOCKING heightmap for
each splash column, but the client scanned down from 64 blocks above the
camera, so under a roof higher than that (a deep excavation) it found
the floor and made rain particles and the rain sound there. The splash
columns, the sound's roof check and the animate tick's isRainingAt now
read the chunk heightmap that the rain columns already use.

Fixes #3810

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 05:30:02 +07:00
Ludovic Marie 0e15c274da Merge pull request #3636 from horizon-rust/feat/launcher-night-specimen
🤖 Agent: Redesign R1b (the night look's specimen page, pixel-cut plates in plate.rs), stacked on #3635 which merged; approved by Ludovic 2026-10-29; launcher fmt/clippy/tests and plate.rs tests pass on this head, CI green.
2026-10-29 23:28:48 +01:00
Ludovic MarieandClaude Opus 5.5 3b6972a40a Slowness: the -0.15F modifier widened from a float, as vanilla's MobEffects
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 23:27:40 +01:00
Ludovic Marie 829c4021a3 Merge pull request #3635 from horizon-rust/feat/launcher-night-tokens
🤖 Agent: Redesign R1 (night tokens, Bricolage with Geist's Cyrillic, pixel-cut corners), approved by Ludovic on 2026-10-29; launcher fmt/clippy/278 tests and horizon-theme tests pass on this head, CI green.
2026-10-29 23:26:38 +01:00
DUzzL 7a12e4444a Keep a shield-blocked small fireball from igniting its target 2026-10-29 23:25:57 +01:00
DenisHumenandClaude Opus 5.5 c3e9ec54a9 Sleeping: lie 0.125 above the bed's top, as vanilla does
LivingEntity.setPosToBed puts a sleeper at the bed's x/z centre and at
pos.y + getSleepHeight + 0.125, getSleepHeight being the top of the bed's
shape (0.5625). Horizon left out the 0.125, so the player and sleeping
villagers lay 0.125 lower, and the first-person camera (eye 0.2 + 0.15)
ended up inside the player's own head.

Fixes #4006

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 00:25:36 +02:00
d3grandoandClaude Opus 5.5 dff6db1e86 Hide the own body when the server sets the player's invisible flag
Entity.isInvisible reads shared flag 5, which a server sets with the
Invisibility effect or alone through Player.setInvisible, as pose plugins
(GSit's lay, crawl, spin) do to hide the real body under the pose. The client
read the flag for other entities only and hid its own body, cape, first-person
arm and name tag (and thinned its effect swirls) only for the effect, so the
real body showed under the pose.

Keep the own flag from SetEntityData (reset on login and on a respawn without
KEEP_ENTITY_DATA) and use it with the effect wherever the own player's
isInvisible is asked.

Fixes #3788

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 05:24:39 +07:00
Ludovic MarieandClaude Opus 5.5 71127f982f Launcher: the night frame, a sidebar plate over the sky and a top bar of tabs (redesign R3)
shell.rs draws the frame's parts: the sidebar's translucent plate from the window's top to its
bottom (wordmark, instances, servers, links, version), rows and tabs on pixel-cut plates when
selected and eased in at half opacity when hovered, the account chip with the signed-in
account's face. The top bar sits over the pages only, without a plate. Java instances say
their version and loader in the sidebar and get no preparing state. hover_layer's easing is
now hover_fade, for layers of any shape; blocks::side_item is gone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 23:23:20 +01:00
Ludovic MarieandClaude Opus 5.5 a72876f0c0 dedicated_server harness: Horizon's server brand is "horizon"
The one intended difference from vanilla's server (MinecraftServer.getServerModName):
the harness checks Horizon sends brand=horizon, then compares the rest as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 23:22:02 +01:00
Federico Tagliani 39314175e9 Merge remote-tracking branch 'origin/main' into fix/wind-burst-smash 2026-10-29 23:21:58 +01:00
Federico TaglianiandClaude Sonnet 5.5 88b9342ffc Mace smash on another player: the attacker's side of hurtEnemy and the Wind Burst launch
Player.itemAttackInteraction ran only for a mob victim, so smashing a
player never stopped the fall, never fired the Wind Burst explosion on the
attacker and never wore the weapon.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-29 23:21:57 +01:00
DUzzL 21a033cea0 Trial Omen and Bad Omen of a server's players make trial spawners ominous 2026-10-29 23:21:28 +01:00
d3grandoandClaude Opus 5.5 4b09c9d7d1 Thrown eggs and snowballs turn with the camera, no flip looking straight up
The item billboard of eggs, snowballs, ender pearls, fireballs and llama
spit took its right axis from forward x Y. At pitch exactly ±90 forward is
vertical; f32 cos(90°) is slightly negative, so the axis flipped sign and
the sprite turned upside down. It also ignored third-person front view.

ThrownItemRenderer.submit rotates the item by CameraRenderState.orientation
(Camera.setRotation: rotationYXZ(π - yaw, -pitch, 0), turned round in front
view). Use the same rotation: camera_orientation's math moves to a free
camera_rotation so the billboard's axes come from it.

Part of #3393

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 05:18:25 +07:00
unknownandClaude 1761eb0842 Renderer: a Validation acquire recovers, animated sprites layout stays inside the error scopes
Opening a world fullscreen could crash ~8s into the loading screen (#3866).
Two faults stacked up:

- draw_frame answered CurrentSurfaceTexture::Validation with Err on every
  frame; the loading screen runs ControlFlow::Poll, so the warn ran ~16k
  times a second (130k log lines in the report) while nothing recovered.
- SpriteAnimator::new asked the animated sprites pipeline for its bind
  group layout after the error scopes in pipeline() had been popped. A
  device lost during that window makes create_compute_pipeline return a
  silent invalid placeholder (device-lost errors bypass the scopes), so
  the scopes saw nothing, and the out-of-scope get_bind_group_layout then
  hit wgpu's uncaptured-error path and panicked. pipeline() now returns
  the layout queried while the scopes are open, where a validation error
  is caught and the CPU path takes over, as it already does for drivers
  without working compute shaders.

Validation on acquire now gets the swapchain a fresh configuration like
Outdated does, then reattaches the window like Lost does once that has
not helped, and a frame is skipped (Ok(false)) instead of failed; the
counter resets on the next acquired frame.

Fixes #3866

Co-Authored-By: Claude <[email protected]>
2026-10-30 01:17:39 +03:00
Ludovic Marie 1884052eda Merge pull request #3471 from d3grando/bench-windows-results
🤖 Agent: pr-triage-1: read the new head. It only merges main and replaces the RD 8 and RD 32 reports with reruns on an idle machine, so the write-up no longer leans on runs with builds alongside. tests/test_perf_bench.py and the public tree check pass. skip-release stays. Thank you!
2026-10-29 23:17:02 +01:00
Claude 0801c954b5 Drag the stonecutter and villager trade scrollers
The scrollers on the stonecutter and merchant screens only moved with the
mouse wheel: pressing and dragging them did nothing. Port
StonecutterScreen.mouseClicked/mouseDragged and
MerchantScreen.mouseClicked/mouseDragged, and keep the stonecutter's
scrollOffs as a float like vanilla so the wheel and the scroller share it.

Part of #3518.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Rx5M6NS763D2WVnb2HmcTH
2026-10-29 22:14:39 +00:00
d3grandoandClaude Opus 5.5 5200d36a7b Withers build in any orientation, like vanilla's BlockPattern
The wither checks (WitherSkullBlock.checkSpawn and the dispenser's
canSpawnMob) only tried upright T builds with the arms along X or Z.
Vanilla's BlockPattern.find tries all 24 forwards/up pairs from every
corner in the cube at the placed block, so flat, upside-down and
sideways withers build there.

Port BlockPattern (find, matches, translateAndRotate) to
horizon_client::block_pattern with WitherSkullBlock's full and base
patterns, and use it for checkSpawn and canSpawnMob. The wither now
takes its yaw from the match's forwards axis (main had it inverted for
upright builds), its base blocks from #minecraft:wither_summon_base_blocks,
and its summoned_entity trigger from the 50-block box, sharing the
golems' box check.

Fixes #3098.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 05:14:38 +07:00
Ludovic Marie 2204e39515 Merge pull request #2987 from kacpherek/fix/entity-physics-lan-parity
🤖 Agent: proven by pr-triage-3 (Ludovic's AI agent) on union/pt3-w2 db5591ac7: parity --changed all passed, clippy, tests, lan_e2e 11 checks on both paths; tipped/spectral arrows and text/block/item displays drawn alike by host and LAN guest, save and reload identical, the ominous item spawner seen by a LAN guest. Mojang rules, supply chain, per-tick cost read.
2026-10-29 23:13:04 +01:00
d3grandoandClaude Opus 5.5 a18c9206d9 Falling sand and gravel ride bubble columns
FallingBlockEntity.tick runs Entity.applyEffectsFromBlocks after its move,
and BubbleColumnBlock.entityInside lifts or drags it like any other entity
(Entity.handleOnAboveBubbleColumn / handleOnInsideBubbleColumn). Horizon's
fall_step only looked for cobwebs on the path, so sand dropped into a soul
sand column sank to the bottom.

The cobweb sweep now visits each block checkInsideBlocks reaches once, with
vanilla's intersects flag (every block of a move a block or longer, else
only those the box ends in), and a bubble column there pushes the block and
resets its fall below the surface. The bubble column lookup and push are
split out of bubble_column_push so items and mobs share them. Velocity is
zeroed on collided axes before the effects, as Entity.move does.

Part of #3393

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 05:12:39 +07:00
DUzzL ad9f9a66f6 LAN guests and single-player windows pick up arrows they touch (#3997) 2026-10-29 23:11:26 +01:00
arismoko cfff58e66f Reject mismatched content block registries 2026-10-29 17:10:20 -05:00
Ludovic MarieandClaude Opus 5.5 ba59ac2ccf Dedicated server: build only the font atlas, as the integrated server does
A dedicated server draws nothing, yet it built the full HUD atlas (GUI,
particles, maps, skins) and the title panorama. The integrated server's
game already holds only the font, which books and chat measure with, and a
one-pixel panorama; both now come from UiResources::server, and the
dedicated server's synchronous load uses it too.

Idle, fresh world, 3 interleaved runs: RSS 836/836/841 -> 771/792/765 MB,
ready 5.05 -> 4.32 s (median).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 23:06:19 +01:00
levzzz c1255761d6 Merge pull request #3871 from arismoko/upstream/named-hook-catalog
Catalog versioned native hook points
2026-10-30 03:05:20 +05:00
levzzz a88e84f3c9 Merge pull request #3880 from arismoko/native-bundle-data
Allow data files in native mod bundles
2026-10-30 03:05:09 +05:00
Federico TaglianiandClaude Sonnet 5.5 7ca3671df3 tests: the remote_motion fixture knows the hook motion method
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-29 23:02:36 +01:00
Ludovic Marie 33f0fa8c94 Merge pull request #3341 from damnurmum/fix/rich-item-name-colors
🤖 Agent: proven by pr-triage-3 (Ludovic's AI agent): 6da84cf19 was proven on union/pt3-w2; this head only merges main and adapts main's two new held-item tests to the Tag custom name. Workspace check, 1508 tests and the 11 item/save harnesses pass on it.
2026-10-29 23:02:14 +01:00
d3grandoandClaude Opus 5.5 42ff9e6482 Players and heads keep their skins on busy servers
The 128 atlas skin slots went round every frame once more skins were in
use than slots: update_remote_skins touched every player-list entry's skin,
each frame's uploads pushed out the least recently shown one (even one drawn
the frame before), and that one came back the next frame by pushing out
another. Players vanished for a frame (their name tag stayed) and heads
swapped to the default skin and back.

- skins::SkinSlots holds the slots: a new skin takes a free slot or the
  least recently drawn one, never one drawn in the last frame; with every
  slot drawn it waits and its player keeps the default skin.
- Downloader::drawn records what each frame draws (level players and their
  capes, the local player, mannequins, the faces the tab list and spectator
  menu show, skull blocks, item and text heads).
- Only drawn skins ask for a slot, not every player-list entry, and a skin
  not in the atlas yet draws the default one (SkinManager.createLookup's
  getNow(DefaultPlayerSkin.get)) instead of a missing texture.

Fixes #3829

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 05:01:48 +07:00
d3grandoandClaude Opus 5.5 b495d4931e Light a column again when an edit darkens it beside an unlit one
Generated worlds saved impossible block light at chunk borders: an air
block at 0 beside one at 6 (#2786). A column is lit from the blocks of
its whole 3x3, so it holds light from a neighbour whose own light job
has not landed yet. An edit in it then runs the incremental relight,
which reads only lit columns: its darkening removes that neighbour's
light and nothing can put it back, and the neighbour's job landing
does not relight the column. The stale border stays, and is saved.

Columns whose light an edit (or a replayed edit) changed beside a
loaded, unlit column now get a full light job, as vanilla's light
engine, with one light storage for every chunk, never loses it.

Fixes #2786

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 04:59:05 +07:00
Ludovic Marie 4f3457a4dc Merge pull request #2689 from levzzz5154/fix/end-gateway-entities
🤖 Agent: verified by Ludovic's AI agent (pr-triage-2, Claude) at c566e69c6, merged with current main: the End gateway follows EndGatewayBlock.entityInside and Entity.handlePortal; the latest commit puts back the tick_items call that the first one had dropped (dropped items fall, merge and despawn again) and, as Entity.setAsInsidePortal does, only restarts the portal cooldown of an entity that is still cooling down (checked against the 26.3 bytecode). clippy -D warnings, the portal/gateway/item unit tests and tools/singleplayer_end_cargo_audit.py on both paths pass (cow and a 7-diamond stack arrive at [1035.5, 76.0, 1.5]). Thanks @levzzz5154.
2026-10-29 22:58:08 +01:00
d3grandoandClaude Opus 5.5 0ce65d34c6 Both mouse buttons at once replace the block in creative
Minecraft.tick picks the crosshair's hitResult once, before
handleKeybinds, and startAttack, startUseItem, continueAttack and
pickBlockOrEntity all read that one result. Horizon re-picked for every
click, so after a creative START predicted the break, the use in the
same tick aimed past the broken block (at nothing, or the block behind).
InteractionInput::tick now pins the tick's hit result around the clicks.

The server also deferred a creative START to its guest tick, after the
UseItemOn that followed it in the same batch, which then placed against
the old block before it broke. ServerPlayerGameMode.handleBlockBreakAction
destroys at once for an instabuild player (destroyAndAck "creative
destroy"); the host now does too.

Fixes #3006

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 04:58:07 +07:00
Ludovic Marie 117241eebb Merge pull request #2872 from levzzz5154/fix/forceload-rings
🤖 Agent: verified by Ludovic's AI agent (Claude): the review point is addressed (decorated protos still save as minecraft:features); the forced ticket rings follow FORCED_TICKET_LEVEL 31 rising one per ring; merged with main, clippy -D warnings and the horizon-client tests (forced_chunks included) pass. Queued; the merger waits for CI parity.
2026-10-29 22:58:03 +01:00
Ludovic Marie 3d23a9ff95 Merge pull request #3360 from levzzz5154/fix/launcher-mixins-public-modules
🤖 Agent: pr-triage-2 checked the pin: 3f99a5c60 is horizon-rust/horizon-mixins main, 8 commits ahead of 0d6b103c7 (preserved standard macros, Windows verbatim output paths), nothing behind; only MIXINS_REV changes and explicit per-bundle pins still win. Thanks @levzzz5154.
2026-10-29 22:57:59 +01:00
Ludovic Marie 4bf65778b6 Merge feat/launcher-night-specimen into feat/launcher-night-sky 2026-10-29 22:56:35 +01:00
Ludovic MarieandClaude Opus 5.5 cd44c4f495 Specimen: plates and the main action cut their corners in pixel steps
plate.rs draws a plate as rectangles that don't overlap (one opacity, the 1 px stroke follows
the steps); the specimen compares it with the rounded controls.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 22:56:27 +01:00
Federico Tagliani 379ec36d52 Merge remote-tracking branch 'origin/main' into fix/fishing-hook-smooth 2026-10-29 22:55:59 +01:00
Ludovic Marie 768099d32c Merge feat/launcher-night-tokens into feat/launcher-night-specimen 2026-10-29 22:55:58 +01:00
Federico TaglianiandClaude Sonnet 5.5 7f70737138 Fishing hook on a server's client: its own movement between the tracker's updates
FishingHook.tick runs on a client, easing towards the last update while it
flies, floats and rides what it hooked. Horizon only eased towards the
updates, which come every five ticks, so the bobber stood still for two
ticks of five and jumped.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-29 22:55:58 +01:00
Ludovic Marie 9d53e6ce35 Merge origin/main into feat/launcher-night-tokens 2026-10-29 22:54:15 +01:00
Ludovic MarieandClaude Opus 5.5 194970773d Night: pixel-cut plate corners, Geist's Cyrillic merged into Bricolage
Plates cut their corners in two 4 px steps (PIXEL_CORNER); RADIUS_PLATE is gone
from the night tokens. tools/bake_bricolage.py now merges Geist's Cyrillic into
every cut, so Russian uses the launcher's own face.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 22:54:06 +01:00
Ludovic Marie c8012dff3a Merge pull request #3119 from NetuosoDEV/fix/enderman-carried-block-tints
🤖 Agent: pr-triage-2 (Ludovic's AI agent, Claude): proven at c32dddb1f: carried and worn blocks draw their block-state model with vanilla's per-face default tints (block_tint harness against 26.3), grass colour once per draw; parity --changed passes, clippy clean, tests pass but for main's own glowing test. Merging.
2026-10-29 22:53:15 +01:00
Ludovic Marie 04da927a44 Merge pull request #3815 from horizon-rust/perf/light-view-cache
🤖 Agent: verified by server-tick-1: proto light views built once per proto state (streaming span 10-24 → 3-4 ms/tick on 25 explore bots, RSS unchanged); new generation_saves test fails on main and passes here; pr_ready --quick green; merging once CI parity passes.
2026-10-29 22:53:11 +01:00
k3yhandClaude Opus 5.5 67c4e5eb1a Merge main into the branch; the guest swap keeps both the acting permission and known_movement
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 16:47:34 -05:00
Ludovic Marie 12930d6237 Merge pull request #3572 from v3nn7/PolishLang
🤖 Agent: pr-triage-1 merged main once more (fast-forward): your Polish checks sit beside main's new test that every key has a Russian value. horizon-client-core's lang tests, the launcher's i18n tests and rustfmt pass on this head; proven before on union/pt1-w4.
2026-10-29 22:46:15 +01:00
d3grandoandClaude Opus 5.5 f7b77fbc88 Many mobs no longer grow the renderer's staging memory until it runs out
Uploads staged every write through wgpu's StagingBelt, which gives a write
larger than its chunk a buffer of exactly that size, keeps it for good and
only reuses it for writes that fit. The entity batch outgrows the 1 MiB chunk
with a few hundred mobs and grows a little each tick while more appear, so
every tick took a new buffer: about 1 GB more per hundred mobs past ~750,
never given back, until the game was killed (#2826).

Writes larger than the chunk now take a power-of-two slice and copy only
their bytes, so the buffers the belt keeps are reused: one per doubling.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 04:45:47 +07:00
d3grandoandClaude Opus 5.5 945ad05579 Darkness dims the screen on servers and in single player
The darkness effect's blend (MobEffectInstance.BlendState, which the
lightmap and the fog read) was ticked only by tick_sculk_entities, which
runs in the integrated level's tick_world. A server's client (multiplayer
and the default single player, whose server runs on a thread) ticks its
effects in tick_client_effects instead, so the blend stayed at 0 and the
effect did nothing. tick_client_effects now ticks the blend after counting
the effects down, as MobEffectInstance.tickClient does.

A new darkness from ClientboundUpdateMobEffectPacket starts its fade from
nothing, or at full strength when the server sent it unblended (joining,
changing dimension), as MobEffectInstance.skipBlending does.

Part of #3393.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 04:44:02 +07:00
Ludovic MarieandClaude Opus 5.5 9bba7215f5 Merge main into #3341: main's new held-item tests set a Tag custom name
Two tests main added (entity_nbt, mobs) set custom_name to a string and compared custom_name() with Option<&str>; with this PR it is the component tag and the plain text is an owned String.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 22:43:55 +01:00
DUzzL f822855c64 docs: add an owner's page mapping server.properties to server.toml 2026-10-29 22:43:10 +01:00
d3grandoandClaude Opus 5.5 b80c1a9eef lan_e2e: cushions check covers the placing swing and changing seats
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 04:41:45 +07:00
d3grandoandClaude Opus 5.5 682f8a20fa Cushions swing the arm when placed and let a seated player change seats
CushionItem.useOn returns SUCCESS, so the hand swings: place_cushion now
swings, and a client of a server predicts the same SUCCESS once
Cushion.canBePlacedAt holds (the placement checks are split out as
cushion_spawn for both). Cushion.interact sits the player down through
Entity.startRiding, which first stops riding the current vehicle, so a
player on one cushion moves to another instead of being refused.
LivingEntity.stopRiding off a cushion now plays the get-up sound and
puts the rider beside it (shared with getting up on sneak).

Fixes #3117

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 04:41:45 +07:00
d3grandoandClaude Opus 5.5 5aa2da4960 Applying a resource pack no longer freezes the window
The pack screen, F3+T and options-set staged the whole reload (overlay
root, models, atlas, pack tables, mip chains) on the render thread, so a
large pack froze the window for seconds. They now run it on a worker under
the progress overlay, as server packs already did (Minecraft.
reloadResourcePacks under a LoadingOverlay); a reload asked for while one
runs waits for it (pendingReload).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 04:41:35 +07:00
Ludovic Marie 0fff625c22 Merge pull request #3441 from xKumorio/fix-arrow-known-movement
🤖 Agent: proven by pr-triage-3 (Ludovic's AI agent) on union/pt3-w2 db5591ac7: parity --changed all passed, clippy, tests, lan_e2e 11 checks on both paths, and the throws levzzz asked for (walking/jumping carry the movement, none after a tick without a move) for host and guest on both paths. Mojang rules, supply chain, per-tick cost (a Vec3 copy per guest turn) read.
2026-10-29 22:39:35 +01:00
Ludovic Marie d52705984a Merge remote-tracking branch 'origin/main' into fix/pt3-3341 2026-10-29 22:37:25 +01:00
Ludovic MarieandClaude Opus 5.5 73c8eb9b60 Merge main into PolishLang: the Polish checks beside main's every-key test
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 22:34:22 +01:00
Ludovic Marie a305d38fc5 Merge pull request #3581 from v3nn7/fix/furnace-cart-client
🤖 Agent: proven on the integration branch union/pt1-w4 by pr-triage-1. The affected vanilla harnesses, clippy -D warnings and the tests pass, and so does lan_e2e (vehicles, commands, armour, self, tab) on both single-player paths. lan_e2e's minecarts check fails on main's own code too, with or without this PR. Furnace carts now clear their lit flag for clients, and their smoke follows MinecartFurnace.tick. Thank you!
2026-10-29 22:27:41 +01:00
Ludovic Marie 14b7b252ac Merge pull request #3106 from malordin/fix/missing-assets-download
🤖 Agent: proven by pr-triage-3 (Ludovic's AI agent): launcher-only change; on this exact head launcher fmt, clippy -D warnings and 299 tests pass on the Mac mini, clean merge with main. Asset refill only through download_for_owner (owners only).
2026-10-29 22:27:28 +01:00
Ludovic Marie 393ff56184 Merge pull request #3584 from v3nn7/fix/pumpkin-player-head
🤖 Agent: proven on the integration branch union/pt1-w4 by pr-triage-1: the affected vanilla harnesses pass (the only failures are main's own or another PR's), clippy -D warnings and the tests pass, the launcher's checks pass, and lan_e2e passes vehicles, commands, armour, self and tab on both single-player paths. Thank you!
2026-10-29 22:27:21 +01:00
Ludovic Marie e515379b04 Merge pull request #3925 from horizon-rust/feat/claim-respects-kira
🤖 Agent: merging the Kira/GitHub claim alignment (#3859 step 1 follow-up): verify green, claim tests pass.
2026-10-29 22:20:19 +01:00
Kacpherek c1de70edd4 Keep a bred baby fox or goat free of the spawn finalize extras
Breeding spawns the baby through spawning::finalize, which now gives a fox a mouth item and a goat a lost horn and a random screaming roll; Fox.getBreedOffspring and Goat.getBreedOffspring run no finalizeSpawn (Fox.java, Goat.java). The baby fox is emptied, the baby goat keeps both horns and gets a parent's screaming or one chance in fifty.
2026-10-29 22:19:35 +01:00
Kacpherek 149c4b87f8 Reopen the chat with its kept draft
T and / always opened the chat with the caller's text. ChatComponent.createScreen (ChatComponent.java:442) restores the saved draft, and ChatScreen.removed (ChatScreen.java) keeps it on Escape when Save Chat Drafts is on.
2026-10-29 22:19:26 +01:00
Kacpherek a6b3066f85 Kick guests who spam chat or commands
A dedicated server never kicked a spamming guest: chat-spam-threshold-seconds and command-spam-threshold-seconds were read but unused. Vanilla adds 20 per message or command, decays one a tick and disconnects over the threshold with disconnect.spam, except for operators (ServerGamePacketListenerImpl.detectRateSpam, TickThrottler.java:23).
2026-10-29 22:19:23 +01:00
Kacpherek 08918a8ab0 Load a world's own resource pack when the world opens
A save's resourcepacks/resources.zip was never loaded, so its textures were missing. Vanilla WorldOpenFlows.loadBundledResourcePack pushes it as a local pack (ServerPackManager.pushLocalPack, ServerPackManager.java:61) before the world connects.
2026-10-29 22:19:23 +01:00
Kacpherek fe08d02d5d Hold player chat back while Chat Delay is set
Player and disguised chat showed at once, so Chat Delay was ignored. ChatListener.handleMessage, tick and flushQueue (ChatListener.java:75-120) queue the lines and show one per delay.
2026-10-29 22:19:23 +01:00
Kacpherek 359e83b338 Step option cycle buttons with the mouse wheel
The wheel over an option button only scrolled the list. CycleButton.mouseScrolled (CycleButton.java:115) cycles its value, up going back, and the list does not move.
2026-10-29 22:19:19 +01:00
Kacpherek 8b17c0383e Make foxes from snowy biomes snow foxes on natural spawns
Natural and spawner foxes were always red; vanilla Fox.Variant.byBiome picks the snow variant from spawns_snow_foxes (Fox.java, Fox.Variant).
2026-10-29 22:19:10 +01:00
Kacpherek 407dd201f8 Swap another player's held items when it swaps hands
Entity event 55 was ignored, so another player's main and off hand kept their items after a swap on the server; vanilla LivingEntity.handleEntityEvent calls swapHandItems (LivingEntity.java).
2026-10-29 22:19:09 +01:00
Kacpherek 889931c0b9 Let natural foxes hold food or a feather in their mouth
Only structure mobs ran Fox.populateDefaultEquipmentSlots, so a fox from a natural or spawner spawn never held an emerald, egg, rabbit foot or the like (Fox.java).
2026-10-29 22:19:09 +01:00
Kacpherek 509536179d Give natural goats their screaming, lost horn and ram cooldowns
Only structure mobs and the probe ran Goat.finalizeSpawn, so a goat from a natural or spawner spawn never screamed, lost a horn or had its ram cooldowns (Goat.java, GoatAi.initMemories).
2026-10-29 22:19:09 +01:00
Kacpherek a9d2ae39d9 Call only the pets of the same owner when a tamed mob is hurt
HurtByTargetGoal.alertOthers called every nearby wolf, including other owners' and the attacker's own tamed pets; vanilla checks TamableAnimal.getOwner and considersEntityAsAlly (HurtByTargetGoal.java, TamableAnimal.java).
2026-10-29 22:19:04 +01:00
Kacpherek 9d44aa4ba0 Stop a tamed unsaddled skeleton horse from taking steering from its rider
A tamed skeleton horse obeyed its rider without a saddle; AbstractHorse.getControllingPassenger (AbstractHorse.java) needs the saddle, and SkeletonTrapGoal only tames the trap horse.
2026-10-29 22:19:04 +01:00
Kacpherek 0c34e3f36c Refill axolotls' air from a splashed water potion
A splashed water bottle did nothing to axolotls; AbstractThrownPotion.affectEntitiesAround (AbstractThrownPotion.java) rehydrates each axolotl in the box, adding 1800 air up to the maximum.
2026-10-29 22:19:03 +01:00
Kacpherek 4049220715 Make a horse thud when it lands instead of the generic fall sound
A landing horse played the generic fall sound and no thud; AbstractHorse.causeFallDamage (AbstractHorse.java) plays entity.horse.land (baby variant for babies) at 0.4 for falls over one block.
2026-10-29 22:19:03 +01:00
Kacpherek 1139057d3e Play the camel saddle sound when a camel is saddled by hand
Saddling a camel with a saddle in hand played the horse sound; Camel.getSaddleSound (Camel.java) is the camel's saddle equip sound.
2026-10-29 22:19:03 +01:00
Kacpherek 9f3cba308c Send a flap game event from a flying bee every other tick
A bee in the air never gave off its flap vibration, so sculk sensors never heard it; Entity.processFlappingMovement with Bee.isFlapping (Bee.java) emits minecraft:flap.
2026-10-29 22:19:03 +01:00
Kacpherek 80b68bae0c Hold a sitting camel's rotation under its rider
A camel that refuses to move (sitting or changing pose) still turned with its rider's view; Camel.getRiddenRotation (Camel.java) keeps its rotation.
2026-10-29 22:19:03 +01:00
Kacpherek 48efd53e00 Breed axolotl babies with a random parent's colour and a rare blue
Axolotl.getBreedOffspring took the first parent's colour, never blue and never persistent; vanilla rolls one in 1200 for blue, else picks either parent and sets the baby persistent (Axolotl.java).
2026-10-29 22:19:03 +01:00
Kacpherek c7440b78d5 Hang a bee's lead at half its eye height
The lead hung at the default leash offset; Bee.getLeashOffset (Bee.java) puts it at half the eye height, a fifth of the width ahead.
2026-10-29 22:19:03 +01:00
Kacpherek 0703ae6bd4 Keep a mannequin's profile when it is saved and loaded
A saved mannequin lost its profile, so after a reload it wore the default skin. Vanilla saves and reads it as ResolvableProfile (Mannequin.addAdditionalSaveData / readAdditionalSaveData, Mannequin.java:126 and :144).
2026-10-29 22:19:02 +01:00
Kacpherek ec6ea46499 Break item frames caught in an explosion
A blast never reached item frames, so they stayed up and kept their item. Vanilla kills a non-fixed frame in reach and drops it with its item (BlockAttachedEntity.hurtServer, ServerExplosion.hurtEntities; ItemFrame.java:173).
2026-10-29 22:19:02 +01:00
Kacpherek 62c4d91aa5 Send the hat layer change to every player's tab list
A guest who toggled the hat skin layer was not announced: vanilla sends UPDATE_HAT to all players in handleClientInformation (ServerGamePacketListenerImpl.java:2180), and the join entry now carries the hat state too.
2026-10-29 22:19:02 +01:00
Kacpherek d5d42c8a5f Let ravagers trample crops they walk through
Ravagers only broke leaves, so crops in their path survived; CropBlock.entityInside (CropBlock.java:153) destroys a crop a ravager's box enters when mobGriefing is on.
2026-10-29 22:19:02 +01:00
Kacpherek 765ed5d0c2 Fire the thrown-item pickup advancement for the player
Picking up an item the player threw never granted thrown_item_picked_up_by_player, so You've Got a Friend in Me was unreachable; ServerPlayer.onItemPickup (ServerPlayer.java:2324) fires it with the stack left after the take.
2026-10-29 22:19:02 +01:00
Kacpherek a63b69c300 Fire thrown-item pickup advancement for piglins
A piglin taking gold you threw never granted thrown_item_picked_up_by_entity, so Oh Shiny stayed locked; LivingEntity.onItemPickup (LivingEntity.java:3429) fires it for the taker, before the stack is split.
2026-10-29 22:19:02 +01:00
Kacpherek 126f997703 Make live shulkers solid for the player
Walking ignored live shulkers, so the player passed through them; Shulker.canBeCollidedWith (Shulker.java:487) returns isAlive and Entity.canCollideWith uses it.
2026-10-29 22:19:02 +01:00
Kacpherek 6befa8622d Scale the LAN host's entity tracking by the Entity Distance option
The integrated host ignored entityDistanceScaling, so guests saw entities at the default range; IntegratedServer.getScaledTrackingDistance (IntegratedServer.java:451) scales each tracking range by it.
2026-10-29 22:19:02 +01:00
Kacpherek 4fe17c268c Show spectating guests as invisible to others
A guest in spectator mode sent no invisible flag, so others saw a full model; ServerPlayer.updateInvisibilityStatus (ServerPlayer.java:2054) sets it for every spectator.
2026-10-29 22:19:02 +01:00
Kacpherek 1474b118b4 Break a straw bed when its sleeper gets up in the Overworld
A straw bed stayed in place after its sleeper woke up, but the Overworld's straw_bed_rule has destroy_on_leave, so vanilla breaks it (AbstractBedBlock.java:119 onStopSleeping, StrawBedBlock.java destroyBed).
2026-10-29 22:18:57 +01:00
Kacpherek e9808d0d13 Move online guests to the default mode when game mode is forced
MinecraftServer.enforceGameTypeForPlayers sets every player to the server mode when it is forced; guests already online kept their own mode and only got the default at join (MinecraftServer.java:1412).
2026-10-29 22:18:56 +01:00
Kacpherek a8a6485243 Send LAN guests the new difficulty on /difficulty
MinecraftServer.setDifficulty sends ChangeDifficulty to every player; /difficulty changed only the host, so guests kept the old difficulty until they rejoined (MinecraftServer.java:1307).
2026-10-29 22:18:56 +01:00
Kacpherek 1f9fdd9129 Pick a mooshroom calf's colour like MushroomCow
A mooshroom calf took its first parent's colour every time; MushroomCow.getOffspringVariant gives either parent's colour, and the other one 1 in 1024 times when both match (MushroomCow.java:275).
2026-10-29 22:18:56 +01:00
Kacpherek 8d3541a364 Save and load a mooshroom's colour under Type
MushroomCow.addAdditionalSaveData and readAdditionalSaveData store the colour as Type; only foxes wrote it, so a brown mooshroom reloaded red (MushroomCow.java:214, :221).
2026-10-29 22:18:56 +01:00
Kacpherek ed279f27d5 Draw the leather overlay on worn armour and armour stands
EquipmentLayerRenderer.renderLayers draws every layer of an equipment asset; only layer 0 was loaded, so leather armour lost its overlay layer (leather.json, EquipmentLayerRenderer.java:51).
2026-10-29 22:18:56 +01:00
Kacpherek 0d598edee8 Draw tipped arrow particles and the stuck-arrow shake on the client side
The window and LAN guests are clients of the server thread, so the arrow
effects added for Arrow.tick, Arrow.handleEntityEvent and ArrowModel.setupAnim
never reached them: the server's arrow drew its particles into a world nobody
sees, and a client's copy of an arrow never held a shake timer.

The server no longer draws or randomises Arrow.makeParticle (it is the
client's `Level.isClientSide` branch). It sends Arrow.ID_EFFECT_COLOR with a
tipped arrow's entity data and entity event 0 when the arrow has been stuck
for 600 ticks. A client ticks the particles itself (two in flight, one every
fifth tick in a block, the client's own random) and bursts twenty on event 0.
A client's arrow now starts its shake when it lands (AbstractArrow
.onSyncedDataUpdated) and runs it down each tick, so the roll shows.
2026-10-29 22:18:56 +01:00
Kacpherek 0b2e9da854 Burst tipped arrows and drop the potion after 600 ticks
A tipped arrow left stuck for 600 ticks kept its potion and never burst. Vanilla Arrow.tick sends entity event 0 (20 particles in the potion colour) and sets a plain arrow as the pickup item.
2026-10-29 22:18:56 +01:00
Kacpherek e701c9f458 Trail tipped arrows with their potion colour
Tipped arrows left no entity-effect particles in flight or stuck in a block. Vanilla Arrow.tick and Arrow.makeParticle draw two per tick in flight and one every fifth tick in the ground (Arrow.java).
2026-10-29 22:18:55 +01:00
Kacpherek 720381e3cf Crack skulls, shulker boxes, bells, lecterns and statues while broken
Only chests and banners showed the breaking overlay. Vanilla SkullBlockRenderer, ShulkerBoxRenderer, BellRenderer, LecternRenderer and CopperGolemStatueBlockRenderer submit their models for crumbling too.
2026-10-29 22:18:55 +01:00
Kacpherek 6fb33260ae Let empty buckets scoop bubble columns
An empty bucket on a bubble column did nothing; vanilla BubbleColumnBlock.pickupBlock removes the column and returns a water bucket.
2026-10-29 22:18:55 +01:00
Kacpherek 0559503258 Fire thrown-item pickup advancements for allay deliveries
Taking an item an entity threw never fired thrown_item_picked_up_by_player and allay deliveries had no thrower. Vanilla ServerPlayer.onItemPickup and BehaviorUtils.throwItem (PickedUpItemTrigger) do both.
2026-10-29 22:18:55 +01:00
Kacpherek 69d060efe6 Hang an allay's lead at 0.6 of its eye height
Allay.getLeashOffset (Allay.java:484) puts the rope at 0.6 of the eye height and 0.1 of the width; the lead used the default offset.
2026-10-29 22:18:55 +01:00
Kacpherek 0c9e6293ee Roll stuck arrows while their shake timer runs
A stuck arrow kept a fixed model pose; vanilla ArrowModel.setupAnim (ArrowRenderer) rolls the root by -sin(shake*3)*shake degrees while shakeTime lasts.
2026-10-29 22:18:55 +01:00
Kacpherek 0db93570be Apply spectator fog to powder snow
Spectators saw normal powder snow fog; vanilla PowderedSnowFogEnvironment.setupFog uses start -8 and half the render distance for spectators.
2026-10-29 22:18:55 +01:00
Kacpherek 4fcaff9935 Give a water bucket back for a tropical fish bucket fed to an axolotl
Feeding an axolotl a tropical fish bucket used the whole item; vanilla hands back a water bucket (Axolotl.usePlayerItem in Axolotl.java).
2026-10-29 22:18:54 +01:00
Kacpherek 0554db3906 Calm neutral mobs when the player who angered them dies
With forgive_dead_players on, wolves, bees, polar bears and other neutral mobs kept their anger after the player died. ServerPlayer.tellNeutralMobsThatIDied (ServerPlayer.java:991) makes mobs within 32 by 10 blocks run NeutralMob.playerDied, which stops the anger at that player (NeutralMob.java:122).
2026-10-29 22:18:54 +01:00
Kacpherek e94f1917a7 Give bred goats their cooldowns and screaming inheritance
A bred baby goat started without ram or long jump cooldowns and was never screaming. Goat.getBreedOffspring (Goat.java:152) runs GoatAi.initMemories, then takes screaming from a random parent or rolls 2 percent.
2026-10-29 22:18:54 +01:00
Kacpherek 713b2774aa Swim turtles with their own water travel
Turtles used the generic fluid travel in water (0.02 speed, 0.8 drag). Turtle.travelInWater (Turtle.java:266) moves at 0.1 with 0.9 drag and sinks slowly unless it has a target or is going home near its home.
2026-10-29 22:18:54 +01:00
Kacpherek f448660e4c Let rabbits, foxes and silverfish climb out of powder snow
Mobs stuck in powder snow never jumped out: the goal was missing from their registrations. Vanilla ClimbOnTopOfPowderSnowGoal jumps when the block above is powder snow or open (ClimbOnTopOfPowderSnowGoal.java:23).
2026-10-29 22:18:52 +01:00
Kacpherek d77cca177a Show the white trail of a spectral arrow in flight
A spectral arrow in flight left no trail; vanilla adds a white spell particle each tick while it is not in the ground (SpectralArrow.java:34).
2026-10-29 22:18:52 +01:00
Kacpherek 0a353d57c9 Chime amethyst blocks when a projectile hits them
A projectile striking an amethyst block played nothing; vanilla plays block.amethyst_block.chime at the block with a random pitch (AmethystBlock.java:18).
2026-10-29 22:18:52 +01:00
Kacpherek 1f21c74b01 Hide bogged mushrooms once it is sheared
A sheared bogged kept its mushrooms on the head. BoggedModel.setupAnim (BoggedModel.java:62) sets the mushrooms part visible only while the bogged is not sheared.
2026-10-29 22:18:52 +01:00
Kacpherek 882e3a3005 Run the click event of text in dialog messages
Clicking styled text in a dialog message or item description did nothing. DialogBodyHandlers.java:54 and :108 run the text's click event through DialogScreen.runAction.
2026-10-29 22:18:51 +01:00
Kacpherek fecb404485 Hide saddle reins on a horse nobody rides
A saddled horse with no rider drew its left and right saddle lines. EquineSaddleModel.setupAnim (EquineSaddleModel.java:64) shows the riding parts only while the horse is ridden.
2026-10-29 22:18:51 +01:00
Kacpherek d684cafca1 Read the saved version id and name as LevelVersion.parse does
The downgrade check compared Data.DataVersion; vanilla LevelVersion.parse takes Version.Id (no Version reads as 0, no Id as the current one) and names a Version without a Name as the current version. Both world checks now share that reading, and the play doc lists the new outcomes.
2026-10-29 22:18:51 +01:00
Kacpherek 7f19d9f95b Name mobs and armor stands a dispenser places from a renamed item
The dispenser paths for spawn eggs and armor stands skipped the stack's custom name that the hand-placed paths now apply. Entity.applyImplicitComponents (Entity.java:4281) names the entity on every spawn from an item.
2026-10-29 22:18:51 +01:00
Kacpherek 20ad245e02 Ask for a backup before opening a world saved by a newer version
Horizon opened a newer world without asking. WorldOpenFlows.openWorldCheckVersionCompatibility (WorldOpenFlows.java:352) asks for a backup first, with the red downgrade question (BackupStatus.DOWNGRADE in LevelSummary.java).
2026-10-29 22:18:51 +01:00
Kacpherek 54bb09a261 Name an armor stand placed from a renamed item
A renamed armor stand item placed an unnamed stand. EntityType.createDefaultStackConfig (EntityType.java:171) applies the stack's components, custom name included, through Entity.applyImplicitComponents (Entity.java:4281).
2026-10-29 22:18:51 +01:00
Kacpherek 6840b57201 Show the incompatible version alert instead of opening such a world
Horizon opened a world from another version series without a check. WorldOpenFlows.openWorldCheckVersionCompatibility (WorldOpenFlows.java:352) shows the red Incompatible version AlertScreen and keeps the world closed.
2026-10-29 22:18:51 +01:00
Kacpherek 739185e2c9 Make piglins walk only to wanted items they can see
Piglins took the nearest wanted item within 9 blocks even behind a wall. NearestItemSensor.doTick (NearestItemSensor.java:24) takes the nearest visible one within 32, then GoToWantedItem walks to it within 9 (PiglinAi).
2026-10-29 22:18:51 +01:00
Kacpherek c8477304a3 Let mobs slide down honey blocks
Mobs fell through honey blocks; only the player slid. HoneyBlock.entityInside (HoneyBlock.java:75) slows any living entity beside the block, with the slide sound and the entity event 53 particles.
2026-10-29 22:18:51 +01:00
Kacpherek c97f4da629 Make allays pick up only the items they can see
An allay walked to a matching item behind a wall. NearestItemSensor.doTick (NearestItemSensor.java:24) keeps only items the mob has a line of sight to.
2026-10-29 22:18:51 +01:00
Kacpherek dc5695dfa7 Mark worlds another running copy has open as locked
The world list showed a world open in another instance as an ordinary world. DirectoryLock.isLocked (DirectoryLock.java:66) and LevelSummary.createInfo (LevelSummary.java:154) show it as Locked in red and it cannot be joined.
2026-10-29 22:18:51 +01:00
Kacpherek 6ec46d1a81 Pick the piston a piston head belongs to
Pick block on a piston head gave nothing, since the head has no item form. PistonHeadBlock.getCloneItemStack (PistonHeadBlock.java:116) gives a sticky or plain piston by the head's type.
2026-10-29 22:18:51 +01:00
Kacpherek 925580fe3d Name the mob a renamed spawn egg spawns
A spawn egg renamed in an anvil spawned an unnamed mob; the stack's custom name was never applied. Entity.applyImplicitComponents (Entity.java:4281) sets the custom name from the item on spawn.
2026-10-29 22:18:51 +01:00
Kacpherek 8aeb55f0cf Apply x_rotation and y_rotation ranges in entity selectors
Selectors parsed the rotation ranges but never filtered on them, so @e[y_rotation=...] matched regardless of facing. EntitySelectorParser.createRotationPredicate (EntitySelectorParser.java:188) checks the wrapped pitch and yaw.
2026-10-29 22:18:50 +01:00
Kacpherek 17383e6fe0 Hold items in an allay's own hand transform
Allay items were placed with the humanoid hand offset; AllayModel.translateToHand (AllayModel.java:120) uses the body, the right arm's pitch, a 0.7 scale and a shift.
2026-10-29 22:18:50 +01:00
Kacpherek f31e30a081 Select the word under a double click on a book page
A double click on a book page only moved the caret, so no word was selected. Vanilla MultiLineEditBox.onClick and MultilineTextField.selectWordAtCursor (MultiLineEditBox.java:89, MultilineTextField.java:184) select the word before the cursor.
2026-10-29 22:18:46 +01:00
Kacpherek 913ad15462 Let Ctrl plus the mouse wheel change the GUI scale on the Video page
The wheel only scrolled the list there, and Ctrl was ignored. VideoSettingsScreen.mouseScrolled (File.java:263) steps guiScale by one and resets the list to the top instead.
2026-10-29 22:18:46 +01:00
Kacpherek 1976c27870 Join the selected world with Enter or Space on the world list
Enter and Space on a selected world did nothing, so keyboard players could not join from the list; vanilla WorldListEntry.keyPressed joins on selection keys (WorldSelectionList.java:602).
2026-10-29 22:18:46 +01:00
Kacpherek 7af0a21f2d Join the typed server address on Enter in Direct Connection
Enter did nothing on Direct Connection; vanilla DirectJoinServerScreen.keyPressed selects the server when the Join button is active (DirectJoinServerScreen.java:32).
2026-10-29 22:18:46 +01:00
Kacpherek 7a2121d84f Create the world on Enter in Create New World
Enter only confirmed a world rename, so it did nothing on Create New World; vanilla CreateWorldScreen.keyPressed calls onCreate on confirmation (CreateWorldScreen.java:360).
2026-10-29 22:18:46 +01:00
Kacpherek 3d5407ab11 Show the ghost recipe item tooltip on hover
Hovering a ghost ingredient or result in a crafting grid or furnace showed nothing; vanilla GhostSlots.extractTooltip shows the ghost item for the hovered slot (GhostSlots.java:65).
2026-10-29 22:18:46 +01:00
Kacpherek ef890e667f Show the item tooltip on hover in the statistics Items tab
Hovering an item icon in the Items tab showed nothing; vanilla ItemRowWidget.extractTooltip draws the item tooltip at the slot's corner (StatsScreen.java:512).
2026-10-29 22:18:46 +01:00
Kacpherek b5bcf031e5 Name a shield after its banner base colour
A shield with a banner base colour showed as plain Shield; vanilla ShieldItem.getName uses item.minecraft.shield.<colour> (ShieldItem.java:12).
2026-10-29 22:18:46 +01:00
Kacpherek 68cfbd61da Make dolphins flee guardians and ignore their hits
Dolphins ignored guardians and took their hits as attacks; Dolphin.registerGoals (Dolphin.java:158) adds AvoidEntity for Guardian and HurtByTargetGoal ignoring Guardian.
2026-10-29 22:18:45 +01:00
Kacpherek c61911ffcd Play the dried ghast sound when it takes water
A dried ghast filled with water made no place-in-water sound. Vanilla DriedGhastBlock.placeLiquid (DriedGhastBlock.java:174) plays DRIED_GHAST_PLACE_IN_WATER after scheduling the fluid tick.
2026-10-29 22:18:45 +01:00
Kacpherek a9e1f452df Break a lily pad that a boat drives over
A boat passing over a lily pad left it in place. Vanilla LilyPadBlock.entityInside (LilyPadBlock.java:27) destroys the pad with its drops for an AbstractBoat on a server level.
2026-10-29 22:18:45 +01:00
Kacpherek 1e3f05fe8c Make the spear-ai-golem fixes build on current main 2026-10-29 22:18:23 +01:00
Ludovic Marie eb19c2723b Merge pull request #3522 from Domanffe/i18n/own-screens-remainder-2
🤖 Agent: pr-triage-2 (Ludovic's AI agent, Claude): proven at d8e912738 in union/pt2-e3 (17 PRs on main cbea22fbb): parity --changed passes but for main's own failures, lan_e2e on both paths, policy read (Mojang rules, supply chain, speed). Merging.
2026-10-29 22:18:20 +01:00
Ludovic Marie ccc323a1b7 Merge pull request #3374 from ThatCakeIsAPie/feat/upgrade-datapack-4
🤖 Agent: pr-triage-2 (Ludovic's AI agent, Claude): proven at a717d6d58 in union/pt2-e3 (17 PRs on main cbea22fbb): parity --changed passes but for main's own failures, lan_e2e on both paths, policy read (Mojang rules, supply chain, speed). Merging.
2026-10-29 22:18:15 +01:00
Ludovic Marie d242616d68 Merge pull request #3373 from ThatCakeIsAPie/feat/upgrade-datapack-3
🤖 Agent: pr-triage-2 (Ludovic's AI agent, Claude): proven at 1ffe68635 in union/pt2-e3 (17 PRs on main cbea22fbb): parity --changed passes but for main's own failures, lan_e2e on both paths, policy read (Mojang rules, supply chain, speed). Merging.
2026-10-29 22:18:11 +01:00
DenisHumenandClaude Opus 5.5 d1a62e68ec Golems: build a snow or iron golem in any orientation, as vanilla does
CarvedPumpkinBlock.trySpawnGolem uses BlockPattern.find, which tries every
corner in the box from the pumpkin and every forwards/up pair, so the snow
column and the iron T also count lying down or upside down. Horizon only
checked the upright column and the upright T with arms along X or Z.

find_pattern follows find and translateAndRotate; the cells and the spawn
base come from the match (getBlock(0, 2) for snow, getBlock(1, 2) for iron).

Fixes #3929

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 23:18:08 +02:00
Kacpherek 45e1d44be2 Draw the candle snuff smoke on the clicking client
In single player the server side skips the wick smoke, so the client draws it itself, as CandleBlock.useItemOn does on the client (AbstractCandleBlock.extinguish).
2026-10-29 22:15:19 +01:00
Kacpherek e0a1b471ff Draw the block in a copper golem's antenna
The block item in a copper golem's antenna slot was never drawn. BlockDecorationLayer.submit (BlockDecorationLayer.java:33) draws it at CopperGolemModel.applyBlockOnAntennaTransform (CopperGolemModel.java:311).
2026-10-29 22:15:13 +01:00
Kacpherek 131458ee0f Play the head's sound from a note block under a custom head
A note block with a player head on top always clicked, ignoring the head's note sound. NoteBlock.getCustomSoundId (NoteBlock.java:167) takes the sound from the skull above; no skull or sound means silence.
2026-10-29 22:15:13 +01:00
Kacpherek 90db82ba0e Hold a witch's potion at her nose instead of in her hand
A drinking witch's potion was drawn in the hand with no potion contents. WitchItemLayer.applyTranslation (WitchItemLayer.java:17) holds the potion at the nose as a potion item.
2026-10-29 22:15:13 +01:00
Kacpherek d21886b2f3 Snuff a lit candle with an empty hand
An empty hand on a lit candle did nothing; only arrows lit them. CandleBlock.useItemOn (CandleBlock.java:75) calls AbstractCandleBlock.extinguish: unlit, wick smoke, candle extinguish sound, block_change.
2026-10-29 22:15:13 +01:00
Kacpherek f250e84ecf Refuse item counts above the max stack in item commands
item replace/fill/override accepted counts up to 99 above an item's max stack. ItemInput.createItemStack (ItemInput.java:21) throws arguments.item.overstacked instead.
2026-10-29 22:15:05 +01:00
Kacpherek a1454e00a2 Show the entity tooltip for chat hover events with advanced tooltips
Hovering a show_entity chat part showed nothing. With advancedItemTooltips on, vanilla lists the name, the entity type and the UUID (GuiGraphicsExtractor.componentHoverEffect; HoverEvent.java:84).
2026-10-29 22:15:05 +01:00
Kacpherek 994820e697 Hold a spyglass to the eye for other players
A spyglass in use was drawn in the hand, not at the eye. PlayerItemInHandLayer.renderItemHeldToEye (PlayerItemInHandLayer.java:40) clamps the head pitch to -30 to 90 degrees and holds the item on the head.
2026-10-29 22:15:05 +01:00
Kacpherek 75b37506ab Draw skulls worn in the mob head slot
Zombie, skeleton, creeper and player heads in a mob's head slot were not drawn. CustomHeadLayer.submit (CustomHeadLayer.java:44) puts the skull model on the head, and resolveSkullRenderType (CustomHeadLayer.java:69) takes a player head's skin from its profile.
2026-10-29 22:15:05 +01:00
Kacpherek 8ef51c4b69 Sweep a brush in use like vanilla
A brush in use was held still. FirstPersonHandsAndItemsRenderer.applyBrushTransform (FirstPersonHandsAndItemsRenderer.java:286) swings it back and forth over the use.
2026-10-29 22:15:05 +01:00
Kacpherek c2bd40f270 Show the pointing hand over chat insertion text while Shift is held
Hovering a chat part with an insertion never asked for the pointing hand; vanilla requests it in ChatComponent.java:672 when Shift is held (ChatScreen passes insertionClickMode).
2026-10-29 22:15:05 +01:00
Kacpherek 245ea982b9 Show oak plank crumbs when an armor stand breaks
A stand broken by a creative hand or the second hit made no plank particles; ArmorStand.showBreakingParticles sends ten oak plank block particles from the box (ArmorStand.java:369).
2026-10-29 22:15:04 +01:00
Kacpherek 6528d566a1 Hide spell particles near the eye while scoping with a spyglass
Spell particles stayed visible in the spyglass view; SpellParticle.isCloseToScopingPlayer sets their alpha to 0 within 3 blocks of the eye in first person while isScoping (SpellParticle.java).
2026-10-29 22:15:04 +01:00
Kacpherek 89d4b1ce31 Tilt the iron golem body side to side while it walks
Only the arms and legs swung; IronGolemRenderer.setupRotations also rotates the body about Z by 6.5 degrees of a triangle wave of the walk position.
2026-10-29 22:15:04 +01:00
Kacpherek 2010ef412f Draw the wool undercoat on a white jeb_ sheep
A white sheep named jeb_ had no undercoat; SheepWoolUndercoatLayer.submit draws it for isJebSheep as well as for a dyed wool.
2026-10-29 22:15:04 +01:00
Kacpherek 0e42a29fda Cycle the wool of a jeb_ sheep through the dye colours
A sheep named jeb_ kept its dyed colour; SheepRenderState.getWoolColor fades it through ColorLerper.getLerpedColor(SHEEP) (SheepRenderer.java, MobRenderer.checkMagicName).
2026-10-29 22:15:04 +01:00
Kacpherek 56b327bd94 Puff red dust when a lever is switched on
Switching a lever on showed no dust puff at the lever. LeverBlock.useWithoutItem (LeverBlock.java:56) calls makeParticle at full scale on the clicking client when the lever ends up powered.
2026-10-29 22:15:01 +01:00
Kacpherek f6df8b8339 Show the red dust burst when a redstone ore is touched
Hitting, stepping on or right-clicking a redstone ore lit it with no particles. RedStoneOreBlock.interact (RedStoneOreBlock.java:61) calls spawnParticles each time, lit or not.
2026-10-29 22:15:00 +01:00
Kacpherek 6529206304 Keep the light level when a light block is picked
Pick-block on a light gave a level 0 light. LightBlock.getCloneItemStack and setLightOnStack (LightBlock.java:100,104) put the level into the item's block state.
2026-10-29 22:14:42 +01:00
Kacpherek 88dc2c5f8d Make the piglin and hoglin fixes build on current main 2026-10-29 22:14:32 +01:00
Kacpherek bb7b1b27ad Play the dried ghast place sound when it is put down
Placing a dried ghast was silent. DriedGhastBlock.setPlacedBy (DriedGhastBlock.java:189) plays block.dried_ghast.place, or place_in_water when waterlogged.
2026-10-29 22:14:25 +01:00
Kacpherek a68a897af5 Break cushions struck by lightning
A bolt's box left cushions intact. Cushion.thunderHit (Cushion.java:138) kills the cushion and drops its item, as break_cushion does.
2026-10-29 22:14:25 +01:00
Kacpherek 296fd3d839 Break one turtle egg at a time when a survival player mines a stack
Mining a stack of 2 to 4 turtle eggs removed the whole stack; TurtleEggBlock.playerDestroy (TurtleEggBlock.java:138, decreaseEggs) plays the break and keeps the rest.
2026-10-29 22:14:25 +01:00
Kacpherek 33f3444a49 Chain a hanging sign onto a wall hanging sign
Right-clicking the side of a wall hanging sign with a hanging sign opened the sign instead of chaining. WallHangingSignBlock.useItemOn passes the use on when the hit is not on the editable faces (WallHangingSignBlock.java:53).
2026-10-29 22:14:25 +01:00
Kacpherek 2711a4a005 Break pointed dripstone hit by a fast thrown trident
A thrown trident faster than 0.6 that stuck in pointed dripstone left it standing. SpeleothemBlock.onProjectileHit destroys it, reading the deltaMovement from before the hit (SpeleothemBlock.java:181, AbstractArrow.onHitBlock).
2026-10-29 22:14:25 +01:00
Kacpherek c37cab6b6a Show vault connection particles for every connected player
Only the local player got the connection particles from a vault, so guests connected to it saw none. VaultBlockEntity.Client.emitConnectionParticlesForNearbyPlayers loops over every connected player (VaultBlockEntity.java:172).
2026-10-29 22:14:24 +01:00
Kacpherek cbf57eb6ee Keep a copper golem statue's pose when it is picked
Middle-click on a statue gave it standing, whatever its pose. CopperGolemStatueBlock.getCloneItemStack sets the block_state component to the pose (CopperGolemStatueBlockEntity.getItem, CopperGolemStatueBlock.java:134).
2026-10-29 22:14:24 +01:00
Kacpherek e1c7a297bc Pick a decorated pot with its sherds
Middle-click on a decorated pot gave an empty pot. DecoratedPotBlock.getCloneItemStack returns createDecoratedPotInstance(decorations), so the sherds come with the pick; the pot's item only comes with include_data (DecoratedPotBlock.java:211).
2026-10-29 22:14:24 +01:00
Kacpherek bc3161c619 Ring a bell hit by a wind charge burst
A wind charge burst that reached a bell sent a use on its top face, which the bell rejected, so it stayed silent. BellBlock.onExplosionHit calls attemptToRing with no direction, so the bell rings on its facing (BellBlock.java:197).
2026-10-29 22:14:24 +01:00
Kacpherek dd649971c8 Pick the potted plant instead of an empty flower pot
Middle-click on a flower pot with a plant gave an empty pot. FlowerPotBlock.getCloneItemStack returns new ItemStack(potted) when the pot is not empty (FlowerPotBlock.java:115).
2026-10-29 22:14:24 +01:00
Kacpherek 50a1911cea Play the creaking heart idle sound at night with logs on all sides
A non-uprooted creaking heart with pale oak logs on six sides never made its idle creak; CreakingHeartBlock.animateTick (CreakingHeartBlock.java:65) plays it 1 time in 16 while CREAKING_ACTIVE is on.
2026-10-29 22:14:24 +01:00
Kacpherek b82ebb2261 Snuff a lit candle cake with an empty hand
A right-click with an empty hand on the lit candle of a candle cake did nothing. CandleCakeBlock.useItemOn extinguishes it when the hit is above half a block, with the extinguish sound and a block change event.
2026-10-29 22:14:24 +01:00
Kacpherek 8880e0d373 Play the hoglin retreat grunt near a repellent
A hoglin near a repellent made no retreat grunt; vanilla plays entity.hoglin.retreat there (HoglinAi.java:231 getSoundForActivity).
2026-10-29 22:13:47 +01:00
Kacpherek b9ddeb1820 Start a gliding player's rocket half a block out at the rocket hand
The rocket of a gliding player started at the player's feet; vanilla offsets it 0.5 block toward the hand holding it (Entity.java:2688 getHandHoldingItemAngle, FireworkRocketEntity.java:138).
2026-10-29 22:13:41 +01:00
Kacpherek 50121630ce Ignore knockback on a creaking that cannot move
A creaking a player looks at still got shoved by hits; vanilla ignores knockback while it cannot move (Creaking.java:451 knockback).
2026-10-29 22:13:41 +01:00
Kacpherek edd7a9cb61 Spawn the crumbs when a held tool or armour piece breaks
A tool or armour piece that broke made no crumb particles; vanilla spawns five item crumbs for it (LivingEntity.java:1516 breakItem).
2026-10-29 22:13:41 +01:00
Kacpherek 5270924ba9 Show the crumbs of the food a fox is eating
Fox.handleEntityEvent(45) throws eight item crumbs from in front of its mouth; the server broadcasts 45 with the eating sound (Fox.java:289, :227).
2026-10-29 22:13:41 +01:00
Kacpherek 97eda2b7f5 Play the tadpole grow-up sound at volume 0.15
Tadpole.ageUp plays TADPOLE_GROW_UP at 0.15 from the tadpole's position, not at full volume from the eyes (Tadpole.java:227).
2026-10-29 22:13:41 +01:00
Kacpherek 86c1795ec6 Save and load a fox's sleeping, sitting and crouching flags
Fox.addAdditionalSaveData writes Sleeping, Sitting and Crouching from its flags and Fox.readAdditionalSaveData reads them back; a reload no longer wakes a sleeping fox (Fox.java:445). Trusted players are still not ported.
2026-10-29 22:13:41 +01:00
Kacpherek b469038d45 Feed a saddled pig held food instead of mounting it
Pig.mobInteract and Strider.mobInteract take a click holding food to Animal.mobInteract before any ride (Pig.java:167, Strider.java:401).
2026-10-29 22:13:41 +01:00
Kacpherek d17c1bc0e9 Keep a tame nautilus near its home, within 32 or 16 blocks
AbstractNautilus.checkRestriction sets the home at the nautilus with getNautilusRestrictionRadius (32, or 16 for a baby or saddled one) when it is not leashed or ridden (AbstractNautilus.java:237, :241).
2026-10-29 22:13:41 +01:00
Kacpherek ec77633cfe Let a cat lured with fish approach its picked player unscared
CatTemptGoal keeps a selectedPlayer re-rolled every 500 to 600 ticks and does not scare it (Cat.java:677).
2026-10-29 22:13:41 +01:00
Kacpherek 5909dc68b6 Lower a sheep's head to eat grass on every client
Sheep.handleEntityEvent(10) sets eatAnimationTick to 40 and EatBlockGoal.start broadcasts event 10 (Sheep.java:119, EatBlockGoal.java:40); the server now sends it and clients start and count down the eating head.
2026-10-29 22:13:41 +01:00
Kacpherek bb7adf1207 Cull lightning bolts beyond 64 blocks times the view scale
A bolt past 64 blocks (scaled by the entity distance) was still drawn; vanilla keeps only the sky flash and thunder there (LightningBolt.java:250).
2026-10-29 22:13:41 +01:00
Kacpherek 97294e3838 Hurt an Enderman that a splash water potion lands near
A water splash did nothing to an Enderman; AbstractThrownPotion.affectEntitiesAround hurts it 1 and Enderman.hurtWithCleanWater makes it teleport.
2026-10-29 22:13:41 +01:00
Kacpherek 01cf25687f Mix both parents' dye colours for sheep, wolf and cat babies
A baby took one parent's colour by a coin flip; DyeColor.getMixedColor mixes them with the two-dye crafting recipe, else picks one (Sheep.java:281, Wolf.java:608, Cat.java:383).
2026-10-29 22:13:41 +01:00
Kacpherek 2151ef21f2 Put a wolf's leash rope at 0.6 of its eye height
The rope point was at full eye height; Wolf.getLeashOffset (Wolf.java:659) uses 0.6 times it.
2026-10-29 22:13:41 +01:00
Kacpherek d686f4b9d7 Play the iron golem damage sound when it cracks
Hits that moved an iron golem to a new crack level were silent; IronGolem.hurtServer plays IRON_GOLEM_DAMAGE then (IronGolem.java:209).
2026-10-29 22:13:41 +01:00
Kacpherek 2b90acbc0d Play the fox bite sound after each melee strike
A fox's melee strike made no sound; FoxMeleeAttackGoal plays FOX_BITE after doHurtTarget (Fox.java:1101).
2026-10-29 22:13:41 +01:00
Kacpherek 2e49c68051 Keep turtles silent in water and as babies
Turtles in water or babies played the land ambient; Turtle.getAmbientSound plays TURTLE_AMBIENT_LAND only on land and grown up, else Mob's silent default (Turtle.java:176).
2026-10-29 22:13:41 +01:00
Kacpherek aa30c8e9d2 Growl the angry zoglin sound while it has a target
A zoglin with an attack target grunted its ambient instead of entity.zoglin.angry; Zoglin.getAmbientSound picks ZOGLIN_ANGRY when ATTACK_TARGET is set (Zoglin.java:286).
2026-10-29 22:13:41 +01:00
Kacpherek 4dcb669759 Play the fox sleep sound while a fox naps
A sleeping fox played its day ambient; Fox.getAmbientSound returns FOX_SLEEP while sleeping (Fox.java:677).
2026-10-29 22:13:40 +01:00
abit-foggy 40b0467e20 fix(renderer): use flat draws on Intel Gen11 Vulkan to prevent section flicker (#3529) 2026-10-29 11:12:39 -10:00
Ludovic Marie 6175960663 Merge pull request #3372 from ThatCakeIsAPie/feat/upgrade-datapack-2b
🤖 Agent: pr-triage-2 (Ludovic's AI agent, Claude): proven at 217216e26 in union/pt2-e3 (17 PRs on main cbea22fbb): parity --changed passes but for main's own failures, lan_e2e on both paths, policy read (Mojang rules, supply chain, speed). Merging.
2026-10-29 22:12:19 +01:00
DUzzL ada08437e5 Turtle: silent in water, in the air and as a baby (Turtle.getAmbientSound) 2026-10-29 22:12:16 +01:00
Ludovic Marie 7eaa770716 Merge pull request #3370 from ThatCakeIsAPie/feat/upgrade-datapack-2a
🤖 Agent: pr-triage-2 (Ludovic's AI agent, Claude): proven at 825f8f884 in union/pt2-e3 (17 PRs on main cbea22fbb): parity --changed passes but for main's own failures, lan_e2e on both paths, policy read (Mojang rules, supply chain, speed). Merging.
2026-10-29 22:12:15 +01:00
Ludovic Marie 7d6a05e18f Merge pull request #2847 from sirrayi/fix/release-notes-contributors-heading
🤖 Agent: pr-triage-2 (Ludovic's AI agent, Claude): proven at c455bb6ec in union/pt2-e3 (17 PRs on main cbea22fbb): parity --changed passes but for main's own failures, lan_e2e on both paths, policy read (Mojang rules, supply chain, speed). Merging.
2026-10-29 22:12:11 +01:00
Ludovic Marie fab10b1922 Merge pull request #2821 from levzzz5154/fix/death-message-item-name
🤖 Agent: pr-triage-2 (Ludovic's AI agent, Claude): proven at a11e54e7b in union/pt2-e3 (17 PRs on main cbea22fbb): parity --changed passes but for main's own failures, lan_e2e on both paths, policy read (Mojang rules, supply chain, speed). Merging.
2026-10-29 22:12:06 +01:00
Ludovic Marie 8a363878ee Merge pull request #2570 from levzzz5154/fix/world-types
🤖 Agent: pr-triage-2 (Ludovic's AI agent, Claude): proven at c7aca8489 in union/pt2-e3 (17 PRs on main cbea22fbb): parity --changed passes but for main's own failures, lan_e2e on both paths, policy read (Mojang rules, supply chain, speed). Merging.
2026-10-29 22:12:02 +01:00
GIGABAIT93andClaude Opus 5.5 d7f9535406 Entity shadows follow the entity's scale and age
LivingEntityRenderer.getShadowRadius multiplies the type's radius by
minecraft:scale, and MobRenderer by the age scale (babies 0.5, or the
species' own: goat 0.55, camel 0.6...). Villagers and striders halve a
baby's shadow again, turtles take 0.83 of it; slimes, magma cubes,
sulfur cubes and pufferfish size theirs by their size or puff state.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 23:10:55 +02:00
Kacpherek 997bbef785 Walk zombies through their village at night
Zombies, husks and zombie villagers wandered with the plain stroll only. Vanilla Zombie.addBehaviourGoals adds MoveThroughVillageGoal(1.0, onlyAtNight, 4, canBreakDoors) at priority 6 (MoveThroughVillageGoal.java): within 6 sections of a village, pick the land spot (15, 7) whose nearest taken, unvisited village POI is closest, path to that POI (or ten blocks toward it, or only as far as a wooden door), and remember the 16 last POIs reached. The weighted land position now also honours a restricted home like vanilla's LandRandomPos.getPos.
2026-10-29 22:08:19 +01:00
Kacpherek 753660c0b4 Run the click command of a sign when a player uses it
Clicking a sign with a run_command in its text did nothing. SignBlock.useWithoutItem and useItemOn call SignBlockEntity.executeClickCommandsIfPresent (SignBlockEntity.java:182): each line of the side the player faces runs its run_command (as the player, from the block centre, permission level 2, no output: createCommandSourceStack with CommandSource.NULL), opens its show_dialog or logs its custom action, but only when the sign has allow_op_features; otherwise the action bar says click actions are disabled. A waxed sign still plays its failed-interaction sound, and a sign that ran one does not open the editor.
2026-10-29 22:08:07 +01:00
Kacpherek eba7cb0409 Make iron golems return to and patrol their village
Golems strolled anywhere at 0.6 (the plain stroll) and never went home. Vanilla IronGolem.registerGoals (IronGolem.java:68) adds MoveBackToVillageGoal at priority 2 (a stroll every 10 ticks, toward the section within 2 closest to a village, only outside the village) and GolemRandomStrollInVillageGoal at 4 (every 240 ticks: 3 in 10 anywhere, else toward a villager who wants a golem or a taken POI in a village section, from the level's random). Both are RandomStrollGoal subclasses, so Stroll takes an overriding spot picker and canUse test; the village sections and POI tickets come from the villager brain's helpers.
2026-10-29 22:08:07 +01:00
Kacpherek 2d477df4fd Let a waxed sign with a click command stop hanging signs chaining
A hanging sign used on another hanging sign always chained below it, even when the aimed sign had a run_command to run. SignBlockEntity.canExecuteClickCommands (SignBlockEntity.java:178) is a waxed sign whose facing side has one, and CeilingHangingSignBlock and WallHangingSignBlock shouldTryToChainAnotherHangingSign pass only without it. The game now asks the sign, and hands the answer to the wall hanging sign check through PlayerContext.
2026-10-29 22:08:07 +01:00
Kacpherek 71092caa14 Make piglins back off 9 to 11 blocks after a spear charge
A piglin that charged with a spear stayed on its target. SpearRetreat starts on the RETREAT status with a target, a spear and no item in use when LandRandomPos.getPosAway finds a spot 9 to 11 blocks away (checkExtraStartConditions), remembers it as SPEAR_FLEEING_POSITION, walks there for up to 100 ticks while looking at the target, and ends by erasing the status so the next approach starts (SpearRetreat.java).
2026-10-29 22:08:07 +01:00
Kacpherek 5968cd0f09 Make piglins run at the target and reposition mid-charge
A charging piglin stood still. SpearAttack.tick moves it every tick: run at the target (SpearAttack.java), and within 2 blocks of it or at the end of the path pick a spot 6 to 7 blocks past it (LandRandomPos.getPosAway, 2 more blocks on a mount) to run to, erasing it at the end of the path so it runs at the target again, until SPEAR_ENGAGE_TIME ends.
2026-10-29 22:08:07 +01:00
Kacpherek 8ce62d3aaa Make piglins raise the spear to charge a target
After closing in, a piglin with a golden spear never lowered it to attack. SpearAttack starts on the CHARGING status with a target, a spear and no item in use: it becomes aggressive, sets SPEAR_ENGAGE_TIME to the weapon's use time (KineticWeapon.computeDamageUseDuration), erases SPEAR_CHARGE_POSITION and starts using the spear (SpearAttack.start); the charge counts down while it looks at the target and ends in the RETREAT status (SpearAttack.java).
2026-10-29 22:08:07 +01:00
Kacpherek 2153681d47 Make piglins with a golden spear close in on 10 blocks
A piglin holding a golden spear (about 1 in 20 adults) walked up and meleed. PiglinAi.initFightActivity puts SpearApproach before the melee behaviour: with a target, a spear and no item in use, and no SPEAR_STATUS yet (checkExtraStartConditions), it sets the status APPROACH and walks to the target until it is within 10 blocks (SpearApproach.java), then the status is CHARGING. A piglin with a spear no longer melees (MeleeAttack.isHoldingUsableNonMeleeWeapon).
2026-10-29 22:08:07 +01:00
Kacpherek 349127673c Douse fire, candles and campfires where a water bottle lands
A potion that hit a block had no face and never put anything out. Thrown potions now keep the block and the face they entered it by, and AbstractThrownPotion.onHitBlock (server side, before the entity effects) douses the cell in front of that face, the cell behind it and the four horizontal neighbours when the potion is in #douses_fire. AbstractThrownPotion.douseFire destroys a fire block without drops, puts out a lit candle or candle cake (AbstractCandleBlock.extinguish) and a lit campfire (level event 1009, the block-change game event, lit false) (AbstractThrownPotion.java:48, :122).
2026-10-29 22:08:00 +01:00
Kacpherek 32e16761bd Hurt water-sensitive mobs and put out burning ones with a splash
A water potion only hurt endermen, and nothing it splashed on stopped burning. AbstractThrownPotion.affectEntitiesAround goes over every living entity in the potion's box grown by (4, 2, 4) and under 4 blocks away: #hurts_water_sensitive_entities hurts the sensitive ones (blaze, snow golem, strider, enderman) with indirectMagic and #extinguishes_entities calls extinguishFire on the burning ones, players and armor stands included (AbstractThrownPotion.java:94).
2026-10-29 22:08:00 +01:00
Kacpherek 57a2512025 Add putting out a burning mob and a lit candle from outside
Entity.extinguishFire plays the extinguish sound for a burning entity and then clears its fire; AbstractCandleBlock.extinguish unlights a candle or candle cake with its sound and the block-change game event (no source entity, and no smoke from a server). Mobs only lost their fire in water or rain, and candles only to a player's empty hand or a wind charge.
2026-10-29 22:07:51 +01:00
Kacpherek 25d15d2a0a Add the indirect_magic damage type for thrown potions
A thrown potion hurts through DamageSources.indirectMagic(potion, owner), which bypasses armor, is resisted by witches and wolf armor, and, unlike magic, knocks back from the potion. Mobs only had magic (no knockback) or a player attack. Add the kind, its constructor and the damage_type id, and keep Enderman.hurtServer's random teleport chance off it: the thrown-potion branch teleports without it (Entity.java, DamageTypeTags, Enderman.java).
2026-10-29 22:07:51 +01:00
Kacpherek a1a45472c8 Read splash potion effects around the hit from the potion tags
A thrown potion tested for plain water by id to hurt endermen and refill axolotls. Vanilla asks PotionContents.is for #hurts_water_sensitive_entities, #rehydrates_axolotls (and #douses_fire, #extinguishes_entities) in AbstractThrownPotion. Add the lookup over the data pack's tags/potion and use it for the two checks that exist.
2026-10-29 22:07:51 +01:00
Kacpherek 37f9481bb7 Add SignText.hasAnyClickCommands for a sign side
A sign side had no way to say whether its text carries a run_command click event. SignText.hasAnyClickCommands (SignText.java:120) is true when any line's style has a RunCommand click event. Horizon reads the saved click_event the way ClickEvent.CODEC does for the three actions a sign acts on (run_command, show_dialog, custom).
2026-10-29 22:07:19 +01:00
Kacpherek 04fb868e99 Keep click events and allow_op_features on loaded signs
Horizon flattened every sign line to plain text, so a click event in the text was lost the moment a sign loaded. SignText keeps each line's Component and its Style; the sign now keeps each line's click_event next to its text, writes it back with the line (an edited line keeps its style, SignBlockEntity.updateMessages), and reads and writes the allow_op_features flag of SignBlockEntity.loadAdditional and saveAdditional.
2026-10-29 22:07:15 +01:00
Kacpherek 7ed6012c79 Tick potent sulfur geysers on the server and the client
Wet or dormant sulfur never made anyone nauseous, periodic geysers never erupted, and continuous ones neither pushed entities nor showed their plume. Run PotentSulfurBlock.getTicker's tickers by state (PotentSulfurBlockEntity.java): the server gives nausea every 10 ticks, counts the geyser down with its positional random and flips dormant and erupting, and throws mobs, items and primed TNT up the column; the client releases gas clouds, draws the plume and plays its sound from the eruption block event, and pushes the local player, who moves on its own client. A window that simulates the world itself does both.
2026-10-29 22:06:57 +01:00
Kacpherek a8be1d9ee0 Add the potent sulfur block entity and its block events
Potent sulfur had no block entity of its own here, so no countdown was kept or saved and a geyser that began erupting made no sound or block event. Add PotentSulfurBlockEntity's waitingCountdown (saved as countdown) and eruptionTick, create it with the block and keep it through saves. PotentSulfurBlock.onPlace now queues the eruption block event, plays the start sound and signals block_activate for erupting and continuous states, triggerEvent reports the event handled, and updateShape resets the countdown when a block that was no geyser turns dormant (PotentSulfurBlock.java validBlockState).
2026-10-29 22:06:57 +01:00
Ludovic Marie c770074449 Merge pull request #3405 from degepie/fix/issue-3137-suspicious-stew
🤖 Agent: pr-triage-2 (Ludovic's AI agent, Claude): proven at 95c234cc1 in union/pt2-e3 (17 PRs on main cbea22fbb): parity --changed passes but for main's own failures, lan_e2e on both paths, policy read (Mojang rules, supply chain, speed). Merging.
2026-10-29 22:06:55 +01:00
Kacpherek b6f3d91b09 Raise the spear arm of zombies and piglins
HumanoidMobRenderer.getArmPose gives an arm holding a spear the SPEAR pose, which AnimationUtils.animateZombieArms leaves alone; the mobs here drew zombie or piglin arms around it. Zombies, husks, zombie villagers, zombified piglins and piglins now hold the spear out and charge it by their use time, and a piglin admiring gold no longer counts as using the spear in its main hand.
2026-10-29 22:06:55 +01:00
Kacpherek 26f46141c7 Make zombies and zombified piglins charge with a spear
Zombies, husks, zombie villagers and zombified piglins spawned with a spear just melee. SpearUseGoal (priority 2, and 1 for zombified piglins) walks to 10 blocks, lowers the spear for KineticWeapon.computeDamageUseDuration (halved, the goal ticks every other tick), charges along the target, repositions 6 to 7 blocks away, then backs off 9 to 11 blocks (LandRandomPos.getPosAway with a minimum distance) for up to 50 goal ticks. A mount's chargeSpeedModifier and the 2 blocks a passenger adds are kept.
2026-10-29 22:06:55 +01:00
Kacpherek 4f5a70ee53 Take ten points off a goat's fall damage
Goat.calculateFallDamage is the base damage minus 10, as Frog's is minus 5. Goats now leap down to five blocks and the arc lifts them higher still, so without it every ledge jump would hurt them.
2026-10-29 22:06:52 +01:00
Kacpherek d0761d3c50 Let goats long jump between ledges when their cooldown runs out
GoatAi.initLongJumpActivity adds LongJumpMidJump and LongJumpToRandomPos (5 wide, 5 high, velocity 3.5714288) to the activity that runs after the ram activity and before the idle one: no tempting player, no breed target, no walk target and no LONG_JUMP_COOLDOWN_TICKS. It lands on LongJumpToRandomPos.defaultAcceptableLandingSpot (a solid block below, no path malus).
2026-10-29 22:06:52 +01:00
Kacpherek caca2ef2d4 Land a long jumping goat with a thud and a 10 percent slide
LongJumpMidJump.stop slows a mob that lands to a tenth of its horizontal speed (multiply(0.1F, 1.0, 0.1F), the float widened to a double), plays the activity's landing sound at volume 2 (GoatAi: entity.goat.step), stands it up and samples the cooldown. A goat has no swim activity, so water does not end its flight.
2026-10-29 22:06:52 +01:00
Kacpherek 8874140947 Play the goat's long jump sound when it leaps
LongJumpToRandomPos.tick plays the activity's jump sound at the leap. GoatAi.initLongJumpActivity gives goats entity.goat.long_jump and screaming goats entity.goat.screaming.long_jump; the arc, the 40 tick wait and the jump boost are the same as the frog's.
2026-10-29 22:06:52 +01:00
Kacpherek a369faeb32 Let allays remember a note block they heard
An allay never learned a liked note block, so it always brought items to the player. AllayAi.hearNoteblock (AllayAi.java:108), called from Allay.VibrationUser.onReceiveVibration on NOTE_BLOCK_PLAY, stores the block as LIKED_NOTEBLOCK_POSITION with a 600 tick cooldown and renews the cooldown when the same block plays again.
2026-10-29 22:06:52 +01:00
Kacpherek 6dc2f77e99 Make an allay with a liked note block hear only that block
Allay.VibrationUser.canReceiveVibration (Allay.java:564) refuses vibrations without AI and, once a note block is liked, accepts only that block while the allay is within 1024 blocks of it in its dimension. Horizon accepted every vibration.
2026-10-29 22:06:52 +01:00
Kacpherek bb4da395a3 Add GlobalPos.isCloseEnough and the allay's liked note block memory
The liked note block slot (extra.home) was never set and was a bare block position. Vanilla keeps LIKED_NOTEBLOCK_POSITION as a GlobalPos (GlobalPos.java:31) and AllayAi.getItemDepositPosition drops it when it is over 1024 blocks away, in another dimension, no longer a note block or its cooldown ran out; the throw target is BlockPosTracker(pos.above()), the centre of that block. Saved in Brain.memories like vanilla.
2026-10-29 22:06:52 +01:00
Kacpherek 2555b46e7c Give allays a vibration listener that hears note blocks
An allay never listened for vibrations, so note blocks played near it went unnoticed. Vanilla gives it a VibrationSystem listener (Allay.VibrationUser, 16 blocks, GameEventTags.ALLAY_CAN_LISTEN = note_block_play) ticked after super.tick() in Allay.tick, saved under "listener".
2026-10-29 22:06:52 +01:00
Kacpherek 65a23ca98e Port map: the golden dandelion age lock is ported
The map still said a golden dandelion did nothing: drop the missing rows for
AgeableMob.mobInteract, canUseGoldenDandelion, setAgeLockedData, setAgeLocked,
makeAgeLockedParticle and Tadpole.setAgeLockedData (the code now cites them),
and say AgeableMob.defineSynchedData sends AGE_LOCKED too.
2026-10-29 22:06:52 +01:00
Kacpherek 24101477da Let a golden dandelion lock or release a baby animal's growth
Using a golden dandelion on a baby animal did nothing. AgeableMob.mobInteract (reached by Animal, Dolphin, SulfurCube and the other subclasses after their own checks) runs setAgeLocked with setAgeLockedData and returns SUCCESS when canUseGoldenDandelion holds; Tadpole.mobInteract does the same. A scared panda or one on its back (Panda.mobInteract) and an armadillo in its shell (Armadillo.mobInteract) answer first. A server's client treats the click as taken like the server does (AgeableMob.java:68).
2026-10-29 22:06:52 +01:00
Kacpherek e04428b60c Use up the golden dandelion, keep the mob and play the lock sound
Golden dandelion consumption, persistence and the use or unuse sound were missing. AgeableMob.setAgeLocked runs setAgeLockedData, consumes one item (not in creative), setPersistenceRequired when the mob is now locked, and plays golden_dandelion.use or .unuse at the block position (middle of the block, 1.0, 1.0, PLAYERS) (AgeableMob.java:88).
2026-10-29 22:06:52 +01:00
Kacpherek 79ed5ba529 Add the golden dandelion check for age locking a baby
AgeableMob.canUseGoldenDandelion(item, isBaby, cooldown, mob): the held item is a golden dandelion, the mob is a baby, its ageLockParticleTimer is 0 and its type is not in the cannot_be_age_locked entity tag (zombie horse, skeleton horse, villager) (AgeableMob.java:78).
2026-10-29 22:06:52 +01:00
Kacpherek a569559196 Add the age lock toggle a golden dandelion applies to a tadpole
A golden dandelion on a tadpole did nothing. Tadpole.setAgeLockedData sets AGE_LOCKED to its opposite, setAge(0) (back to the start of its 24000-tick growth) and ageLockParticleTimer = 40 (Tadpole.java:168).
2026-10-29 22:06:52 +01:00
Kacpherek ac74644dc9 Add the age lock toggle a golden dandelion applies to an ageable mob
Nothing toggled AgeLocked in play. AgeableMob.setAgeLockedData sets AGE_LOCKED to its opposite, setAge(getBabyStartAge()) (-24000, a sniffer's -48000, through the age boundary) and ageLockParticleTimer = 40 (AgeableMob.java:82).
2026-10-29 22:06:51 +01:00
Kacpherek c419845102 Draw the growth particles above a mob a golden dandelion touched
There was no age lock particle timer, so no pause or reset growth particles. AgeableMob.makeAgeLockedParticle runs at the end of AgeableMob.aiStep and Tadpole.aiStep: while ageLockParticleTimer is above 0, every even tick it sends one PAUSE_MOB_GROWTH (locked) or RESET_MOB_GROWTH particle at getRandomX(1.0), getRandomY(0.2) + bbHeight (+ 0.2F when locked), getRandomZ(1.0), then counts down (AgeableMob.java:225).
2026-10-29 22:06:51 +01:00
Kacpherek a6e91967a1 Hold an age-locked baby as a baby and sync the lock to clients
Nothing honoured AgeLocked in the shared age tick: a locked baby kept growing, a locked baby fed food still aged, and the lock never reached remote clients. AgeableMob.aiStep only counts a baby up when canAgeUp (isBaby && !isAgeLocked), and only for AgeableMob subclasses (it was also counting a tadpole's own age back down, so it never grew up). Animal.mobInteract, Panda.mobInteract and Dolphin.mobInteract feed a baby only when canAgeUp. AgeableMob.AGE_LOCKED (entry 17 after DATA_BABY_ID) and Tadpole.AGE_LOCKED are synched; MushroomCow.DATA_TYPE moves to 18 behind them (AgeableMob.java).
2026-10-29 22:06:51 +01:00
Kacpherek af8751173f Keep a riding piglin to the ride activity's behaviours
PiglinAi.initRideHoglinActivity lists Mount, SetEntityLookTarget(loved item, 8.0), a look at what it sees while a passenger and DismountOrSkipMounting; it has no idle movement or repellent avoidance, so a piglin heading for a hoglin no longer wanders off or strolls. A riding piglin looks at a player holding gold within 8 blocks, not 14.
2026-10-29 22:06:47 +01:00
Kacpherek af0bc10c34 Take a baby piglin off a baby it rides once its ride target ends
A baby piglin stayed on its mount forever. PiglinAi.updateActivity ends with stopRiding when RIDE_TARGET is gone and PiglinAi.isBabyRidingBaby (a baby piglin on a baby piglin or baby hoglin) holds, so a ride lasts as long as the 10 to 30 second memory.
2026-10-29 22:06:47 +01:00
Kacpherek 7fd82c846b Make a riding piglin get off a vehicle it no longer wants
No dismount rule ran. DismountOrSkipMounting keeps the vehicle (or else the ride target) only while it is alive and closer than 8 blocks and PiglinAi.wantsToStopRiding says no: the vehicle is grown, dead, the piglin was hurt in the last 40 ticks (HURT_BY), or the vehicle is a piglin that rides nothing itself. Otherwise the piglin gets off and forgets RIDE_TARGET.
2026-10-29 22:06:46 +01:00
Kacpherek f27a098c2d Walk a baby piglin to its ride target and mount it
No brain sent a mob to another to climb on it. Mount.create (ride activity) does nothing for a passenger, boards the ride target once closer than a block, and otherwise looks at it and sets a 0.8 speed walk to it; MoveToTargetSink ends that walk a block from the target's block and aims again when it moved over 2 blocks.
2026-10-29 22:06:46 +01:00
Kacpherek 08e206c459 Make an idle baby piglin pick a baby hoglin to ride
Nothing ever set RIDE_TARGET. PiglinSpecificSensor remembers the nearest visible baby hoglin, and PiglinAi.babySometimesRideBabyHoglin (idle activity) copies it into RIDE_TARGET for 10 to 30 seconds once SetEntityLookTargetSometimes.Ticker lets a baby through, every 10 to 40 seconds, with draws from the level random.
2026-10-29 22:06:46 +01:00
Kacpherek 5bc9606d99 Give a piglin a ride target and a ride activity
Brain activities wait on their memory: PiglinAi.getActivities lists a RIDE activity that is valid while RIDE_TARGET is there, between celebrating and idle in PiglinAi.updateActivity's order. RIDE_TARGET holds a mob and expires like any memory with an expiry.
2026-10-29 22:06:46 +01:00
Kacpherek c4f0c49c0e Pose a riding piglin sitting
PiglinModel extends HumanoidModel, whose setupAnim bends the legs and arms of a passenger; piglin_pose never set the riding flag, so a piglin on a mount stood stiff.
2026-10-29 22:06:46 +01:00
Kacpherek ff70b164cc Let a mob's brain board another mob and get off it
Only spawning put a mob on another; no brain could. Entity.startRiding checks the boarding cooldown, a free seat and no riding cycle, and Piglin.startRiding sends a baby piglin that boards a hoglin to the top of up to three piglins stacked on it. LivingEntity.stopRiding sets the passenger down at Animal.getDismountLocationForPassenger. A hoglin seats its rider at 1.49375 (0.875 for a baby), a baby piglin hangs 0.1875 below its seat (Piglin.BABY_DIMENSIONS).
2026-10-29 22:06:46 +01:00
Kacpherek 66c20c246d Open the new piglin and hoglin doc comments with their vanilla method
Doc wording only: each function that ports a vanilla method now starts its comment with the method name.
2026-10-29 22:06:46 +01:00
Kacpherek 32f2156b13 Count a piglin's hunted-recently wait down once a tick
Two additions to Piglin's per-tick state each counted the same memory down, so the HUNTED_RECENTLY wait that setAvoidTargetAndDontHuntForAWhile and StartHuntingHoglin start (30 to 120 seconds, PiglinAi.TIME_BETWEEN_HUNTS) ran out twice as fast.
2026-10-29 22:06:46 +01:00
Kacpherek 810a0152d3 Make idle piglins watch a player who holds gold
Piglins never turned to look at a player holding a gold ingot or another loved item. The idle and celebrate activities of PiglinAi.java start with SetEntityLookTarget on a visible player within 14 blocks for whom isPlayerHoldingLovedItem holds; add that look as a goal.
2026-10-29 22:06:46 +01:00
Kacpherek c124b94c8b Keep adult hoglins 8 blocks from the adult piglins they see
Idle hoglins ignored adult piglins and let them walk right up. HoglinAi.initIdleActivity walks an adult away from the nearest visible adult piglin at 0.4 once it is closer than 8 blocks, when it has no walk of its own (SetWalkTargetAwayFrom in HoglinAi.java).
2026-10-29 22:06:46 +01:00
Kacpherek 845343e019 Play a piglin's and hoglin's activity sound as its ambient grunt
Piglins and hoglins played their angry grunt whenever they had a target and otherwise the plain ambient one. Piglin.getAmbientSound and Hoglin.getAmbientSound play the sound of the activity the mob is in (PiglinAi.getSoundForCurrentActivity, HoglinAi.getSoundForCurrentActivity).
2026-10-29 22:06:46 +01:00
Kacpherek 89ecd6cd9d Grunt when a piglin or hoglin changes activity
A hoglin or piglin that started a fight, a retreat, a celebration or an admiring said nothing; only the ambient roll played. HoglinAi.updateActivity and PiglinAi.updateActivity make getSoundForActivity's sound (retreat, angry, admiring, celebrate, jealous) when the activity changes (Hoglin.java, Piglin.java).
2026-10-29 22:06:46 +01:00
Kacpherek e314b5c6e1 Make a hurt piglin flee, retreat or retaliate as vanilla does
A hit piglin ended its celebration and, for a player's hit, its admiring, but babies fought back instead of fleeing, an avoid target of another kind stayed, and an adult piglin took on hoglins it should retreat from. PiglinAi.wasHurtBy (Piglin.hurtServer) drops the admiring and the celebration for any attacker but a piglin, sends a baby into a 100-tick flight and calls the adults, retreats an adult from hoglins that outnumber piglins, and lets it retaliate only when maybeRetaliate allows.
2026-10-29 22:06:46 +01:00
Kacpherek be2963b1d6 Make a hurt hoglin retreat or retaliate as vanilla does
A hit hoglin only ended its pacified state and let the hurt-by goal target the attacker, so a baby never fled and an adult took on piglins and hoglins it should leave alone. HoglinAi.wasHurtBy (Hoglin.hurtServer) sends a baby into the retreat and lets an adult retaliate only when maybeRetaliate allows it.
2026-10-29 22:06:46 +01:00
Kacpherek d68d59f6b6 Make an outnumbered hoglin retreat after it hits a piglin
A hoglin that hit a piglin kept fighting even when piglins outnumbered the hoglins around it. HoglinAi.onHitTarget (Hoglin.doHurtTarget) sets the piglin as its avoid target and broadcasts the retreat to the adult hoglins it sees.
2026-10-29 22:06:46 +01:00
Kacpherek 7a98019450 Set an avoid target and broadcast a retreat to the adults nearby
A hoglin or piglin that decides to retreat had no way to set the avoid target, pick the nearest of its targets or warn the adults around it. Add HoglinAi.setAvoidTarget, PiglinAi.setAvoidTargetAndDontHuntForAWhile, retreatFromNearestTarget and broadcastRetreat; the broadcast reaches the other mob as an event that its next tick handles before its goals.
2026-10-29 22:06:46 +01:00
Kacpherek c40d0112a6 Let piglins and hoglins retreat from their avoid target
Hoglins and piglins never ran from piglins, hoglins or zombified mobs through an avoid target: baby hoglins panicked instead and piglins used a plain avoid goal. Add the retreat activity's walk away (HoglinAi.initRetreatActivity at 1.3 and 15 blocks, PiglinAi.initRetreatActivity at 1.0 and 12), the copies of a nemesis or zombified mob into AVOID_TARGET (PiglinAi.java), wantsToStopFleeing and the outnumbering tests, and keep the idle behaviours and the attack goals out of the retreat.
2026-10-29 22:06:45 +01:00
Kacpherek 89cbb09961 Let mobs stab with a spear they are using
A mob that held a spear could not use it: nothing started its use or ran KineticWeapon.damageEntities for it. A mob's use now counts ticks like the player's, stabs along its view from delay_ticks on (conditions scaled by 0.2, reach by the AttackRange mob_factor), hurts and pushes the player or mobs hit, dismounts riders and broadcasts entity event 2 (LivingEntity.stabAttack, causeExtraKnockback). A piglin's admiring is told apart from a spear in use by the off hand.
2026-10-29 22:06:40 +01:00
Kacpherek d43b957afc Add the sulfur geyser and noxious gas particles
Potent sulfur geysers draw four new particle types and two emitters, and none existed. Add noxious_gas, noxious_gas_cloud, geyser, geyser_base, geyser_poof and geyser_plume the way the vanilla providers build them (GeyserEruptionParticle.java, GeyserPlumeParticle.java, GeyserBaseParticle.java, NoxiousGasParticle.java, NoxiousGasCloudParticle.java): the gas fades from half its life, the base puffs burst upward, the plume shoots up and falls back, and the cloud and the eruption spawn the rest every tick. The cloud asks PotentSulfurBlockEntity.canBeReachedByNoxiousGas, ported with the other level reads of that class in the new potent_sulfur module. Particle packets with geyser data now map to and from the options.
2026-10-29 22:06:36 +01:00
Kacpherek 93dd53e1c6 Brighten a glow squid's body when it is not dark
A glow squid was lit like any mob, so it never glowed in the dark. GlowSquidRenderer.getBlockLightLevel lerps 1 - darkTicks / 10 over 0..15 and uses 15 outright, else the larger of that and the usual block light (GlowSquidRenderer.java:26).
2026-10-29 22:06:36 +01:00
Kacpherek 1a371c3e20 Count down the glow squid dark ticks and shed glow particles
A glow squid kept no dark timer and shed no glow. GlowSquid.aiStep runs after Squid.aiStep on the server and on clients: it lowers a positive dark tick count by one and calls addParticle(GLOW) at getRandomX(0.6), getRandomY(), getRandomZ(0.6) (GlowSquid.java:83). Only a client's level draws it; the server throws the same three random doubles.
2026-10-29 22:06:35 +01:00
Kacpherek f1a0963f2a Dim a glow squid for 100 ticks when it is hit
A hit glow squid never got its dark timer, so it did not dim. GlowSquid.hurtServer sets the dark ticks to 100 once Squid.hurtServer took the damage (GlowSquid.java:97).
2026-10-29 22:06:32 +01:00
Kacpherek 2947c2d71f Share the spear hit search with the mob code
The stab's entity search (ProjectileUtil.getHitEntitiesAlong) lived in the game crate's spear module; mobs that stab need it from the client library, so it moves to the spear module there and the game keeps using it.
2026-10-29 22:06:26 +01:00
Kacpherek 952fc5a1f5 Add LandRandomPos.getPosTowards for mobs that lean toward a spot
Horizon only had getPosAway on land. Vanilla's LandRandomPos.getPosTowards (LandRandomPos.java:23) takes the direction to the point and goes through getPosInDirection, a quarter turn (float cast pi/2) either side. getPosAway now shares that helper, so it uses the same float-cast angle.
2026-10-29 22:06:26 +01:00
Kacpherek ba7f106d53 Sense the adults a piglin or hoglin sees and track its activity
Piglins and hoglins had no brain memories: nothing counted the adult piglins and hoglins in sight (HoglinSpecificSensor, PiglinSpecificSensor), kept an avoid target with an expiry, or noted which activity they were in. Add them as mob state ticked from customServerAiStep (Hoglin.java, Piglin.java).
2026-10-29 22:06:24 +01:00
Kacpherek 9191728d12 Make a goat that cannot long jump wait 300 to 600 ticks
LongJumpToRandomPos.checkExtraStartConditions needs the mob on the ground and out of water, lava and honey, and otherwise sets LONG_JUMP_COOLDOWN_TICKS to half a sample of TIME_BETWEEN_LONG_JUMPS (GoatAi: 600 to 1200). A goat has no swim activity to keep it out of the check, so it runs in water too.
2026-10-29 22:06:23 +01:00
Kacpherek bd89ae3df7 Sync and save the glow squid dark ticks
A glow squid had nowhere to keep DATA_DARK_TICKS_REMAINING: nothing held it, sent it to clients, or saved it. GlowSquid defines it as the first entry after AgeableMob's two (index 18) and writes DarkTicksRemaining (GlowSquid.java). It lives in the mob's counter; the server sends it as synched data, a client applies it and the save keeps it.
2026-10-29 22:06:23 +01:00
Kacpherek 5ea674c6e6 Search an 11 block box for a goat's long jump
LongJumpToRandomPos.start lists every block within the activity's width and height of the mob (GoatAi: 5 and 5, so 11 x 11 x 11; the frog's is 9 x 5 x 9). A goat's activity is a plain LongJumpToRandomPos, so it skips LongJumpToPreferredBlock.start's draw from the mob's random.
2026-10-29 22:06:23 +01:00
Kacpherek d8ac144995 Share the frog's long jump goal pieces with goats
LongJumpToRandomPos and LongJumpMidJump serve both mobs in vanilla. The goal now sets the friction flag and the pose through helpers that know the goat's state, and the default landing spot and the cooldown count down (CountDownCooldownTicks) can be used by a goat. Frogs behave as before.
2026-10-29 22:06:23 +01:00
Kacpherek a7f03f52fd Give goats a long jumping pose with its smaller box and friction flag
A goat that long jumps takes Pose.LONG_JUMPING, which Goat.getDefaultDimensions scales by 0.7, and LongJumpUtil checks the arc with that pose's box (LongJumpUtil.isClearTransition). The pose goes to remote clients like the frog's, and the goat holds LivingEntity.discardFriction.
2026-10-29 22:06:23 +01:00
DUzzL 9226f507a3 Remove dead ctov modular_compat code and unused test helper in horizon-port-pack 2026-10-29 22:05:48 +01:00
Ludovic Marie 8169314c66 Merge pull request #3369 from ThatCakeIsAPie/feat/upgrade-datapack-1
🤖 Agent: pr-triage-2 (Ludovic's AI agent, Claude): proven at 0771f59bc in union/pt2-e3 (17 PRs on main cbea22fbb): parity --changed passes but for main's own failures, lan_e2e on both paths, policy read (Mojang rules, supply chain, speed). Merging.
2026-10-29 22:04:32 +01:00
Ludovic Marie 7b581fb43c Merge pull request #3366 from ThatCakeIsAPie/perf/worldgen-surface-biomes
🤖 Agent: pr-triage-2 (Ludovic's AI agent, Claude): proven at 52cc53a4f in union/pt2-e3 (17 PRs on main cbea22fbb): parity --changed passes but for main's own failures, lan_e2e on both paths, policy read (Mojang rules, supply chain, speed). Merging.
2026-10-29 22:04:28 +01:00
Ludovic MarieandClaude Opus 5.5 c32dddb1fe Merge main into the branch: default tints through the tint closure
Main's #3401 drew blocks through tinted_block_model_vertices with a per-face
tint closure; block_model_vertices now passes the default tints there
(grass colour once per call). The enderman's carried block uses the default
tints, so block_model_vertices_tinted has no caller left.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 22:03:53 +01:00
Ludovic Marie 5b1d64d4f7 Merge pull request #3401 from JacobRWebb/JacobRWebb/sticky-piston-texture-color
🤖 Agent: pr-triage-2 (Ludovic's AI agent, Claude): proven at 1a01f5ef5 in union/pt2-e3 (17 PRs on main cbea22fbb): parity --changed passes but for main's own failures, lan_e2e on both paths, policy read (Mojang rules, supply chain, speed). Merging.
2026-10-29 22:01:50 +01:00
Federico Tagliani 55db71a9ff Merge remote-tracking branch 'origin/main' into fix/riptide-with-elytra 2026-10-29 22:01:45 +01:00
Federico TaglianiandClaude Sonnet 5.5 9751bdf0ab Riptide in rain on a server's client: isInRain from its own chunks and weather
A client of a server has no live biome features, so the behaviours'
isRainingAt answered false and a Riptide trident never started charging in
rain.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-29 22:01:44 +01:00
Ludovic Marie bf0d6dd423 Merge pull request #3920 from horizon-rust/feat/roadmap-owners
🤖 Agent: merging the short roadmap (#3859 step 4): verify green, roadmap tests and the online check pass. Proposed owners can change their line with a one-line PR.
2026-10-29 21:59:32 +01:00
Ludovic MarieandClaude Opus 5.5 91523637ac CONTRIBUTING: rewrap the claims paragraph
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 21:58:59 +01:00
Ludovic MarieandClaude Opus 5.5 d64f34c96c Claims: an issue claimed on Discord is taken too
Kira's Discord /claim marks an issue with the `in progress` label instead of
assigning it; `/claim` on GitHub now refuses such an issue, so the two
claim paths can't hand the same issue to two people. Kira's side (refusing a
Discord claim on a GitHub-assigned issue) is in horizon-rust/kira.

Part of #3859.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 21:58:34 +01:00
Ludovic MarieandClaude Opus 5.5 fabb6d78ec Parity headline: a plain paragraph, no HTML markers
The website renders the "Project status" intro with its own markdown, which
prints HTML comments as text: the block is now found by its first words.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 21:56:45 +01:00
Ludovic Marie 74904e32c1 Merge pull request #3903 from horizon-rust/feat/overlap-note
🤖 Agent: merging the overlap note (#3859 step 2): verify green, tests pass, false positives measured on the 207 open PRs (21 pairs: 16 related, 4 doubtful, 1 unrelated).
2026-10-29 21:55:40 +01:00
Ludovic MarieandClaude Opus 5.5 3082b36894 Parity headline: the player-visible gaps still open, on the README and the site
tools/parity_gaps.py counts the rows not yet ticked in the port ledger's
ten gap lists (#3512-#3521) and writes them first under "Project status"
(by area, linked) and in a badge beside the 100% one. The website shows the
block already: it renders that section's intro. Today: 833 open of 833.
Refreshed in the weekly roadmap pass (roadmap/README.md); tests check the
block, the badge and the site's heading agree, without the network.

Part of #3859.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 21:54:39 +01:00
Ludovic MarieandClaude Opus 5.5 7c8e0d8e9b Roadmap: Now at most 8 items, each with an owner and a tracking issue
roadmap.toml items get `owner` (a GitHub login) and `issue` (the tracking
issue); `check` requires both on every Now item, at most 8 Now and 12 Next
items, and the tracking issue to be an open issue. ROADMAP.md shows them,
roadmap.json carries them (the hub ignores unknown keys).

The proposed lists, from the work actually happening (open pull requests,
agents' workstreams):
- Now: smooth-frames, server-tick, mods, port-ledger (the player-visible
  gaps), modpack-worldgen, server-thread, java-instances, lean-code, with
  tracking issues #3909-#3916.
- Mods: one line (Ludovic's decision), owner levzzz5154; native-mods,
  mod-registry, server-mods, mod-screens, modder-tools, machines-api and
  mod-world-items fold into it.
- Shipped (`sync`, all their pull requests in a release): server-dialogs,
  discord-presence, native-shaders, pregen, item-cooldowns, chat-settings,
  pointer-hand, text-field-keys, chicken-flap. phones-and-browser is not
  shipped: it becomes ongoing so `sync` stops taking its first pieces for it.
- Next: 12 (splitscreen, owner martipops, and launcher-redesign come up);
  the rest of Next moves to Later.

Part of #3859.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 21:48:46 +01:00
GIGABAIT93andClaude Opus 5.5 8974e07eec Other players and mannequins take their minecraft:scale
ClientPacketListener.handleUpdateAttributes gives every living entity its
attributes; the client kept only a mob's max health, so a server's scale
on another player or a mannequin was dropped and NPC plugins' enlarged
fake players showed at their normal size. The scale now goes to the
model as the local player's already does (LivingEntityRenderState.scale),
computed like AttributeInstance.calculateValue, now a function with a test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 22:46:54 +02:00
Ludovic MarieandClaude Opus 5.5 6da84cf195 A plain custom name is saved as a string, as vanilla's codec writes it
Component.tryCollapseToString: ComponentSerialization.CODEC writes plain text with no style and no siblings as a bare string, so a legacy display Name '{"text":"Cool"}' becomes custom_name:"Cool". Keeping the compound made 215 of hotbar's 905 cases differ.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 21:46:31 +01:00
DUzzL c9053670cd Fix camel pose time at spawn and in LastPoseTick saves
A camel kept its pose change as a signed age, so a camel finalized at age 0 had pose time 0 and could not move for 52 ticks, and LastPoseTick was saved as a sign. Keep a signed age anchor plus a sitting flag, and save and load LastPoseTick as a game time.
2026-10-29 21:42:33 +01:00
DUzzL 2403ca40a2 Reject data-pack recipe result counts outside 1..=99
ItemStackTemplate.CODEC bounds the count with intRange(1, 99). Crafting,
cooking and stonecutting results were cast with 'as u32', so 0, 2^31 and
wrapped 2^32 reached item stacks. Such recipes are now not loaded.
2026-10-29 21:40:55 +01:00
DUzzL e7b19995ea Explosion drops merge by item, components and max stack size
ServerExplosion.addOrAppendStack uses ItemEntity.areMergable: same item and
components, and the combined count within the item's max stack size.
2026-10-29 21:39:27 +01:00
Ludovic Marie f47c14d93f Merge pull request #3872 from horizon-rust/feat/kind-labels
🤖 Agent: merging the kind and area labels (#3859 step 3): verify green, workflow-safety and labelling tests pass; labels created and the open pull requests labelled once.
2026-10-29 21:38:13 +01:00
DUzzL 4269899778 Stamp the current DataVersion only after the world data is upgraded
upgrade_world wrote level.dat at the current DataVersion before converting chunks, so a failed conversion was never retried. The level.dat write now comes last.
2026-10-29 21:37:45 +01:00
DUzzL a5f4e32bfc Dedupe function-tag expansion with hash sets and end tag cycles
Fixes #3885
2026-10-29 21:37:00 +01:00
Ludovic MarieandClaude Opus 5.5 ca0888663e Overlap note: one comment naming the open pull requests doing the same work
On open and push, overlap-note.yml (pull_request_target, main's script only)
lists, in one comment edited on every push, the other open pull requests that
close the same issue or change the same functions. Functions come from git's
own rust/python hunk headers, which name indented methods (GitHub's stop at
`impl Game<'_>`). The heads are fetched as objects and diffed, never checked
out; hooks, fsmonitor, external diff and textconv are off.

Measured on the 207 open pull requests: one shared function, or a few of a
big pull request's hundred, was mostly chance, so a pair needs a shared
issue, or 2 shared functions and a tenth of the bigger one's; functions 5
compared pull requests change, probes, tests and stacks don't count.
21 pairs (34 notes): 16 related (4 duplicates), 4 doubtful, 1 unrelated.

Part of #3859.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 21:36:37 +01:00
bloodulonandQoder cdd3254dbb Load item definitions from nested folders
ModelEngine names a bone's item model `modelengine:<model>/<bone>` and
ships it at assets/modelengine/items/<model>/<bone>.json. Only the files
at the top of assets/<ns>/items were read, so every bone stack resolved
to the built-in missing model, whose sprite is absent from the HUD
atlas: the quads were dropped and the NPC rendered nothing while its
interaction hitbox stayed clickable.

Walk the tree like ParsedModels::load already does for models.

Co-Authored-By: Qoder <[email protected]>
2026-10-30 01:36:04 +05:00
ccclosed's AI agentandDeepSeek Harness 410bde729b Mobs: apply the Weakness, Slowness and Health Boost attribute modifiers
effect_modifiers only mapped strength and speed, so Weakness and Slowness
had no effect on a mob: its melee damage and movement speed stayed at the
base values. Map every attribute-carrying effect the way vanilla's
MobEffect.addAttributeModifier does, scaled by amplifier + 1:

- weakness: attack damage -4 per level (ADD_VALUE)
- slowness: movement speed -0.15 per level (ADD_MULTIPLIED_TOTAL)
- health_boost: max health +4 per level (ADD_VALUE)

Move the per-effect table into a testable effect_modifier() and cover all
five rows with a unit test.

Fixes #3887.

Co-Authored-By: DeepSeek Harness (deepseek-v4.1-flash) <[email protected]>
2026-10-29 23:33:35 +03:00
Ludovic Marie 90aded96a3 Merge pull request #3874 from horizon-rust/fix/display-log-linux-only
🤖 Agent: macOS clippy fix (log_display is only called on Linux); clippy clean on macOS.
2026-10-29 21:24:43 +01:00
TJKDev1andClaude Opus 5.5 6eb26eb046 Third person: the player's head pitch follows the mouse between ticks
Entity.turn adds the turn to xRotO as well as xRot, so the local
player's getXRot(partialTick) follows the mouse every frame. Every turn
(mouse, pad, arrow keys, the control `turn`) now goes through
turn_player, which moves both ends of the model's head pitch and ends
in AbstractBoat.onPassengerTurned's clamp. handleRotatePlayer snaps the
model (setOldRot), and handleMovePlayer moves its old pitch by the
packet as setOldPosAndRot does. A change the tick makes still eases in.

Fixes #3844

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 21:24:09 +01:00
Federico Tagliani d1129a9fce Merge remote-tracking branch 'origin/main' into fix/boat-paddle-input-latch 2026-10-29 21:17:14 +01:00
Federico TaglianiandClaude Sonnet 5.5 0cfb0400c8 Boats: steer with the input latched on the previous tick
LocalPlayer.rideTick sets the boat's input after the boat ticked, so
AbstractBoat.tick steers with the previous tick's keys and the paddle
packet it sends describes the motion it just made. Horizon set the keys
before ticking, a tick ahead of that packet (GrimAC Simulation flags).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-29 21:15:45 +01:00
matydenandClaude Opus 5.5 7b33479e15 Port publish: write the issue body as UTF-8
issue() wrote the body file in the system's code page, while gh reads
it as UTF-8, so on Windows a body with "→" raised UnicodeEncodeError
(cp1251 here) or would reach GitHub garbled. #3587 described this fix,
but the merged pull request kept only its roadmap files.
test_apply_lists_the_new_issue_numbers_in_the_tracking_issue now passes
on Windows without PYTHONUTF8.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 22:15:05 +02:00
matydenandClaude Opus 5.5 230d89f7ec Telemetry: a user named "user" keeps the <user> label whole
The scrubber puts <user> in place of the folder name in /Users/... and
C:\Users\... paths, then replaces the machine's user name wherever it
stands alone. When that name is "user", the second pass matched the
word inside the label it had just written, so a crash report read
/Users/<<user>>/... and telemetry's a_crash_keeps_only_what_says_what_happened
failed on such machines (seen in #578 and #3838). A match between "<"
and ">" is now left as it is.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 22:15:04 +02:00
Ludovic Marie 7c1e0f9794 Merge pull request #3862 from horizon-rust/feat/claim-command
🤖 Agent: merging the claims workflow (#3859 step 1): verify green, Python tests and workflow-safety tests pass, the GraphQL query and release --dry-run tried live.
2026-10-29 21:13:27 +01:00
Ludovic MarieandClaude Opus 5.5 0c9e995257 Render: log_display only where Wayland's HDR reports call it
On macOS and Windows nothing calls it, so clippy -D warnings failed there
(dead code) while Linux CI passed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 21:13:27 +01:00
Ludovic Marie 97032398df Merge pull request #3834 from horizon-rust/perf/scheduled-one-level
🤖 Agent: verified by server-tick-1: due scheduled ticks run in one with_level while a step leaves no level events or spill (identical order and state); tick_blocks span 15.4/14.8 → 10.4/9.3 ms at 50 bots; pr_ready --quick green; merging once CI parity passes.
2026-10-29 21:13:23 +01:00
DUzzL a8f0a64bd6 Credit breeding to the player who fed the animals
On the server thread (the default) breeding runs in the mob tick, outside
any player's turn, and the server has no host player, so the
bred_animals trigger and the animals_bred statistic were dropped and
"The Parrots and the Bats" was never granted.

Remember who fed each animal into love (Animal.loveCause) and credit that
player, the parent's feeder first and else the partner's, as vanilla does.
2026-10-29 21:11:07 +01:00
Aria Figueredo d3e0774ca3 Catalog versioned native hook points 2026-10-29 15:09:42 -05:00
bxnjxmin27andDeepSeek V4.1 Flash c3fdf7192d Screenshots: the key works with chat, a sign or a book open
F2 was handled in `Game::key_pressed`, which a screen with a text box never
reaches: chat, a sign, a book, the command block and the search boxes take the
key first, so F2 did nothing there (#3689).

Vanilla runs `Minecraft.handleGlobalKeyPress` before a screen sees the key:
`key.fullscreen` and `key.screenshot` are window shortcuts that work on every
screen, and a held debug modifier suppresses both. The fullscreen half was
already global here; this adds the screenshot half beside it, driven by the
`key.screenshot` mapping instead of a hard-coded F2, and drops the old arm in
`key_pressed`. `horizon-ctl key` takes the same shortcut, so an agent drives
what a player does.

Co-Authored-By: DeepSeek V4.1 Flash (opencode) <[email protected]>
2026-10-29 21:05:06 +01:00
Ludovic MarieandClaude Opus 5.5 59b1c33bb2 PR labels: a kind from the template's ticked box, areas from the paths
The template gets a "Kind" list (parity, bug, perf, feature, extra, tooling,
docs). pr-labels.yml (pull_request_target, main's script only, never the
pull request's code) sets the ticked kind when the pull request has none, swaps
it when the author changes the tick, and never removes a label set by hand.
Area labels come from the changed paths: at most 3, each a tenth of the lines.
`feature` keeps its release meaning.

pr_labels.py also creates the labels and labels the open pull requests once
(backfill: kind only where clear, else none).

Part of #3859.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 21:04:01 +01:00
spiderandClaude Opus 5.5 be48b7a4a9 LAN and friends worlds authenticate guests when the host is signed in
IntegratedServer.initServer uses authentication, so a vanilla LAN is in
online mode: each guest's hasJoined answer brings their signed textures
property, and everyone sees their skin and cape. Horizon's LAN stayed in
offline mode, so guests joined with no properties and showed as default
skins without capes.

OnlineMode::lan() makes the key pair when an account is signed in (an
offline name keeps offline mode), for the server thread and the in-frame
host alike; friend codes reach the same port through the tunnel. As in
ServerLoginPacketListenerImpl.handleHello, the integrated server's own
player over memory is never asked to authenticate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 21:03:58 +01:00
Aria Figueredo d1d99be74f Allow data files in native mod bundles 2026-10-29 15:00:57 -05:00
ElyTheCatandAntigravity cc4c49e8f9 Disconnect: do not show saving world screen on external server
In vanilla Minecraft (26.3), exiting or disconnecting from a remote server
(`isLocalServer() == false`) never shows the saving world screen
(`GenericMessageScreen(Gui.SAVING_LEVEL)`). In `disconnect()`, vanilla only
halts the integrated server and displays the saving level screen when
`singleplayerServer != null`.

Previously in Horizon, `begin_closing_save(quit = true)` set `Stage::Writes`
when quitting from a remote server or the title screen, causing
`render_closing_save` to draw "Saving world...", and `save_for_exit` called
`save_game()` on exit even for remote worlds.

- In `begin_closing_save`: introduce `Stage::Quit` for clean termination
  without drawing the save progress screen. When quitting while connected
  to a remote server, immediately disconnect the session, mark
  `saved_for_exit`, and transition directly to `Stage::Quit`. Quitting
  from the title screen also uses `Stage::Quit`.
- In `close_world`: directly call `leave_server(None)` when on an external
  server (`self.external_server()`), skipping `begin_closing_save`.
- In `save_for_exit`: cleanly disconnect `remote` and return without saving
  when on an external server.

Co-Authored-By: Antigravity <[email protected]>
2026-10-29 23:30:08 +03:30
Aria Figueredo df440f90b2 Content mods: set per-state outline and collision shapes 2026-10-29 14:59:03 -05:00
Aria Figueredo 791ac3d928 Content mods: allow a block default state override 2026-10-29 14:58:30 -05:00
Ludovic MarieandClaude Opus 5.5 f9e5264df7 Claims: /claim and /unclaim on issues, stale claims released after 5 days
Anyone comments `/claim` on an issue to be assigned (GitHub lets an issue's
commenters be assigned, no role needed); an assigned issue is taken.
`/unclaim` gives it back; the trusted reviewers can `/unclaim @login`.
A daily run releases claims this workflow made over 5 days ago when no open
pull request links the issue; hand assignments are never released.

Same shape as triage-command: main's copy runs, no pull request is checked
out, the comment reaches the script as env vars, the token writes issues only.

Part of #3859.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 20:54:06 +01:00
Ludovic Marie 668419b92a Merge pull request #3526 from kacpherek/tools/port-ledger-harness
🤖 Agent: verified by pr-triage-3. Dev tooling only (tools/port_ledger.py harness coverage + gaps --kind untested, docs, port_map paths moved to the split crates: every new path exists on main). Merges cleanly with main; tests/test_port* 30 pass; skip-release.
2026-10-29 20:52:30 +01:00
d3grandoandClaude Opus 5.5 f5de793b38 Wither breaks parity: hold the wither in place until it breaks
The scenario depended on the wither staying put for the 20 ticks before
destroyBlocksTick fires. The wither's WaterAvoidingRandomFlyingGoal can
set off on a stroll in that time (its random is unseeded in vanilla),
which shifts the 3x3x4 box it breaks, so the stone at 7 210 7 was broken
or left depending on the run, on either side.

Teleport it back to 8.5 210 8.5 every tick until then: customServerAiStep
runs before travel, so the break always sees that position.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 02:44:22 +07:00
DUzzL bfda2bf165 Only a piston base stands in for a retracting moving_piston 2026-10-29 20:38:51 +01:00
DUzzL 5782df1c03 Lever on a piston's back no longer drops when the piston retracts
A retracting piston is a moving_piston block for two ticks. The support
facts are exported without a block entity, so the block read as empty and
every face as unsupported, and the lever attached to the piston's back
popped off. Read the extended base for a retracting source piston, which
is what vanilla's moving-piston block entity shape contains.
2026-10-29 20:36:08 +01:00
Ludovic MarieandClaude Opus 5.5 d3c6f0d937 Merge main into #2987 (lan_entities.rs: lan_display_data beside main's lan_entity_uuids)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 20:34:23 +01:00
d3grandoandClaude Opus 5.5 52a380cd2f Merge origin/main into fix-3503
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 02:30:27 +07:00
d3grandoandClaude Opus 5.5 150412d353 benchmarks: rerun the Windows RD 8 and RD 32 games on an idle machine
ludovic111 pointed out that the first pass's RD 8 and RD 32 games had builds
running alongside, which docs/benchmark.md keeps out of published results.
Each game now started only with no compiler or other game running and the
CPU under 15 % for 30 s, and a game during which one started (or other
processes used over 15 % for 10 s) was run again. RD 16 was already idle.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 02:30:03 +07:00
Ludovic MarieandClaude Opus 5.5 5fb9092073 Merge main into #3341: inline objects (#3327) beside the component shadow colour
The glyph loop takes both: an inline object draws and skips the shadow passes; other glyphs use the component's shadow_color. Both sides' tests kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 20:28:16 +01:00
DUzzL 5f931e3659 Draw a worn elytra on armour stands (#3843)
ArmorStandRenderer adds WingsLayer after the armour layers, but
armor_stand_geometry never drew the chest slot's wings. Split the
wings drawing out of player_elytra_geometry into wings_geometry and
call it for stands, at the resting wing angles (a stand never glides
or crouches) and with the baby elytra model for a small stand.
2026-10-29 20:20:07 +01:00
DUzzL b9ed9d58de Fix axolotl NBT test: query glowing effect by namespaced id
Mob::add_effect normalizes ids to their minecraft: form (08b97652), but the
test asked has_effect for the bare "glowing", so the assertion failed.

Fixes #3840
2026-10-29 20:18:27 +01:00
Ludovic MarieandClaude Opus 5.5 e40ea748d1 Merge main into this branch: Polish beside main's Chinese, Spanish and Ukrainian
Language::ALL holds eight and every list of codes names pl. Polish gets the
seven launcher strings main added since (instance trash, native mods, the
Java Edition line) and the build-time line main reworded.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 20:17:49 +01:00
d3grandoandClaude Opus 5.5 9afb898e80 Merge remote-tracking branch 'origin/main' into fix-3153
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 02:15:41 +07:00
d3grandoandClaude Opus 5.5 ef3163c244 Merge origin/main into fix-3236
tools/lan_e2e.py: the mooshroom check and main's shulker_menu and keys_released checks, all kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 02:13:41 +07:00
FauxandClaude Opus 5.5 96877dcf48 Far terrain: no dark band in the sea where chunks were loaded
A chunk's summary kept the chunk's own light, which fades a level per block
of water, while the seed's far columns light water and its floor as open
sky. The chunks a player passed then drew a darker band through the far sea.
Summaries now light open water and its floor as open sky, and the water is
one span again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 12:11:33 -07:00
GIGABAIT93 7d227270a2 Merge branch 'main' of https://github.com/horizon-rust/horizon into feat/launch-api-client
# Conflicts:
#	crates/horizon-client/src/game.rs
2026-10-29 21:11:06 +02:00
d3grandoandClaude Opus 5.5 3931a46585 lan_e2e: the player beside the eater hears each bite once too
check_eating (each player eats a loaf in front of the other) now also
counts entity.generic.eat on both sides: the eater and the watcher must
each hear one bite per crumb burst the eater draws, plus
FoodProperties.onConsume's sound, for the loaf eaten (#3129).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 02:07:35 +07:00
degepieandClaude Opus 5.5 bcfeeeeb2a Merge main into fix/issue-3024-worn-armor-glint
main added render_layers (armour without the body) and a body_visible flag;
its extra layers now carry the overlay too, like render_with's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UE3PMKbnTcxfBSeT5uQWCK
2026-10-30 00:03:43 +05:00
Ludovic MarieandClaude Opus 5.5 84c3af5122 Merge main into this branch: the pumpkin beside main's cape and glowing changes
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 20:00:31 +01:00
Ludovic MarieandClaude Opus 5.5 e28ed6d877 Spawners: no level built while no player is in range
`BaseSpawner.serverTick` returns first thing without an alive player within
its range (`isNearPlayer`) or with `spawner_blocks_work` off, before any
draw. Each spawner still built the spawn code's level every tick for it:
every player with its box and mode, the nearest-player list and the mob
world. Ask the players directly first, without collecting them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 19:58:32 +01:00
GIGABAIT93andClaude Opus 5.5 b6b9a5a307 Text displays riding the local player sit over its head too
/ride a text_display mount @s makes the window's own player the
vehicle, which isn't in mobs: the display stayed where it spawned. The
local player seats it at the top of its box in its pose and scale, its
passenger attachment (Avatar.POSES), as for other players.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 20:48:57 +02:00
Ludovic MarieandClaude Opus 5.5 d8e912738b Merge main into the branch: the HDR graphics page shares the video title key
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 19:46:02 +01:00
Ludovic MarieandClaude Opus 5.5 c7aca8489f Merge main into the branch: keep the world icon beside the preset check
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 19:42:46 +01:00
d3grandoandClaude Opus 5.5 34c77f9eac lan_e2e: check that a mooshroom's colour reaches the guest
New `mooshroom` check: a mooshroom summoned with Type "brown" is drawn
brown on the host and the guest, and a red one a bolt strikes
(MushroomCow.thunderHit) turns brown on both screens, with the server's
Type "brown". DATA_TYPE is synched data entry 18 (#3236).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 01:35:21 +07:00
d3grandoandClaude Opus 5.5 67a960b045 Merge origin/main into bench-windows-results
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 01:25:47 +07:00
Ludovic MarieandClaude Opus 5.5 20ffb882bd Merge the launcher layer (main c7065027b) into the docs layer
main's edit to the WebAssembly server mods section goes with the section.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 19:23:40 +01:00
Ludovic MarieandClaude Opus 5.5 38a315331d Merge the crates layer (main c7065027b) into the launcher layer
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 19:22:50 +01:00
Ludovic MarieandClaude Opus 5.5 36ca9df57b Merge the game layer (main c7065027b) into the crates layer
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 19:22:04 +01:00
Ludovic MarieandClaude Opus 5.5 20acff0b3c Scheduled ticks: run the due ticks against one level
`tick_scheduled` built the level (`with_level`: the boxes of every cart,
arrow and guest, the fire-spreading players, the game rules, the ticket
levels) again for each due block and fluid tick. Run the due ticks in one
`with_level` while each leaves nothing for the game to apply between
them, level events or a spill; then the game handles those as before, so
every tick still sees what the ones before it did.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 19:20:16 +01:00
Ludovic MarieandClaude Opus 5.5 1ea5ec5964 Merge main into hdr-tiers: the tiers paragraph beside HDR's own screen and Auto
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 19:19:29 +01:00
d3grandoandClaude Opus 5.5 8168d96082 Merge origin/main into fix-3503
Conflicts: the creative screen's tooltip takes main's tab names
(draw_stack_tooltip_with) and this branch's TooltipFlag.isCreative for a
grid slot; horizon-protocol's item.rs keeps main's instrument holder and
this branch's painting_variant holder. The new wire test's Dynamic gets
main's dialog_tags by default.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 01:12:36 +07:00
d3grandoandClaude Opus 5.5 e09cbf2b9e Merge origin/main into fix-3091
Conflicts kept from both sides:
- mobs/ai.rs: parrots register through parrot::register (flight), next to
  main's own rabbit and ocelot arms.
- tools/test_mob_ai_parity.py: the parrot scenarios and main's wolf_hurt.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 01:07:41 +07:00
bloodulonandQoder 27e16c3e01 Merge origin/main into pr/packs-overlay
Resolved zip.rs: main added a_name_falls_back_to_its_folder_entry where this
branch added its deflate tests; kept both.

Co-Authored-By: Qoder <[email protected]>
2026-10-29 22:54:48 +05:00
GIGABAIT93 88e10db8e5 Merge branch 'main' of https://github.com/horizon-rust/horizon into feat/launch-api-client
# Conflicts:
#	crates/horizon-client/src/game.rs
2026-10-29 19:54:47 +02:00
Ludovic MarieandClaude Opus 5.5 1c4b029b95 Merge the launcher change (main d009ebd) into the docs
main's content mod docs (items patch their template's components) kept; its
change to the WebAssembly API reference goes with the page.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 18:54:01 +01:00
Ludovic MarieandClaude Opus 5.5 31c0c3dfe4 Merge the crate removal (main d009ebd) into the launcher change
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 18:52:54 +01:00
Ludovic MarieandClaude Opus 5.5 2fb276d5f6 Merge the game branch (main d009ebd) into the crate removal
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 18:48:54 +01:00
Federico Tagliani fea840e0d4 Merge origin/main into fix/break-effects-for-popped-blocks 2026-10-29 18:38:08 +01:00
k3yhandClaude Opus 5.5 7830c6de4a Merge main into the branch; keep both spawner.rs additions (acting_player_is_op, tick_remote_spawners)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 12:37:58 -05:00
Ludovic MarieandClaude Opus 5.5 cf558b0c0a Merge the game branch (main 1b38710) into the crate removal
main's change to the SDK's horizon.wit goes with the SDK.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 18:37:38 +01:00
Ludovic MarieandClaude Opus 5.5 0f9adac090 Merge main into hdr-tiers: keep #3176's UI brightness beside the light tiers
UI Brightness takes params[6]; the tier lift also skips pixels the hand or
HUD covers, as main's lift does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 18:34:26 +01:00
Federico TaglianiandClaude Sonnet 5.5 582331c3ea lan_e2e: popped_break_effects mines by hand in survival, torch on top
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-29 18:32:47 +01:00
GIGABAIT93 8b65dc4516 Merge branch 'main' of https://github.com/horizon-rust/horizon into feat/launch-api-client
# Conflicts:
#	crates/horizon-client/src/game.rs
2026-10-29 19:26:44 +02:00
Ludovic MarieandClaude Opus 5.5 73558e3673 Merge main into hdr-tiers: keep #3145's black level beside the light tiers
The black level takes params[5], before the tiers' vec4s at 8, 12 and 16.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 18:22:59 +01:00
Federico TaglianiandClaude Sonnet 5.5 eed02f0cda lan_e2e: popped_break_effects check for blocks that pop off a mined support
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-29 18:20:27 +01:00
Federico TaglianiandClaude Sonnet 5.5 bc5fd427ab Armor stands: isFalling before the move, isInWater from the fluid surface
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-29 18:12:03 +01:00
Ludovic MarieandClaude Opus 5.5 2c8b7ee172 Merge main into the branch: keep both lang test blocks
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 18:04:37 +01:00
Ludovic MarieandClaude Opus 5.5 95c234cc1e Merge main into the branch
Keep main's Component::Instrument beside this branch's StewEffects (enum,
test and item_wire_probe).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 18:00:27 +01:00
Federico TaglianiandClaude Sonnet 5.5 dacde01da2 lan_e2e: merchant-close check for the trade screen closing out of reach
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-29 17:55:16 +01:00
Ludovic MarieandClaude Opus 5.5 3e1f39899c Merge main into fix-3153: keep both the wither breaks and ender dragon corpus groups
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 17:51:27 +01:00
Muhammad Asif 26c139f901 Keep launcher links on horizon-rust/horizon in release notes
Player-facing notes used GITHUB_REPOSITORY, so fork CI rewrote the
launcher releases href and failed
test_a_game_release_opens_with_the_way_to_the_launcher.
2026-10-29 21:51:25 +05:00
DenisHumenandClaude Opus 5.5 07cd6c90a8 rea_vanilla: run npx by its path, so it starts on Windows
On Windows npx is npx.cmd, and subprocess (CreateProcess) does not find
it by name: the script stopped with FileNotFoundError. Resolve it with
shutil.which, as the script already does for rea, and say what is
missing when Node.js isn't installed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 18:49:33 +02:00
levzzzandClaude Opus 5.5 d4f466623d Merge main into fix/issue-3024-worn-armor-glint: the armour glint moves to overlay 36
Main gave overlay 35 to text drawn with a polygon offset (TEXT_POLYGON_OFFSET_OVERLAY,
its own material in gfx/entity_batch.rs), so armour with 35 would be drawn as that
material. The test now lists it among the overlays the glint must not take.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 21:47:51 +05:00
DenisHumenandClaude Opus 5.5 01bf07dd5d Buckets and bottles pick up the water the eyes are in
BlockGetter.traverseBlocks visits the block a ray starts in first, and
VoxelShape.clip hits a shape that contains the ray's start. pick_fluid
began stepping from the eyes' block without testing it, so under water
a bucket took the next source along the ray (the feet's, looking down)
and no air pocket could be made. Fixes #3787, #3233.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 18:40:25 +02:00
ThatCakeIsAPieandClaude Opus 5.5 c9999e3336 Worldgen: data packs' block state providers join the state_providers bundle
worldgen/block_state_provider was missing from overrides::KINDS, so a
pack's own providers (WWOO's wythers:stony_cliffs) never reached the
state_providers bundle the generator already reads, and every feature
using one was skipped. pack_files_go_to_their_bundles covers the folder.

Reported by AdachiReiYay's agent on #3476.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 11:36:10 -05:00
bloodulon 1ab99bec27 Packs: an unreadable zip entry costs that file, not the whole overlay 2026-10-29 21:26:49 +05:00
ThatCakeIsAPie 6b01498127 Merge feat/level-shape-11 into feat/datapack-biomes-1: data packs' block state providers 2026-10-29 11:24:10 -05:00
ThatCakeIsAPie 5983bae947 Merge feat/level-shape-10 into feat/level-shape-11: data packs' block state providers 2026-10-29 11:24:10 -05:00
ThatCakeIsAPie ab82d71a96 Merge feat/level-shape-9 into feat/level-shape-10: data packs' block state providers 2026-10-29 11:24:09 -05:00
ThatCakeIsAPie c3daaa8762 Worldgen: data packs' block state providers join the state_providers bundle
worldgen/block_state_provider was missing from overrides::KINDS, so a
pack's own providers (WWOO's wythers:stony_cliffs) never reached the
state_providers bundle the generator already reads, and every feature
using one was skipped. pack_files_go_to_their_bundles covers the folder.

Reported by AdachiReiYay's agent on #3476.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit bd92abce3b0ba8f209f8a613acd5741cb9e4b825)
2026-10-29 11:24:09 -05:00
ThatCakeIsAPieandClaude Opus 5.5 3a37c32d8d Merge upstream main into feat/level-shape-1
world.rs keeps main's FxHashMap/FxHashSet imports beside this branch's
SectionMask. Main's writes_mark_exactly_the_reachable_sections sorted
(column, mask) pairs, and a SectionMask has no order: it sorts by the
column, which each pair has once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 11:23:30 -05:00
Ludovic MarieandClaude Opus 5.5 2286b52f01 Streaming: build each proto chunk's light view once
A column at the edge of the loaded area lights against its decorated
neighbours past the area, so the streamer turns those proto chunks into
columns (`light_view`) on the tick thread. It built them again for every
light job and for every retry of a column still waiting on its last
neighbour: on a dedicated server with 50 bots, 59 220 views for 5 345
proto chunks. Keep each view until its proto is checked out, replaced or
removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 17:20:51 +01:00
GIGABAIT93andClaude Opus 5.5 91591e4dcf Player skins: skin_entries as a function, with a test
skin_entries holds the lookup update_remote_skins does, so a test can
play an NPC plugin's add, spawn and remove: the entity keeps the skin
its entry gave, a player spawned before its entry takes it when it
comes, and a removed entity forgets it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 18:14:55 +02:00
Federico TaglianiandClaude Sonnet 5.5 6180a78195 Ghast: target position, move control timing, look angle and shot sounds as vanilla
getSuitableFlyToPosition returns the first random position (no mirror under
the heightmap unless 64 tries fail); GhastMoveControl tests floatDuration
before decrementing it; GhastLookGoal turns with the float 180/pi and
Mth.atan2; the warning cry and the shot are level events whose pitch is the
client's, not draws from the ghast's random.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-29 17:14:38 +01:00
Ludovic MarieandClaude Opus 5.5 a11e54e7b8 Merge main into the branch
Keep #3543's hurt flash for other players beside the main-hand stack.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 17:01:41 +01:00
GIGABAIT93andClaude Opus 5.5 731896f222 Player entities keep the skin they found: NPCs show theirs
NPC plugins add an NPC's profile to the player list, spawn it, and take
the entry off the list a moment later to hide it there. Vanilla keeps
it: AbstractClientPlayer.getPlayerInfo looks the PlayerInfo up once and
holds it, so getSkin still reads its textures. PlayerInfoRemove dropped
the profile's textures here, so on tensa.co.ua every NPC showed its own
skin for about two seconds, then a default one (efe, zuri, sunny, kai).

level_player_textures keeps, per player entity, the textures it found
first, as level_player_names already keeps its name; update_remote_skins
resolves a player whose entry is gone from them. A new entity, a removed
one and a new level forget theirs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 17:58:21 +02:00
Federico TaglianiandClaude Sonnet 5.5 8b5145eaa5 Armor stands: bubble columns push them, and water slows and floats them
An armor stand used the air travel in water too and ignored bubble columns,
so one standing in a soul sand column never rose. LivingEntity.travel now has
its water branch (slow down 0.8, gravity / 16 through getFluidFallingAdjusted
Movement), and the blocks the stand is inside (a bubble column) push it
between the move and the friction, as Entity.move's checkInsideBlocks does.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-29 16:55:45 +01:00
Federico TaglianiandClaude Sonnet 5.5 2f804ed55f Merge main into fix/wither-immune-to-wither-friends
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-29 16:48:18 +01:00
Federico TaglianiandClaude Sonnet 5.5 7703ebcf95 Cat: avoidance goal last, sprint while dashing
Cat.reassessTameGoals adds the player-avoidance goal after registerGoals, so
it is evaluated last. Cat.customServerAiStep sets sprinting while the move
control's speed modifier is 1.33: +30% movement speed, and Entity.baseTick
draws twice from the mob's random for the sprint dust. The probe names the
goal CatAvoidEntityGoal as vanilla's subclass.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-29 16:42:19 +01:00
ThatCakeIsAPieandClaude Opus 5.5 52cc53a4f9 Surface rules: an empty biome list keeps the name lookup
An empty `biome_is` list on a surface that does not number its biomes
compiled to the id comparison, since collecting no indices never asks
`biome_index`. It then failed with MissingBiomeProvider where vanilla and
main answer false (material_condition's codec-corpus condition 49). It
keeps the name lookup main uses. Review on #3366.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 10:41:38 -05:00
NetuosoDEVandOpenAI Codex 267b92182e Format the hoisted block tint lookup
Apply rustfmt to the shorter default_tint call after hoisting the grass colour.

Co-Authored-By: OpenAI Codex <[email protected]>
2026-10-29 17:41:19 +02:00
NetuosoDEVandOpenAI Codex 240ac19e3c Compute default grass colour once per block-model draw
Move the active colormap lookup outside the model/face loops, as requested in
review. All tinted faces in this draw share the same default grass colour.

Implemented by OpenAI Codex on behalf of NetuosoDEV.

Co-Authored-By: OpenAI Codex <[email protected]>
2026-10-29 17:40:45 +02:00
GIGABAIT93andClaude Opus 5.5 bf9928423c Text displays ride their vehicles: an NPC's name sits over its head
NPC plugins hang a text display on a fake player with SetPassengers, and
vanilla seats it every tick (Entity.rideTick, positionRider) at the
vehicle's passenger attachment, the top of its box, less the display's
own vehicle attachment, which is 0. remote_set_passengers placed only
mobs and the local player, so a ridden display stayed where it spawned,
at the NPC's feet (tensa.co.ua's lobby: the glyph titles under the NPCs).

A remote text display now keeps its vehicle and position_riders seats
it after the tick, from the last tick's seat, so it follows a moving
vehicle smoothly; a teleport sent meanwhile no longer drags it off.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 17:32:24 +02:00
leifiyooandClaude Haiku 5.5 39b6aa46bc Furnace minecart keeps its push length, as vanilla does
MinecartFurnace.calculateNewPushAlong projects the push onto the
movement and scales it back to the push's own 3D length. Horizon kept
the push as x/z only and normalized with the vertical part, so the
push lost length every tick while gravity gave the movement a vertical
part (the cart moved with a 0.04 per tick fall). A cart fuelled from
about half a block away slowed down to about 0.56 to 0.79 of vanilla's
distance over its 3 minutes of coal.

Keep the push as a Vec3 between ticks. Saving still writes only PushX
and PushZ, and loading and fuelling set y to 0, as vanilla does.

Vanilla: MinecartFurnace.applyNaturalSlowdown, calculateNewPushAlong,
addFuel, addAdditionalSaveData, readAdditionalSaveData;
Vec3.projectedOn, Vec3.normalize.

Co-Authored-By: Claude Haiku 5.5 <[email protected]>
2026-10-29 16:26:53 +01:00
leifiyooandClaude Haiku 5.5 f9cac972ad Template placement clears the block entity it replaces
/place template wrote a block's saved data over whatever block entity
was at its position and dropped the old one without removal handling.
Over the same block state, place_state returns early, so a playing
jukebox kept its song and an open container screen stayed on the
replaced entity.

StructureTemplate.placeInWorld first sets a barrier where a block with
saved data goes, which makes LevelChunk.setBlockState remove the entity
there. Do the same before placing: remove the entity and its custom name,
stop a removed jukebox (place_state does that itself when the block's
name changes) and close a container screen open on it.

Refs #3708

Co-Authored-By: Claude Haiku 5.5 <[email protected]>
2026-10-29 16:25:28 +01:00
Ludovic MarieandClaude Opus 5.5 8ca96ad967 Server brand: Horizon's server names itself "horizon"
The integrated, LAN and dedicated server sent minecraft:brand "vanilla"
(MinecraftServer.getServerModName) while Horizon's client sends "horizon".
A modded server names itself, so Horizon's does too: F3 shows it, and a
server admin can tell Horizon servers apart (bunchy7s, Discord).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 16:14:47 +01:00
leifiyooandClaude Haiku 5.5 978c42216a Replace block entities in a loaded chunk by block state
load_chunk put each loaded block entity into the map over any entity
already at its position and kept that position's ticker slot whatever
the new block state was. Vanilla's LevelChunk.setBlockEntity drops the
previous entry, and updateBlockEntityTicker rebinds the ticker only when
the new state has one, removing it otherwise.

Mark replaced positions and, at the next tick, free their slot unless
the block state ticks. Add a test covering a replacement that keeps the
slot and one that frees it.

Vanilla: LevelChunk.setBlockEntity, LevelChunk.updateBlockEntityTicker,
LevelChunk.registerAllBlockEntitiesAfterLevelLoad.

Co-Authored-By: Claude Haiku 5.5 <[email protected]>
2026-10-29 15:53:51 +01:00
Federico TaglianiandClaude Sonnet 5.5 c11d57d1f8 Break effects: a block that pops off when its support is mined plays its break sound and particles for the miner
The server sent every level event of an acting player's action with that
player excluded, so a torch or flower that popped off when the player mined
the block it stood on was silent (no break sound, no particles) for the
miner. Block.playerWillDestroy excludes the player only from the destroy
events of the block it breaks (and its other half); what the break sets off
afterwards goes through destroyBlock with no player. Only the events up to the
broken block's are the player's own now.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-29 15:46:59 +01:00
NetuosoDEVandOpenAI Codex ddc2a6d7e6 Merge origin/main into fix/enderman-carried-block-tints
Resolve the carried-block overlap with #2986 while preserving upstream's iron
golem flower layer, fox item context, minecart changes and renderer crate split.
Keep the captured carry transform and per-face BlockTintSource defaults; remove
the superseded single-tint helper that only the old enderman path used.

Carry the tint implementation into horizon-client-render/src/mesher.rs and
update the differential harness's source path after the upstream module move.

Resolved by OpenAI Codex on behalf of NetuosoDEV. No additional local tests
were run, as requested by NetuosoDEV; the updated PR head is checked by CI.

Co-Authored-By: OpenAI Codex <[email protected]>
2026-10-29 16:27:13 +02:00
Federico TaglianiandClaude Sonnet 5.5 0b6c48be77 Zombified piglin: it runs Zombie.registerGoals too, with the turtle egg goal
ZombifiedPiglin extends Zombie and only overrides addBehaviourGoals, so it
keeps the turtle egg goal (priority 4) that Zombie.registerGoals adds. Horizon
left it out, so the goal never drew its start delay and the mob's random
stream drifted from vanilla's on its second tick.

Adds a zombified_piglin_player scenario to the mob_ai harness.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-29 15:23:54 +01:00
NetuosoDEVandOpenAI Codex d3e2fe8bf3 Render enderman carried block states with vanilla tints
Use the baked block-state model instead of the block item's model so flowers,
fungi and roots keep their cross geometry and state properties survive. Remove
the item-centering compensation while retaining the vanilla carry transform.

Apply BlockTintSource.color(state) to tinted block-model faces using the active
grass colormap and vanilla default foliage colours. Keep in-world sugar cane
and lily pad colours unchanged. Use BlockModelResolver's fixed model seed 42.

Add a differential adapter checking 6,616 state/tint-index combinations against
Minecraft 26.3 and a scratch-world offscreen screenshot driver. The existing
captured-vertex transform regression now checks block coordinates directly.

Implemented by OpenAI Codex on behalf of NetuosoDEV. NetuosoDEV manually tested
the fix in game and confirmed it works.

Co-Authored-By: OpenAI Codex <[email protected]>
2026-10-29 16:23:20 +02:00
bunchy7s 815beda680 Refresh command block edit screen with server data
Send the command block's block-entity data when opening its screen and
apply incoming block-entity updates to the open edit screen. This makes
the command and output settings match the server instead of a stale
client copy, mirroring vanilla's openCommandBlock and
handleBlockEntityData behaviour.

Files:
- crates/horizon-client/src/game.rs
- crates/horizon-client/src/game/command_blocks.rs
- crates/horizon-client/src/game/remote.rs
- crates/horizon-client/src/lan/chunks.rs
2026-10-29 09:19:03 -05:00
ThatCakeIsAPieandClaude Opus 5.5 8e0939f3e8 Merge upstream main into feat/level-shape-1
Main's horizon-client-render split (#3186) moved chunk.rs, world.rs,
streaming.rs and gfx.rs, which this branch changes: section_mask.rs moves
with them into horizon-client-render, and horizon-client re-exports it
beside the other moved modules. lan/chunks.rs keeps both imports (main's
spawner traits and SectionMask).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 09:14:39 -05:00
umcekoandClaude Opus 5.5 df96b6787d NeoForge oracle: export items' data components and armour facts
Each item now carries its default components (vanilla's codecs, 1.21.1's
form), its effective attribute modifiers (armour's come from a method,
not a component), enchantability and repair items, and for armour its
slot, defense, toughness, knockback resistance, equip sound and texture
layers: the ground truth an item port is compared against. The export
also creates its output folder instead of failing to write.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 17:13:19 +03:00
Ludovic MarieandClaude Opus 5.5 1a01f5ef59 Merge main into the branch
Main added block_model_vertices_tinted (one tint for every tinted face)
for mob_blocks.rs; it now calls this branch's tinted_block_model_vertices
with that tint for tint indices >= 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 15:10:01 +01:00
ThatCakeIsAPie a717d6d583 Merge feat/upgrade-datapack-3: refuse pack entries that leave the pack 2026-10-29 09:08:50 -05:00
ThatCakeIsAPie 1ffe686350 Merge feat/upgrade-datapack-2b: refuse pack entries that leave the pack 2026-10-29 09:08:50 -05:00
ThatCakeIsAPie 217216e263 Merge feat/upgrade-datapack-2a: refuse pack entries that leave the pack 2026-10-29 09:08:48 -05:00
ThatCakeIsAPie 825f8f8845 Merge feat/upgrade-datapack-1: refuse pack entries that leave the pack 2026-10-29 09:08:47 -05:00
ThatCakeIsAPieandClaude Opus 5.5 0771f59bca upgrade-datapack: refuse pack entries that leave the pack
A zip entry named `../x` or `/x` (or `C:\x` on Windows) was written as it
was, outside `<world>/datapacks/<name>-26.3/`. `read_pack` now takes each
entry's name from `enclosed_name()` and refuses a pack with one that has
anything but plain components, and `upgrade_into` refuses to write such a
path. Review on #3369.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 09:08:46 -05:00
Federico TaglianiandClaude Sonnet 5.5 0c79bae87d Wither skeleton: its piglin target goal comes first among the priority 3 goals
WitherSkeleton.registerGoals adds its AbstractPiglin target goal before it
calls super.registerGoals, so among the priority 3 target goals it is
evaluated before the iron golem and turtle ones. Horizon added it last, so
the goals drew their random intervals in another order and a wither
skeleton's random stream drifted from vanilla's on its second tick.

Adds a wither_skeleton_player scenario to the mob_ai harness.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-29 15:04:55 +01:00
Ludovic MarieandClaude Opus 5.5 c455bb6ec7 Merge main into the branch
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 15:04:30 +01:00
xKumorioandClaude Opus 5.5 a91952a8c0 Merge main: keep only what #3085 doesn't have
#3085 already moved the bow, trident, throws, potions and wind charge to
known_player_movement(), and main has the Windows test fixes (#3088, and
#3587 for port_publish.py). This branch takes main's version of all of
those. What it keeps: Guest::known_movement, set on every accepted move
and zeroed by a ClientTickEnd without one (handleClientTickEnd), and the
save and restore of Game::known_movement in enter_guest/leave_guest.
The moves.last() copies in UseItem, the spear's jab and the per-tick
using turn go, since enter_guest sets the value for every turn.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 18:58:55 +05:00
Federico TaglianiandClaude Sonnet 5.5 5071edb248 Mobs: the path maluses vanilla's constructors set (fire, lava, powder snow, cocoa, trapdoors)
Animal, AbstractVillager, AbstractPiglin and CopperGolem set FIRE to -1 and
FIRE_IN_NEIGHBOR to 16; Fox, Parrot, Frog, Goat, Wolf, Blaze, ZombifiedPiglin
and WitherSkeleton set their own. Horizon left every mob on PathType's
defaults (FIRE 16, FIRE_IN_NEIGHBOR 8), so animals, villagers and piglins
walked through fire that vanilla paths around.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-29 14:55:47 +01:00
vvnikita74 c5a734eace fix: sleep only when it is dark outside, not whenever the thunder flag is set (#3709)
Beds checked the level's raw thundering flag, whose timer also runs in
clear weather, so players could sleep through a sunny day. The Overworld's
bed_rule sleeps WHEN_DARK, as vanilla's Level.isDarkOutside: skyDarken >= 4,
from the time of day and the rain and thunder levels.
2026-10-29 16:47:08 +03:00
Federico TaglianiandClaude Sonnet 5.5 51005638e0 Skeletons: a path out of the shade stops at the first node the sky sees
GroundPathNavigation.trimPath, with avoidSun set by RestrictSunGoal, cuts a
path that starts out of the sun at its first sunlit node, so a skeleton
chasing a player by day waits in the shade. Horizon never trimmed a path.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-29 14:46:18 +01:00
Alexander KrylovandHermes Agent 3b3560d71d Launcher: remove several versions at once
App::removing held one version, and remove() returned early while it was
set, so a second row's Remove did nothing until the first delete ended.
It becomes the list of versions in flight: each row starts its own
delete, Msg::Removed drops its own tag, and the rows, Play and Install
ask whether that tag is in the list. The gate is removable(), so the
two-at-once case has a test.

Fix #3719.

Co-Authored-By: Hermes Agent (Nous Research) <[email protected]>
2026-10-29 16:45:47 +03:00
Federico TaglianiandClaude Sonnet 5.5 94eff29428 Villagers: the trade screen closes when the trader is gone or out of reach
AbstractVillager.stillValid keeps a trade screen open only while the trader
lives and the player is within the entity interaction range plus 4 of its
box. Neither the host's own trade screen nor a guest's (which includes the
single-player window on the server thread) was checked, so the screen
stayed open after walking away.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-29 14:36:20 +01:00
Federico TaglianiandClaude Sonnet 5.5 136349ae95 Villagers: a baby that grows up gets the adult brain (Villager.ageBoundaryReached)
Horizon built a villager's brain once, with its baby flag, so a villager
that grew up kept the baby schedule (play) and never went to work. At the
age boundary the brain is now rebuilt as Villager.refreshBrain does: running
behaviours stop, the packed memories carry over and the sensors' first scans
are delayed by draws from the mob's random.

Adds villager_grows_up scenarios to the mob_ai harness.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-29 14:22:45 +01:00
Ludovic MarieandClaude Opus 5.5 558904775f Merge main into this branch
Text displays: main's text_display::draw and Lines (#2812) replace this
branch's inline drawing, with this branch's display_light (the same light);
this branch's display_data and transformation are kept beside them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 14:10:43 +01:00
Ludovic MarieandClaude Opus 5.5 5cdf9a9151 Docs: Coordinates HUD joins Horizon's official native mods
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 14:09:02 +01:00
Federico TaglianiandClaude Sonnet 5.5 01125c3023 mob_ai: chicken and pig panic scenarios, one beside a pool
chicken_panic_192 fails without the Chicken water malus (nav path of 7
nodes through the pool instead of vanilla's 5).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-29 14:06:08 +01:00
degepieandClaude Opus 5.5 8537e29c92 Merge remote-tracking branch 'origin/main' into fix/issue-3137-suspicious-stew
Conflicts:
- game/stations.rs: keep both tooltip lines, the ominous bottle's before
  the suspicious stew's, in ItemStack.addDetailsToTooltip's component order.
- item_tooltip.rs: keep both tests; the stew test now expects main's
  zero-padded durations ("00:03", "00:07").

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UE3PMKbnTcxfBSeT5uQWCK
2026-10-29 18:06:00 +05:00
Federico TaglianiandClaude Sonnet 5.5 398b1dd2d8 Chicken: water costs nothing to path through, as in vanilla's constructor
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-29 13:59:17 +01:00
Ludovic Marie 4812518327 Merge main into the branch
Co-Authored-By: Claude Opus 5.5 <[email protected]>

# Conflicts:
#	crates/horizon-client/src/game/creatures.rs
2026-10-29 13:53:24 +01:00
Ludovic MarieandClaude Opus 5.5 7daca92c4a rustfmt: sulfur cubes join the baby-flag group
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 13:53:01 +01:00
Username59138andClaude Opus 5.5 fa77b35140 Creative inventory: the Saved Hotbars tab, as vanilla shows it
The HOTBAR tab was skipped since the creative tabs came in (#49, "Not
covered: ... the saved-hotbars tab"), while saving and loading toolbars
with C or X and a hotbar key already worked.

- CreativeModeInventoryScreen.selectTab on the HOTBAR tab: the nine
  saved rows of hotbar.nbt; an empty row shows a paper in its own slot
  with creative_slot_lock and the item name inventory.hotbarInfo, named
  after the bound save and hotbar keys. The rows are read when the tab
  is selected and when the inventory opens on it.
- CustomCreativeSlot.mayPickup: a locked stack can't be clicked.
- Creative::shown gives a grid cell's stack, None for a toolbar's empty
  slot, for the clicks, the hover, the drawing and horizon-ctl.
- VanillaCreativeSearchOracle compared the tabs without the HOTBAR one,
  which Horizon didn't show; it now compares every tab vanilla shows
  (shouldDisplay). The tab's display items are empty on both sides: its
  contents come from HotbarManager when it is selected.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 15:52:12 +03:00
Federico TaglianiandClaude Sonnet 5.5 e0fecd8b8e Fish: swim targets pass the water malus check, and FishMoveControl turns as vanilla
Cod, salmon, tropical fish, pufferfish, tadpoles, squid and dolphins keep
PathType.WATER at 0 (WaterAnimal and AgeableWaterCreature constructors).
Horizon left it at 8, so DefaultRandomPos rejected every water position
and RandomSwimmingGoal retried ten times, ending on a spot in the air.
FishMoveControl also computes its yaw like MoveControl does.

Adds cod, salmon and tropical fish scenarios to the mob_ai harness; the
probe names the fish goal FishSwimGoal as vanilla does.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-29 13:51:02 +01:00
k3yhandClaude Opus 5.5 a839b0cef1 An op's spawn egg sets its entity data on a spawner
SpawnEggItem.useOn on a spawner takes the type from getType, the egg's
entity data id when it has one, and for an op (PlayerList.isOp) calls
Spawner.setEntityData: TypedEntityData.loadInto sets the next spawn
data's id and merges the egg's data into it. Horizon set only the egg's
own type, so a custom egg gave a plain mob.

The acting server guest's permission level is kept beside its name and
UUID (lan_acting_permission), so the check is the acting player's own.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 07:42:40 -05:00
masa-masa-0314andZCode Agent 845dbae91b Fix a recursive fallback in the world content tables' accessors
`Game::items`/`recipes`/`stations` fell back to themselves when the world
had no data packs instead of to `Resources.rest`, so a world without packs
recursed until the thread spun at 100%: the window never joined its
integrated server and showed "Loading terrain..." forever.

Co-Authored-By: ZCode Agent <[email protected]>
2026-10-29 20:42:34 +08:00
Ludovic Marie a167a89215 Merge branch 'draft/remove-wasm-mods-crates' into draft/remove-wasm-mods-launcher 2026-10-29 13:39:00 +01:00
Ludovic Marie 953a5a84ee Merge branch 'draft/remove-wasm-mods-launcher' into draft/remove-wasm-mods-docs 2026-10-29 13:39:00 +01:00
Ludovic Marie 2cd11c926f Merge branch 'draft/remove-wasm-mods-game' into draft/remove-wasm-mods-crates 2026-10-29 13:38:59 +01:00
jaszkusandjaszkus's AI agent 37a2cc0057 Add the Debug Stick
DebugStickItem: a left click selects a block-state property and a right click cycles its value (Shift reverses it), stored in the minecraft:debug_stick_state component. The client never breaks the block and swings on use; the server cycles the state and sends the block update.

The sneak direction follows the acting player's sneak input (host, toggled sneak or guest), a guest's command permission is swapped for its turn so game-master checks use the guest's level, and useOn returns the vanilla SUCCESS/FAIL, triggers ITEM_USED_ON_BLOCK on success and only swings the local actor's client.

Co-Authored-By: jaszkus's AI agent <[email protected]>
2026-10-29 13:37:04 +01:00
Ludovic Marie 029870bb90 Merge branch 'draft/remove-wasm-mods-launcher' into draft/remove-wasm-mods-docs
# Conflicts:
#	README.md
#	ROADMAP.md
#	roadmap/roadmap.json
#	roadmap/roadmap.toml
2026-10-29 13:32:46 +01:00
Shreyas d27a7cbce3 Sulfur cubes: align babyhood and egg offspring with vanilla 26.3
- Route sulfur cube baby flag through baby_index (entry 16) in lan.rs
- Remove client-side baby state derivation from size in remote_mob_data.rs
- Revert finalize.rs age_boundary_reached and set_baby to vanilla behavior
- Ensure spawn_egg_offspring sets size 1 on new sulfur cube offspring
- Drop lists.rs change from this branch
2026-10-29 18:00:54 +05:30
damnurmumandCodex 0d0411fc7a Merge latest main into rich item names and shadows
Pick up launcher and dragon changes that landed while the earlier merge was being tested.

Co-Authored-By: Codex <[email protected]>
2026-10-29 15:29:59 +03:00
damnurmumandCodex 8c739d2bc2 Merge main into rich item names and shadows
Resolve HUD shadow rendering conflict by keeping styled shadow colors and the new world text depth behavior.

Co-Authored-By: Codex <[email protected]>
2026-10-29 15:29:52 +03:00
Ludovic Marie 1afbdca0f0 Merge branch 'draft/remove-wasm-mods-crates' into draft/remove-wasm-mods-launcher 2026-10-29 13:26:49 +01:00
Ludovic Marie b25d588c91 Merge branch 'draft/remove-wasm-mods-game' into draft/remove-wasm-mods-crates 2026-10-29 13:25:05 +01:00
levzzzandClaude Opus 5.5 c566e69c6c Tick dropped items again, and keep a cooling-down entity out of a gateway
The first commit replaced the tick_items span with the gateway handler, so
dropped items stopped falling, merging and despawning in every mode. The
call is back, next to the gateway's.

An entity that has just come through a portal carries PortalCooldown 300.
EndGatewayBlock.entityInside still triggers the gateway's own cooldown, but
Entity.setAsInsidePortal then only restarts the entity's cooldown, whatever
the portal: the gateway now asks the shared portal state first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 17:21:13 +05:00
Ludovic MarieandClaude Opus 5.5 461a8757e3 Merge main into the branch
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 13:19:44 +01:00
martipopsandClaude Opus 5.5 5601fea75e Let /damage hurt players other than the acting one
cmd_damage only handled the window's own player and mobs: any other player
(a LAN guest, a dedicated server's player, a splitscreen player) fell through
to "Target is invulnerable". Run it as that player through for_player, as
/effect does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JLHp82HU35NWsN14K4taHT
2026-10-29 07:53:41 -04:00
jaszkusandjaszkus's AI agent e83ef39df4 Place and collect water in waterlogged blocks
A water bucket fills the clicked LiquidBlockContainer (stairs, slabs, fences, trapdoors and other SimpleWaterloggedBlocks) instead of the block next to it, and an empty bucket's SOURCE_ONLY ray now targets waterlogged blocks too, so their water can be picked up again. The empty-bucket use also reports the vanilla FAIL/PASS result, applies the sneak rule, keeps creative's filled-result behaviour and lets only creative players waterlog a barrier.

Co-Authored-By: jaszkus's AI agent <[email protected]>
2026-10-29 12:52:43 +01:00
d3grandoandClaude Opus 5.5 158075a8e8 Eating: the eater hears each bite once
Consumable.emitParticlesAndSounds plays its bite through
Player.playSound, which is level.playSound(player, ...): the server
sends it to everyone but the eater, whose own client plays it. A guest's
server turn played it into the broadcast to all, so the eater (every
single-player player, on the server thread) heard each bite twice: its
client's and the server's.

The server now sends a guest's Player.playSound to the others only, and
the client plays the last bite itself at USE_ITEM_COMPLETE
(completeUsingItem's emitParticlesAndSounds(16)), which it drew the
crumbs of but left silent. lan_e2e's eat check counts the bites heard
against the crumb bursts drawn.

Fixes #3129

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 18:41:12 +07:00
d3grandoandClaude Opus 5.5 e8c1a797c8 Mooshrooms keep their colour: save Type, sync DATA_TYPE at 18
MushroomCow.addAdditionalSaveData / readAdditionalSaveData were never
ported, so a brown mooshroom (summoned, or turned by lightning) loaded
back red. MushroomCow.DATA_TYPE is entry 18 (after AgeableMob's
DATA_BABY_ID and AGE_LOCKED), not 17: on a vanilla server the colour
change from MushroomCow.thunderHit never reached the renderer, and a
Horizon host sent an INT where vanilla clients expect AGE_LOCKED's
BOOLEAN.

Fixes #3236

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 18:39:41 +07:00
d3grandoandClaude Opus 5.5 9fa7dddbe4 Let parrots fly: flying navigation and move control, flapping and gliding
Parrot.createNavigation and Parrot.calculateFlapping had no port, so a
parrot walked and hopped like a land mob, fell like a stone off a block
and never flew, tame or not.

- Parrot(): FlyingMoveControl(10, false), whose idle tick lets gravity
  back on; the FIRE_IN_NEIGHBOR, FIRE and COCOA maluses at -1; and
  createNavigation's FlyingPathNavigation (no doors, floats).
- ParrotWanderGoal: in water, LandRandomPos(15, 15); otherwise (all but
  one time in a thousand) getTreePos, the first empty block with an
  empty one above over leaves or a log within 3/6/3 in betweenClosed
  order; else WaterAvoidingRandomFlyingGoal.getPosition, now shared as
  Mob::flying_stroll_pos.
- calculateFlapping after aiStep: the wing state (folded on the ground
  or as a passenger), and a fall through the air slowed to 0.6. A
  multiplayer client runs the wing part for the parrots it displays.
- Parrot.isFlapping/onFlap from Entity.processFlappingMovement: the
  entity.parrot.fly beat each half flapSpeed flown.
- canFlyToOwner: a parrot may teleport onto leaves next to its owner.

tools/test_mob_ai_parity.py gets four parrot scenarios (two on open
grass, one by a tree, one let go ten blocks up), on Peaceful because
Parrot.getAmbient's imitation roll uses the level's random. They match
vanilla on every tick; on main they diverge at tick 1.

Fixes #3091

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 18:29:08 +07:00
iLostName 4e5b26f9fb elder guardian: a player already cursed isn't cursed again every minute
The check looked up `minecraft:mining_fatigue`, but the player's effects are kept by their bare name, so it never matched: the curse, its sound and the apparition came back at every 1200-tick pulse. As MobEffectUtil.addEffectToPlayersAround does, a curse as strong that doesn't end within the next minute now stays.
2026-10-29 12:19:58 +01:00
Federico TaglianiandClaude Sonnet 5.5 9828599067 Wither: take no damage from wither friends (skulls, blasts)
WitherBoss.hurtServer rejects damage caused by a non-player mob in
#wither_friends (the undead, withers included). Horizon only filtered
the wither's own targeting, so skulls and explosions from one wither hurt
its neighbours, which then retaliated through HurtByTarget.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-29 12:10:07 +01:00
Ludovic MarieandClaude Opus 5.5 84185641bc Merge main into perf/worldgen-surface-biomes
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 12:07:11 +01:00
Ludovic MarieandClaude Opus 5.5 c0b3b5b3e9 Launcher: the night sky behind every page
sky.rs draws the night look's backdrop: the sky in texel bands, stars that
twinkle in steps, three layers of hand-drawn clouds drifting a texel at a
time, a sun cut in slices and two skylines. Sprites are baked once per
appearance and scale into tiles that don't depend on the window's size; a
frame is asked for only when something on screen changes, never under
reduced motion (macOS, or HORIZON_LAUNCHER_MOTION=off), and not 10 s after
the window loses focus. It replaces the stone texture and Home's landscape.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 11:58:28 +01:00
iLostName 3c9b2599d8 block placement: a click on a block is handled before the move behind it, so pillar blocks are heard
The hub applied a player's move before the game ran the UseItemOn sent ahead of it, so BlockItem.canPlace checked the box after the move: mid-jump the server placed a block the client had refused, and only the client plays the place sound. The move now waits for the next tick, as it already does behind a dig. Fixes #3568.
2026-10-29 11:50:46 +01:00
iLostName ce2b51090f minecart: right-clicking a tnt minecart uses the held item, so a crossbow shoots at it
MinecartTNT has no interact of its own, so Entity.interact passes and Minecraft.startUseItem goes on to the item; the server client ended every click on a minecart there. A command block minecart without a game master, and a rideable one when sneaking or ridden, pass the same way. Fixes #3588.
2026-10-29 11:48:45 +01:00
Ludovic Marie edd11b6103 Merge remote-tracking branch 'origin/main' into upd/3401 2026-10-29 11:47:06 +01:00
iLostName 30d33e077f off hand: filling a composter or using bone meal ends the click before the off-hand torch
ComposterBlock.useItemOn and BoneMealItem.useOn are SUCCESS on vanilla's client, so Minecraft.startUseItem never tries the off hand; the server client predicted both as passing. A sapling, azalea or mushroom still passes there, as isValidBonemealTarget needs a ServerLevel. Fixes #3536.
2026-10-29 11:44:34 +01:00
damnurmumandCodex be2d3582e7 Keep rich item names in inventory sync and match shadow channel floors
Send the stored custom-name component through the server inventory codec and use vanilla float-to-channel conversion for RGBA shadow colors. Cover both paths with focused tests.

Co-Authored-By: Codex <[email protected]>
2026-10-29 13:28:40 +03:00
Ludovic MarieandClaude Opus 5.5 3c6bdc2e5b Launcher: the night look's specimen (HORIZON_LAUNCHER_PAGE=specimen)
Draws the night tokens' type and colours in the launcher itself, over the
sky's stops, with each text colour's contrast on a plate over the brightest
stop and the rounded and pixel-cut plate corners side by side. Not a page
players reach; for checking the tokens in the real renderer.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 11:19:38 +01:00
Ludovic MarieandClaude Opus 5.5 99071a1160 Launcher: night tokens and Bricolage Grotesque in horizon-theme
horizon_theme::night: the night sky look's colours (NIGHT, and DAWN for Light),
type steps, radii and the Bricolage Grotesque cuts (tools/bake_bricolage.py,
OFL), with AA tests over every sky stop. tokens.css gains --night-*. The
launcher reads them: Night::blocks() dresses the screens not rebuilt yet in
the night's colours, and Bricolage replaces Geist and Pixelify Sans there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 11:19:37 +01:00
deloskiyt c6fbd42aee Audio: play break sound and track stats when tools break while mining (#3524)
Fixes missing item break sound effect and broken statistic tracking:
- When a tool breaks from mining a block (mine_block_with_held), route
  durability wear through damage_held rather than clearing the slot silently.
- Route weapon wear in mace.rs and brush wear on armadillos in creatures.rs
  through damage_held.
- Play entity.item.break sound and re-apply equipment when worn armor
  breaks from Thorns in enchant_effects.rs.
2026-10-29 11:13:20 +01:00
degepieandClaude Opus 5.5 35345be102 Fish form schools: port FollowFlockLeaderGoal (#3026)
Cod, salmon and tropical fish had only panic, player avoidance and random
swimming. AbstractSchoolingFish adds FollowFlockLeaderGoal (priority 5, no
flags): after a 100-110 tick start delay a fish joins a nearby school with
room or gathers the free fish around it, and followers path to their
leader while it lives and is within 11 blocks. FishSwimGoal stops while the
fish follows (canRandomSwim), a leader forgets an empty school on a 1/200
level-random roll, and schools hold 8 (5 for salmon).

Recruiting changes other fish, so it goes through two MobEvents that
apply_brain_events applies after the recruiter's tick.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UE3PMKbnTcxfBSeT5uQWCK
2026-10-29 15:09:49 +05:00
malordinandClaude Sonnet 5.5 ff0c089ac5 Launcher: refill the asset store at start-up, not on Play
`complete_assets` also runs when Play is pressed, so a store with most of its objects
missing made the player wait for thousands of downloads and a sign-in with nothing on
screen. `refill_own_store` now runs in `reuse_prepared_everywhere`, on the start-up
thread, and Play only copies what is there; the gate's test pins both places.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-29 15:03:16 +05:00
degepieandClaude Opus 5.5 d9f40c6942 Adventure: don't predict breaking a block the player may not break
MultiPlayerGameMode.startDestroyBlock refuses before predicting when
Player.blockActionRestricted holds: an adventure player without a
can_break item. The client predicted the break anyway (sound, crack,
the block gone) and the server sent it back, and continueAttack swung
every tick. A stack the server sent with can_break still breaks; the
server judges its predicate.

Fixes #3027.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UE3PMKbnTcxfBSeT5uQWCK
2026-10-29 14:43:19 +05:00
masa-masa-0314andZCode Agent 6e2ac2522d Re-trigger the pull request checks (no run arrived for the head commit)
Co-Authored-By: ZCode Agent <[email protected]>
2026-10-29 17:42:05 +08:00
masa-masa-0314andZCode Agent e72a8c5c6e Data packs: load the world's packs into the content tables
A world's data packs now change what the game plays with, the way
`ReloadableServerResources` loads a server's: recipes, loot tables,
advancements and tags from `<world>/datapacks` merge over the resource
root's own, at world open and on `/reload`. A pack's recipe or
advancement replaces the game's file for the same id
(`SimpleJsonResourceReloadListener` hands out the top resource of each
stack); tag files join the game's entries with `replace` dropping the
lower sources (`TagLoader.load`). Worlds without packs keep loading
exactly as before.

`datapack::DataStore` collects the packs' `recipe/`, `loot_table/`,
`advancement/` and `tags/…/` files (`DataStore.files`, the built-in
pack excluded: its files are the resource root's own, which the tables
read from disk). `horizon_world::loot::PackOverlay` carries them into
the loaders: `Items` (loot tables, item/block/entity_type tags),
`Recipes`, `StationData` (smithing, stonecutting, brewing, the recipe
book index), `advancements::Tree` and `LootData` (structure-block
containers). The game keeps the pack tables in `Game::world_tables`
and reads them through `Game::items`/`recipes`/`stations` (the
`world_items!`-family macros give the same field-level borrows at
conflict sites), rebuilding them when the world opens and on
`/reload`, with the advancement tree and the loot and LAN sync caches
forgotten alongside.

Not covered yet: worldgen registries, trade/banner/enchantment
registry files from packs, and the prepare-time behavior bundles
(mining facts stay with `block-behaviours.json`).

Co-Authored-By: ZCode Agent <[email protected]>
2026-10-29 17:42:05 +08:00
deloskiyt eaa5549a3b Render: draw carved pumpkins and mob heads on player and humanoid heads (#3549)
Ports CustomHeadLayer.submit for players and humanoid mobs:
- Renders carved pumpkins, jack o'lanterns, and mob/player heads worn
  in the head equipment slot on the player model and humanoid mobs.
- Adds head_item_geometry to mob_block_geometry, player_model_geometry
  (third person), and draw_player_preview (inventory preview).
- Correctly skips armor helmets (handled by HumanoidArmorLayer) and
  body-slot species (equines, wolves, etc.).
- Keeps player model extra.head and extra.armor synchronized in
  tick_player_model.
- Updates tools/port_map/client-005.tsv mapping.
2026-10-29 10:41:02 +01:00
iLostName 0bf91b8822 ender pearl: one that hits an end crystal still takes its thrower there
A thrown projectile that hit a crystal or a dragon part stopped at onHitEntity; a pearl, an egg and a snowball now go on to their onHit. Fixes #3081.
2026-10-29 10:40:17 +01:00
damnurmumandCodex c01f4f646b Merge main into rich item name colors
Preserve styled custom names in loot component updates and cover the merged behavior.

Co-Authored-By: Codex <[email protected]>
2026-10-29 12:36:47 +03:00
Muhammad Asif c74d170fbc rustfmt pearl and wind-charge boxes 2026-10-29 14:36:21 +05:00
Ludovic MarieandClaude Opus 5.5 21773ca7f5 Merge main into this branch
streaming.rs moved to horizon-client-render (#3186) and main now sweeps far
columns only on some updates (if sweep); this branch's changes (no area at a
negative radius, rank_full_task, its test) are applied there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 10:33:55 +01:00
Ludovic MarieandClaude Opus 5.5 29d24f48df Merge main into this branch
Main's handleUseItem sets the guest's known movement (ServerPlayer.getKnownMovement)
before the item use; this branch's horn sound is kept in the same closure.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 10:27:37 +01:00
levzzzandOpenAI Codex 6534db4f6d Specify the equipment regression fixture's mob registry type
Co-Authored-By: OpenAI Codex <[email protected]>
2026-10-29 14:24:18 +05:00
Muhammad Asif ce45e065c3 Let thrown pearls hit wind charges
AbstractWindCharge is pickable, so ThrownEnderpearl's
ProjectileUtil.getEntityHitResult can strike it and onHit teleports.
Horizon only targeted mobs and players, so a pearl passed through a
charge. Add the charge's entity box to the pearl's targets.
2026-10-29 14:23:49 +05:00
levzzzandOpenAI Codex 69689b3fdd Cover named equipment replacement through save and reload
Co-Authored-By: OpenAI Codex <[email protected]>
2026-10-29 14:23:48 +05:00
levzzzandOpenAI Codex c6dfae6dd7 Keep live enchantments when displaying and saving named equipment
Co-Authored-By: OpenAI Codex <[email protected]>
2026-10-29 14:18:51 +05:00
levzzzandOpenAI Codex f75896ec45 Retry unloaded gateway arrivals and identify the fixture entities by tag
Co-Authored-By: OpenAI Codex <[email protected]>
2026-10-29 14:13:49 +05:00
levzzzandOpenAI Codex ae72e1f6ca Add a two-path saved vehicle tree and passenger restoration audit
Co-Authored-By: OpenAI Codex <[email protected]>
2026-10-29 14:12:50 +05:00
levzzzandOpenAI Codex 164cfd6b11 Restore server riders after their chunk is sent and refresh entity pairing
Co-Authored-By: OpenAI Codex <[email protected]>
2026-10-29 14:12:19 +05:00
levzzzandOpenAI Codex 7d0e5aa953 Do not save replaced main-hand components from the raw entity
Co-Authored-By: OpenAI Codex <[email protected]>
2026-10-29 14:04:47 +05:00
levzzzandOpenAI Codex 09a9735630 Keep unsupported saved vehicle types pending without respawning them
Co-Authored-By: OpenAI Codex <[email protected]>
2026-10-29 14:04:46 +05:00
levzzzandOpenAI Codex a80973335c Merge current main before rerunning End gateway cargo proof
Co-Authored-By: OpenAI Codex <[email protected]>
2026-10-29 14:03:47 +05:00
levzzzandOpenAI Codex ace27c11a9 Keep named held stacks current and use full death-message display names
Co-Authored-By: OpenAI Codex <[email protected]>
2026-10-29 14:01:23 +05:00
levzzzandOpenAI Codex c91ca07115 Merge current main and use its preset-aware terrain interface
Co-Authored-By: OpenAI Codex <[email protected]>
2026-10-29 13:58:50 +05:00
levzzzandOpenAI Codex c001f56d0f Merge current main before death-message review fixes
Co-Authored-By: OpenAI Codex <[email protected]>
2026-10-29 13:58:45 +05:00
levzzzandOpenAI Codex b36a63fb39 Merge current main and retain vanilla features save status
Co-Authored-By: OpenAI Codex <[email protected]>
2026-10-29 13:58:03 +05:00
levzzzandOpenAI Codex f86c946a3c Merge current main and preserve saved vanilla vehicle trees
Co-Authored-By: OpenAI Codex <[email protected]>
2026-10-29 13:57:42 +05:00
v3nn7andCodex 65043ba092 Sync furnace minecart fuel exhaustion
Co-Authored-By: Codex <[email protected]>
2026-10-29 09:56:12 +01:00
d3grandoandClaude Opus 5.5 daa5415724 Paintings: the item's variant is placed and named in its tooltip
A painting item with a `painting/variant` component (every one but the
first in the creative tab) placed a random painting and showed only
"Painting". HangingEntityItem.useOn runs Painting.create's random pick,
then EntityType.createDefaultStackConfig applies the stack's components
(Painting.applyImplicitComponents sets the variant) and the painting must
still survive. HangingEntityItem.appendHoverText adds the variant's title,
author and size, or "Random variant" in a creative tab without one.

The component also crosses the wire now (a painting_variant holder,
component 109): a creative client's pick reaches the server, and the
server's stacks keep their variant on the client.

Fixes #3503

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 15:54:33 +07:00
v3nn7andCodex f2edc255d8 Render carved pumpkins on player heads
Co-Authored-By: Codex <[email protected]>
2026-10-29 09:54:31 +01:00
v3nn7 f6144df193 Show powered furnace minecarts on remote clients 2026-10-29 09:53:17 +01:00
degepieandClaude Opus 5.5 861be0b075 Armour: worn pieces and the elytra show the enchantment glint
The player's armour layers (local player, other players, LAN guests)
never carried the glint, and the elytra drew with overlay 0. The armour
glint's overlay code, 13, was also the boat water mask's, so a glinting
layer drew depth only: an armour stand's enchanted chestplate was
invisible.

EquipmentLayerRenderer.renderLayers: each layer and its trim take the
armour glint when ItemStack.hasFoil, never the hurt tint (NO_OVERLAY).
ARMOR_GLINT moves to 35, past every material overlay of the entity
batch.

Fixes #3024.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UE3PMKbnTcxfBSeT5uQWCK
2026-10-29 13:50:58 +05:00
levzzzandOpenAI Codex bd59c0bab2 Pick up validated standard macros for body hooks
Co-Authored-By: OpenAI Codex <[email protected]>
2026-10-29 13:47:44 +05:00
levzzzandOpenAI Codex d3cb2f5c29 Pick up HEAD macro preservation in the launcher mixins pin
Co-Authored-By: OpenAI Codex <[email protected]>
2026-10-29 13:47:44 +05:00
v3nn7andCodex e851af06d0 Add Polish translations
Co-Authored-By: Codex <[email protected]>
2026-10-29 09:43:11 +01:00
d3grandoandClaude Opus 5.5 11d3f08c12 Wither: broken blocks give way to their fluid, so water stays water
A wither's block breaking (WitherBoss.customServerAiStep) calls
Level.destroyBlock, which sets the cell to fluidState.createLegacyBlock()
with flag 3. Horizon's mob BreakBlock event wrote air instead, without
neighbour updates: a wither in water carved an air pocket, a waterlogged
block lost its water, and the pool did not flow back in. The event now
sets the fluid's block through setBlock (skipped when that is already
the cell), and the wither's break sound (level event 1022) only counts
cells that changed, as destroyBlock's return value does.

Checked by a new "wither breaks" group in the command execution harness.

Fixes #3153

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 15:28:03 +07:00
v3nn7andCodex c4f7b4f964 Fix teleport commands without explicit targets
Co-Authored-By: Codex <[email protected]>
2026-10-29 09:23:48 +01:00
GIGABAIT93andClaude Opus 5.5 cbd1b1c93e Launch API: horizon-client's options for other launchers (#3545)
The game's side of the Launch API, experimental, version 0.1.0:
--game-dir (vanilla's --gameDir), --home, --fullscreen (vanilla's, not
saved to options.txt), --session-stdin and --launch-api, which prints
the API version and the options a launcher may pass as JSON.

A refused command line now exits 2 without a crash report; errors keep
1 and panics 101. The crash report's path stays the last stderr line,
its prefix now a constant (crash::SAVED_LINE).

docs/api/launch.md is the surface page; docs/api/launch-reference.md is
generated from game/launch_api.rs and a test keeps the two together.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 10:19:25 +02:00
Kacpherek 25e39a2f2e Follow the crate split: repoint 1,272 map rows to their files' new crates 2026-10-29 09:07:15 +01:00
Kacpherek 630f3feec5 Merge branch 'main' of https://github.com/ludovic111/horizon into tools/port-ledger-harness
# Conflicts:
#	docs/port-ledger.md
#	tools/port_ledger.py
2026-10-29 09:07:15 +01:00
Senjin c075240fa3 Merge remote-tracking branch 'origin/main' into hdr-screenshot 2026-10-29 08:32:56 +01:00
Senjin 84d49077c0 Merge remote-tracking branch 'origin/main' into hdr-tiers 2026-10-29 08:29:53 +01:00
Ludovic MarieandClaude Opus 5.5 7d43179850 Docs: the official native mods in the hook points section
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 07:46:57 +01:00
Ludovic MarieandClaude Opus 5.5 64ff13890a Launcher: WebAssembly mods need a native port
The registry keeps its WebAssembly mods (Mod Menu, lookat, blockscope…)
in the index, so the modpacks that need them keep installing. The browser
neither lists nor installs one: its versions say "needs a native port".
A modpack still installs it, with its code left out (the game doesn't run
it), and Installed shows "Not ported: its code (needs a native port…)".
A WebAssembly mod is a `.hmod` that may do more than add content; content
mods are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 07:46:57 +01:00
Ludovic MarieandClaude Opus 5.5 0c9a49390e Crates: remove the WebAssembly mod runtime, its SDK and the official WebAssembly mods
The game no longer runs WebAssembly code mods (the previous commit), so the
workspace drops what made and ran them: horizon-mods' runtime, commands and
test harness (wasmtime, wit-component, wit-parser), the SDK and its WIT
contract and examples, the sandbox's guest crates, and mods/official (the
official mods are native now, one native/<name>/ folder each in horizon-rust/horizon-mods).

horizon-mods keeps content mods, modpacks and the registry index (whose
api_level still reads published .hmod files). `cargo horizon-mod` makes
content mods only: `new` has one template, `build` refuses a crate,
`check` refuses a .hmod with code and points to native mods, and `test`
(the sandbox) is gone. CI no longer installs the wasm32 target.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 07:46:57 +01:00
Ludovic MarieandClaude Sonnet 5.5 708f0b48bf Docs: WebAssembly code mods are gone; content and native mods remain
docs/mods.md is now about content mods (`cargo horizon-mod`, the manifest, the
content fence), native mods, publishing, the official native mods and a short
note on the removed WebAssembly mods. docs/api/mods.md and mods-reference.md
(the code API) are deleted. Other pages, the CLAUDE.md crate table and the
roadmap (five WebAssembly API items removed, others reworded for native mods)
no longer describe the sandbox, the SDK or the WIT.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-29 07:46:57 +01:00
malordinandClaude Sonnet 5.5 2d98bf8dae Launcher: fetch the assets a stopped download left out, and stop waiting on quiet connections
A download from Mojang that stopped on the way (the assets' failure is one log line)
leaves the asset store with some of its files, and every completion that copies from
it (the sounds, the languages, #1870) then finds nothing to copy and the game plays
silent and in English. Asking for it again did not help: the folder is found as it is,
so Prepare again never reached Mojang.

`complete_assets` now asks the owner gate again (`download_for_owner`, the one door to
Mojang's files) when Horizon's own store exists and a prepared version has no sounds or
no languages, once per run. The download keeps the files already whole, checked by sha1,
and fetches the rest; a non-owner fetches nothing, which the gate's test now also covers
for a store that lacks assets.

In that download each asset is tried three times and one that keeps failing does not
stop the rest: the log says how many failed and the first one's reason, and the next
run fetches what is left.

Requests had no timeouts, so one connection that went quiet held the whole download
for ever: the agent now gives up after 15 s to connect and 60 s without data.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-29 11:04:15 +05:00
Kacpherek 451720bb56 Port ledger: link parity harnesses to the methods they cover; list untested ports 2026-10-29 06:40:06 +01:00
Alexander KrylovandHermes Agent 5485e189f8 Options: Horizon's own captions read the bundled language
The options pages, the mod and shader pack lists, the agent button and the
multiplayer friend screens drew their own labels as literals, so a client with
ru_ru stayed English there. They read `horizon.*` keys now, and the bundled
namespace carries both languages for every one of them.

Co-Authored-By: Hermes Agent (Nous Research) <[email protected]>
2026-10-29 08:35:09 +03:00
d3grandoandClaude Opus 5.5 aded903dd2 benchmarks: Horizon v0.2.97 vs vanilla 26.3 on Windows 11 (9800X3D, RTX 5080)
The first perf_bench run on Windows: Horizon v0.2.97, vanilla 26.3 and vanilla with Sodium,
Lithium, FerriteCore and ImmediatelyFast, render distances 8, 16 and 32 at 1280x720, three
games each. The reports are in benchmarks/perf. The page next to them gives the setup, the CPU
load and compiler activity during each run (Windows has no load average), and the tables.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 08:29:52 +07:00
xKumorioandClaude Opus 5.5 f9494ef93e Arrows shot mid-jump carry the jump: projectiles add the known movement
Projectile.shootFromRotation adds source.getKnownMovement() to the
projectile, the vertical part only when the shooter is off the ground. For
a ServerPlayer that is lastKnownClientMovement: the move the client last
sent (handlePlayerKnownMovement), reset to zero by handleClientTickEnd when
no move came that tick.

Horizon added the player's PlayerMotion velocity instead. On the server
(single player's server thread, LAN, dedicated) a guest's velocity only
holds knockback, not the player's own movement, so an arrow shot while
jumping or running lost the shooter's motion and flew lower and shorter
than vanilla's.

Guests now keep known_movement: set on each accepted move, zeroed at a
ClientTickEnd without one. enter_guest puts it in Game::known_movement for
the turn and leave_guest restores the outer turn's, so nested turns keep
their own. Bows, tridents, snowballs/eggs/ender pearls, thrown potions
and wind charges take known_player_movement(), which the spear already
used. The spear and the per-tick using/digging turn no longer copy the
last of the tick's moves themselves, which was zero once those moves had
been consumed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 04:18:46 +05:00
Lyle ColeandClaude Opus 5.5 a7771347e6 Biomes: a world's data-pack biome files over the built-in table
with_packs replaces a built-in biome in place and adds new ones after the
built-in ids, which never move; registry_order gives vanilla's network
order (Identifier: path, then namespace, as RegistryDataLoader sorts).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 18:12:59 -05:00
ThatCakeIsAPieandClaude Opus 5.5 83b958a824 docs/world-height.md, a 2096-high fixture pack, and the tall parity run
tools/fixtures/tall_datapacks/horizon_tall_test is Horizon's own pack
(MIT): an Overworld dimension type of min_y -64, height 2096 (To The
Max's, the highest top vanilla allows) and noise settings that raise
terrain to about y 1900. VanillaChunkGenerationOracle builds each level
at its dimension type's range instead of a fixed -64..320, so
HORIZON_PARITY_DATAPACKS=tools/fixtures/tall_datapacks
tools/test_datapack_worldgen_parity.py compares Horizon's tall generation
with vanilla's: 16 chunks over two seeds, terrain and decorated, the same.

docs/world-height.md describes the model (one LevelShape per level, from
its dimension type, read everywhere), the network path, the checks and
what is left; world-generation.md and the README say packs' dimension
types now apply.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 18:12:58 -05:00
ThatCakeIsAPieandClaude Opus 5.5 148d592567 Uniform sections are shared, and the sky-source scan skips them
Sections of one block, one biome and one light value are one allocation
per kind, shared by every column (new chunks, lighting, saved light);
edits copy them, as Arc::make_mut already does. A tall level is mostly
such sections: air with full sky light above the terrain. The relighter's lowest_sky_source passes
over a uniform section that light goes through instead of testing each
of its 16 blocks.

Memory only: every value read is the same.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 18:12:58 -05:00
ThatCakeIsAPieandClaude Opus 5.5 0a72ffbf5c Each level's shape from the world's dimension types, local and remote
Opening a world reads its levels' shapes from its dimension types, the
enabled data packs' over vanilla's (world_loading::level_shapes), and the
game keeps them (Game.level_shapes): each level's World, SaveDir,
streaming and flat terrain get its shape, and the teleport and portal
searches read a level's logical height from them. A host encodes each
level at its shape (HubConfig.levels) and sends the data of a dimension
type the packs changed even to a client that knows the vanilla pack
(NetConfig.levels, SyncData::registry_packets), so the integrated server
of single player and LAN guests see the same heights. A remote client
takes each level's shape and its chunks' column from the server's
dimension type, which now carries its logical height; the vanilla End's
fallback has sky light, as 26.3's the_end.json does.

A world with To The Max's dimension type is 2032 blocks high from here.
Vanilla worlds read vanilla's types: nothing changes there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 18:12:58 -05:00
ThatCakeIsAPieandClaude Opus 5.5 7a082c2176 Gameplay reads each level's bounds from its world
About ninety places took "where the level starts and ends" from the fixed
column: void damage, build limits, spawn and surface searches, falling
blocks, wind charges, commands, mob goals, navigation and paths, raids,
villagers' POI scans, fluid scans and the portal search. Those that used
the column for every dimension read the world's (World::bottom_y, top_y),
which is -64..320 in all three vanilla levels; those that chose per
dimension read the level's shape (LevelAccess from world.shape, Dim's
bounds from Dim::shape). Each level's World now holds its shape where it
is made. chunk::every_section replaces the per-file [true; SECTIONS]
arrays of the fluid scans.

Every value read is the one in use today.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 18:12:57 -05:00
ThatCakeIsAPieandClaude Opus 5.5 72317bb0c6 Worldgen: a level's build range from its dimension type, a data pack's over vanilla's
A pack's dimension_type/<id>.json joins the overrides (DIMENSION_TYPES).
LevelHeight is a dimension type's build range, logical height and
skylight, checked as its codec checks them; WorldgenOverrides::level_height
gives a vanilla level's, from the type its level stem names. The
generator takes the level's range from the same data instead of the
fixed table (dimension_type_height goes), so a pack's taller dimension
type no longer clamps the noise, and datapack::worldgen_overrides no
longer reports dimension types as left out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 18:12:57 -05:00
ThatCakeIsAPie 8e445b4c3d Merge the data pack worldgen series (feat/datapack-worldgen-4) under the level-shape series 2026-10-28 18:12:57 -05:00
ThatCakeIsAPieandClaude Opus 5.5 c4e54ad254 Section caches, generation glue, distant terrain, minimap and flat worlds read the column
The random-tick section cache keeps a section list as long as the chunk's
and counts its Y from the chunk's min_y. A generated chunk becomes a
column of its level's (OverworldGenerator::level gives the build range,
ColumnLayout::of_level its column), copying the whole level range, as
does a failed one. Distant terrain from proto chunks spans the level's
range, the minimap and saved-chunk far tiles scan from the chunk's own
bottom, and flat worlds lay their layers from the Overworld's minimum up
to its height (FlatTerrain::from_settings takes the level's shape). A
test ticks the sections of a 131-section chunk near its top.

Vanilla's levels keep their column and ranges, so nothing changes there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 18:12:56 -05:00
ThatCakeIsAPieandClaude Opus 5.5 9e91278794 Chunk packets map between the level and the client's column by the level's shape
The LAN encoder encodes a level of a LevelShape: its chunks hold the
shape's column, of which the level's own sections go on the wire, and the
heightmaps it sends count the column's sections from the chunk's min_y
(client_heightmaps_in takes it). A section's block entities sit at the
chunk's min_y. The remote client decodes chunk and light packets into the
column its ChunkFormat holds (the vanilla one until the server's
dimension types set it) instead of the fixed -64..320. A test encodes a
131-section column and checks its sections and light layers all go out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 18:12:56 -05:00
ThatCakeIsAPieandClaude Opus 5.5 fdb4e917c0 Saves read and write a chunk's own column, and SaveDir takes its level's shape
SaveDir::new takes the level's LevelShape from its caller instead of
guessing it from the folder name (LevelShape::for_dir goes). A saved chunk
is decoded into its level's column (decode_with, decode_proto), the
sections outside it left out; encoding, POI sections, heightmaps and the
saved light layers count sections from the chunk's own min_y, and distant
terrain read from saves spans the level's column. A test saves a
131-section chunk (yPos -4, 12-bit heightmaps) and reads it back whole,
and into the vanilla column without the sections above it.

Vanilla levels pass their vanilla shapes, so saves are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 18:12:55 -05:00
ThatCakeIsAPieandClaude Opus 5.5 c2b55479f1 World, streaming, meshing and the renderer read the level's column
World holds its level's LevelShape, and its chunks' column is the shape's.
Writes check the chunk's own range, the heightmap fallbacks and may_hold
read the column, and dirty section indexes are bounded by the mask instead
of the vanilla constant. Streaming marks the column's sections dirty, the
mesher places sections from the chunk's min_y, and the renderer builds its
occlusion graph, complete-column mask and section origins for the column
of the level it was cleared for (clear_sections takes it). A test streams
a 131-section level (To The Max's height) and checks that columns light
and mesh to y 2031, and that an edit at y 1800 relights and remeshes.

Every level is still the vanilla Overworld's shape here.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 18:12:54 -05:00
ThatCakeIsAPieandClaude Opus 5.5 a6d8409466 Light reads the chunk's column: flood fill, layers and relighting span its sections
light_chunk floods up to the centre chunk's own top, and the light it
returns, the saved and received light layers and the relighter's section
keys span the chunk's sections instead of the vanilla constants. The
relighter takes the column from the world it lights (LightWorld::layout,
the column its chunks hold), and LightChanges counts section indexes in
that column, so a taller level's sections near its top get relit and
remeshed too. Vanilla's column is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 18:12:54 -05:00
Lyle ColeandClaude Opus 5.5 46c62bdf2a LevelShape: each level's shape as one value, and the column its chunks hold
LevelShape (skylight, min_y, height, and now logical_height) moves from
save.rs to chunk.rs, where every subsystem can read it, and checks a
dimension type as its codec does. Its column is the span of sections a
chunk of the level holds: the level's own range widened to the vanilla
Overworld's -64..320, so vanilla's three levels keep the 24 sections
they have always had. ColumnLayout is that span
as a value; Chunk records its own min_y, and get, set, highest, light,
biome and the heightmap cache read the chunk's sections instead of the
constants.

Nothing makes a chunk of another column yet: vanilla is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 18:12:54 -05:00
Lyle ColeandClaude Opus 5.5 0c639904f1 Section sets past 32 sections: SectionMask replaces the u32 column masks
Dirty sections, the light edit log, random-tick and portal section caches,
the renderer's meshed-column masks and the LAN encoder's light masks held a
bit per section in a u32 or u64, which capped a column at 32 sections. A
256-bit SectionMask holds every layout a dimension type allows (254 sections
plus the two light borders). No behaviour change: the column is still 24
sections.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 18:12:53 -05:00
xKumorioandClaude Opus 5.5 ad644778bc Three Windows-only test failures in pr_ready
session_lock_is_exclusive read session.lock while its lock was held.
Windows file locks are mandatory, so that read failed with OS error 33.
It now reads the file once the first lock is dropped.

port_publish wrote the store path as str(path) with the home replaced by
"~", which kept Windows backslashes (~\code\...). The path under the home
is now written as ~/ plus its POSIX form, as on Linux. The temporary body
file is opened as UTF-8, so the "→" in a facts line no longer fails to
encode in the Windows code page.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 04:01:17 +05:00
JacobRWebbandClaude Opus 5.5 ee90b3b34b Moving blocks take their light from the cells their faces look at
A finished piston's block is drawn over the chunk mesh until that mesh
shows it, but it was lit with the light stored at the moving piston's own
cell. Once the placed block stands there and the edit is relit, that cell
is opaque and holds 0: the pushed or pulled block and the piston base
flashed black for the frames until the mesh came up (#3002).

Vanilla's PistonHeadRenderer.createMovingBlock gives each block a
MovingBlockRenderState (the lone block at the cell it moves from, the
level's light engine), and MovingBlockFeatureRenderer tesselates it with
ModelBlockRenderer.tesselateBlock: in tesselateFlat each quad reads
BlockModelLighter.getLightCoords at its cull-face neighbour, or
prepareQuadFlat's position (the neighbour when cubic, else the block).
Moving blocks now follow that through MeshTables::flat_light, the chunk
mesher's own flat-light rules; a finished one is lit as the block placed
at its cell, which it stands in for.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 17:46:24 -05:00
JacobRWebbandClaude Opus 5.5 a72f06cfab Test the moving piston's saved fields against vanilla's
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 17:28:37 -05:00
JacobRWebbandClaude Opus 5.5 fab9c37413 Moving pistons save facing as a byte, as Direction.LEGACY_ID_CODEC does
PistonMovingBlockEntity.saveAdditional stores facing through
Direction.LEGACY_ID_CODEC, Codec.BYTE of get3DDataValue. The block-entity
canonicaliser rewrote it as an int too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 17:27:45 -05:00
degepie ac7e491f3b Merge remote-tracking branch 'origin/main' into fix/issue-3137-suspicious-stew
# Conflicts:
#	crates/horizon-protocol/src/item.rs
2026-10-29 03:04:30 +05:00
degepieandClaude Opus 5.5 cb1c3499bf Keep suspicious stew effects across the wire and list them in creative
A stew taken from the creative inventory gave no effect when eaten and
its tooltip listed none (#3137). The protocol read the
`suspicious_stew_effects` component past without decoding it, so the
creative client's `SetCreativeModeSlot` sent the server a bare stew and
the server's copy had nothing for `SuspiciousStewEffects.onConsume` to
apply. Decode and encode it (`Entry.STREAM_CODEC`: mob effect id,
duration) both ways, and add `SuspiciousStewEffects.addToTooltip`'s
creative-only effect lines (`PotionContents.addPotionTooltip`).

Fixes #3137.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UE3PMKbnTcxfBSeT5uQWCK
2026-10-29 02:29:33 +05:00
JacobRWebbandClaude Opus 5.5 4a094bee90 Pistons: moving blocks keep their tint, survive saves and leave no black ghost
- Moving blocks are tinted per face with the chunk mesher's block colours
  (MeshTables::block_tints), not the terrain particle tint, which is none
  for grass blocks: a pushed grass block was drawn gray.
- PistonMovingBlockEntity is saved with its chunk as vanilla's
  minecraft:piston block entity and loaded back into the level's moving
  pistons, so blocks caught mid-move finish it after a rejoin instead of
  leaving an invisible, solid moving_piston (#3310).
- A server client drops its moving piston when the server changes that
  block (LevelChunk.setBlockState removes the block entity), instead of
  animating it for five more death ticks over the placed block, black and
  z-fighting (#3002).
- A finished piston stays drawn until the chunk mesh shows its block, and
  no longer, so no frame shows neither.

Fixes #3310
Fixes #3002

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 16:29:10 -05:00
ThatCakeIsAPieandClaude Opus 5.5 85bfbc7d46 upgrade-datapack: docs, and checks against vanilla 26.2 and 26.3
- docs/datapack-upgrade.md: how to run `horizon-port-pack
  upgrade-datapack`, every rewrite and how it is checked, and what is not
  rewritten; linked from docs/README.md and the command's help.
- tools/datapack_upgrade_rosetta.py writes vanilla 26.2's own worldgen out
  as a pack, upgrades it and compares it with vanilla 26.3's file by file:
  registries whose format changed and whose content did not must come out
  identical.
- tools/datapack_upgrade_fidelity.py starts vanilla's 26.2 and 26.3
  dedicated servers on the same seed, the first with a pack and the second
  with its upgrade, force loads the same chunks and compares the saved
  blocks; without packs it measures what 26.3 itself changed.

Both need the 26.2 server jar the player downloaded; nothing is fetched.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 14:57:24 -05:00
ThatCakeIsAPieandClaude Opus 5.5 f983223354 port-pack: upgrade-datapack rewrites features and placements
The fourth part of the 26.2 to 26.3 data pack upgrade.

- Configured features move to `feature/` with `config` unwrapped, block
  state providers take their 26.3 names (a `simple_state_provider` is its
  state), and nested and inline placed features are upgraded with them.
  Feature types 26.3 replaced by compositions of other features are listed
  in the report and left as they are.
- Placement `random_offset` becomes `offset` with one provider per axis
  (x and z both from `xz_spread`).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 14:57:23 -05:00
ThatCakeIsAPieandClaude Opus 5.5 3d39bbdaf1 port-pack: upgrade-datapack rewrites noise settings, dimensions and presets
The third part of the 26.2 to 26.3 data pack upgrade: noise settings in
26.3's form, with the parts 26.2 hard-coded written out as data.

- The beardifier, which 26.2's NoiseChunk added, is added to the final
  density.
- The aquifer router fields move to `aquifers`, whose `exclusion` spells
  out 26.2's `isDeepDarkRegion` (erosion < -0.225 and depth > 0.9) from
  the pack's own erosion and depth; `surface_level` is the preliminary
  surface, and `chunk_surface_level` its per-chunk 16 x 1 interpolation.
- 26.2's ore veinifier becomes two `ore_vein` material rules (copper,
  iron) with OreVeinifier's heights, thresholds, edge roundoff, solidness,
  richness and gap, ahead of the surface rule: 26.2 placed veins while
  filling the noise and its surface pass only replaced the default block.
  The rule is written as a named `material_rule` under the settings' id.
- The climate functions are named, and the spawn target refers to them by
  id (`depth` and `offset` dropped, as vanilla did).
- `size_horizontal`/`size_vertical` are dropped: each `interpolated` holds
  its cell.
- Inline noise settings in dimensions and world presets get the same.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 14:57:23 -05:00
ThatCakeIsAPieandClaude Opus 5.5 2aca6fe06c port-pack: upgrade-datapack rewrites density functions
The second part of the 26.2 to 26.3 data pack upgrade: named density
functions in 26.3's form.

- Inputs are named `input`/`left`/`right`; `invert` is `reciprocal`,
  `y_clamped_gradient` a `gradient` on y, `shifted_noise` a `noise` with
  shifts, `end_islands` `end_outer_islands`, and `constant` its number.
- 26.2's `flat_cache` held each column's value at y = 0, so it becomes a
  `cache` around a `slice` at y = 0 when its input depends on y (through
  the pack's own functions); 26.2's other caches only memoise in 26.3.
- `interpolated` takes its cell from the noise settings whose router
  reaches it (`size_horizontal * 4`, `size_vertical * 4`), which 26.2 read
  from the settings, or vanilla's overworld cell when none does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 14:57:23 -05:00
ThatCakeIsAPieandClaude Opus 5.5 81b3803017 port-pack: upgrade-datapack, a 26.2 data pack's registries in 26.3's formats
Vanilla 26.3 refuses a world generation data pack written for 26.2: the
registries changed format. `horizon-port-pack upgrade-datapack <pack>
(<out> | --world <world>)` reads a pack (zip or folder) and writes it in
26.3's formats, with a report of what it rewrote, what has no faithful 26.3
form and which types it does not know. Each rewrite is the one vanilla's own
data went through between 26.2 and 26.3.

This first part handles the registries that need no context:
- noise parameters: `firstOctave`/`amplitudes` become `base_octave`,
  `octave_count`, `amplitude_modifiers` and the base amplitude of
  `NormalNoise.createParity`, which keeps 26.2's normalisation;
- block states: `{Name, Properties}` become `{id, properties}`, or the id;
- configured carvers move to `carver/` with `config` unwrapped and the cave
  carvers' hard-coded count, thickness and room scale written out;
- biome spawners and spawn probability become 26.3's gameplay attributes;
- structure spawn overrides and the dimension type's bed rule.

Density functions, noise settings and features follow in their own
changes. serde_json gains `float_roundtrip` so the numbers the upgrade
writes back are the ones it read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 14:57:19 -05:00
Lyle ColeandClaude Opus 5.5 c8f484e040 Surface biomes: keep each quart cell's corner jitter and biomes
The surface stage's per-chunk cell cache only proved cells whose eight
quart corners hold one biome; a block in any other cell ran the full
eight-corner zoom mix and a stored lookup again. Now a mixed cell keeps
its corners' jitter (BiomeZoom::corner_jitter, one mix per cell) and
their eight biomes, so each block of the cell only redoes the distance
comparison (BiomeZoom::select_corner, same arithmetic and tie order); the
cell of the previous lookup is kept too, as columns walk down in y. A
test checks the split zoom against quart_at_block.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 14:57:16 -05:00
ThatCakeIsAPieandClaude Opus 5.5 d4a1ebaa33 Surface rules: compare biome ids, not names
Every solid block of every column asks the rule tree's biome conditions
for its biome. Each one cloned and dropped the biome's Arc<str> (an atomic
count all generator threads share) and looked its name up in a string set.
Queries that number their biomes (the generator's) now answer with the
index, and biome conditions keep a bit per index; others compare names as
before. Same answers: the generator's name -> id map is exact.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 14:57:16 -05:00
damnurmumandCodex 2ae5640704 Preserve styled item names and component shadow colors
Keep the original custom-name component as the sole stored value, deriving plain text for gameplay and rendering its styles in tooltips, held labels, and item links. Honor shadow_color in parsed text and HUD glyph passes. Extend the Java/Rust tooltip parity fixture with styled names; its fixture format builds on PR #1702 by RVZO6.

Co-Authored-By: Codex <[email protected]>
2026-10-28 22:31:12 +03:00
Kacpherek 2f95ce431c Follow the furnace code to furnace.rs on main; answer Fox.getBreedOffspring 2026-10-28 20:15:39 +01:00
Kacpherek 0536ebbe98 Merge remote-tracking branch 'origin/main' into tools/port-ledger 2026-10-28 20:11:46 +01:00
Kacpherek 59538c7dc1 Map the remaining vanilla methods: commands, network, packs, advancements and the last ten 2026-10-28 20:05:02 +01:00
Shreyas 2ac85c50eb lan: register default size 1 for AbstractCubeMob metadata 2026-10-29 00:11:11 +05:30
Kacpherek 2c10febff1 issue: read registry names, so a mooshroom report finds MushroomCow 2026-10-28 18:27:10 +01:00
Kacpherek a32e0ac4ec Add a vanilla-parity skill: start parity fixes from the port ledger 2026-10-28 18:09:19 +01:00
Kacpherek fd8f1a02a1 Map client screens, toasts, recipe book and world screens 2026-10-28 17:43:08 +01:00
Kacpherek a1cf544de7 map-check: accept full Class#method keys 2026-10-28 17:29:51 +01:00
Kacpherek 8d8737a266 Map client rendering, particles, sounds and resources 2026-10-28 17:29:16 +01:00
Kacpherek c045245e8e Map client packet handling, entity renderers and models, block renderers
Also let PORT_LEDGER_NO_MAP build without the verdict map, to measure the
automatic matches on their own.
2026-10-28 16:54:18 +01:00
Kacpherek 91358d8088 Map the rest of the game logic: classes with no Rust trace, then method batches 2026-10-28 16:26:00 +01:00
Kacpherek 969749da3d Map 13 game-logic batches and add map-check
map-check checks verdict-map files against the last build without
rebuilding, so several mappers can check their own rows at once.
2026-10-28 14:42:02 +01:00
Kacpherek 5a8b9687e5 Document class homes, structural matches and the verdict map 2026-10-28 13:53:58 +01:00
Kacpherek 0f7036f9b1 Map the first three batches: animals, inventory screens, world generation 2026-10-28 13:53:58 +01:00
Kacpherek 12c503e154 Port ledger: class homes, structural matches and the verdict map
Give every vanilla class its Rust home files, weighed from all its matches.
In those files, match a method to the fn that touches the same fields and
reaches the ports of the same callees. Read tools/port_map/*.tsv, where a
person or agent records a verdict for what nothing else finds (port, inline,
missing, skip with a reason), and list the next unanswered batch with todo.
Count field-only constructors as trivial and fold initializer lambdas into
<clinit> and <init>.
2026-10-28 13:53:58 +01:00
Kacpherek 2dd963a539 Document the port ledger's new matching, gaps and commands 2026-10-28 13:16:02 +01:00
Kacpherek cd42938b88 Port ledger: bytecode calls, wider matching, drift, issue and check
Read the game jar's bytecode for exact call targets, constants and ids, and
resolve Rust calls through the receiver's type. Match more methods: same-named
fns in an impl or file named for the class (the impl type must fit the class),
and callees of known pairs linked through the call graph. Leave trivial methods
out of coverage.

New gap kind drift: a port that never names a sound, particle, item, block,
effect or game event its vanilla method uses, or lacks one of its rare numbers.
Seam gaps on the old in-frame path sort last; maths and geometry callees no
longer make seam or callee gaps.

New commands: issue (the classes, Rust code and gaps a bug report points at),
check (what a branch touches, gaps it opens and closes against its base), diff,
and a searchable offline report.html.
2026-10-28 13:16:01 +01:00
SenjinandClaude Opus 5.5 9c18b4e524 HDR: the log says where the HDR screenshot went
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 13:09:30 +01:00
Shreyas 43f2497f1f Sulfur cubes: synchronize size metadata and adult egg spawns
Include sulfur cubes in AbstractCubeMob size metadata serialization and
remote data handling so adult cubes retain their size across the network.
Adult sulfur cubes spawned from spawn eggs now correctly render and act
as adults rather than defaulting to size 1 babies.

Vanilla reference: AbstractCubeMob.ID_SIZE, SulfurCube.setSpawnSize.

Fixes #3151
2026-10-28 17:13:45 +05:30
SenjinandClaude Opus 5.5 c7b02f8568 HDR: screenshots get an HDR10 copy, as a PNG tagged BT.2020 with PQ
F2 kept only the SDR frame. With HDR on it now also writes `…-hdr.png` beside
vanilla's screenshot: the HDR pass drawn once more into a 10-bit PQ target of its
own (so scRGB swapchains get one too), read back and saved as a 16-bit PNG with
the cICP chunk of PNG's third edition (BT.2020, PQ, full range) and cLLI (peak,
paper white). Each 10-bit value keeps its top bits below it, so 0 stays 0 and
1023 becomes 65535. Vanilla's screenshot is written as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 11:54:07 +01:00
Kacpherek ef304f30c9 Document the port ledger 2026-10-28 11:23:50 +01:00
Kacpherek e36fd24008 Add the port ledger: vanilla methods next to the Rust functions that port them
tools/port_ledger.py indexes the decompiled sources and the Rust tree into .local/port-ledger/ledger.json and answers where/what/class/coverage queries both ways, with the gaps where a port isn't wired like vanilla (seam, client, class, callee, stale).
2026-10-28 11:23:50 +01:00
NetuosoDEVandOpenAI Codex 818a2ec52a Align the carried block between the enderman hands
Cancel item-model centering in the vanilla carried-block pose. Add a regression test using point coordinates captured from Minecraft 26.3 CarriedBlockLayer.submit, including a transformed entity root.

Implemented by OpenAI Codex on behalf of NetuosoDEV. NetuosoDEV tested the updated Linux binary in game and confirmed the fix works.

Co-Authored-By: OpenAI Codex <[email protected]>
2026-10-28 12:04:11 +02:00
NetuosoDEVandOpenAI Codex f852985693 Fix enderman carried block textures and item tints
Render the carried block through the inventory item model pipeline so every quad uses its proper texture and tint source. Remove the single-sprite cube renderer and let the item pipeline center the model.

Implemented by OpenAI Codex on behalf of NetuosoDEV. NetuosoDEV confirmed the fix works in game.

Co-Authored-By: OpenAI Codex <[email protected]>
2026-10-28 11:40:04 +02:00
SenjinandClaude Opus 5.5 41d3890a3c Revert "HDR: bright lifts from darker pixels"
Only a soul lantern needed it, and it lifted less for its light level, not for
its texture: that is better fixed where the lift is worked out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 10:14:15 +01:00
SenjinandClaude Opus 5.5 2f13cb3ac6 HDR: bright lifts from darker pixels
The bright tier's window goes to 0.04-0.28, from a round in the HDR gallery: a soul
lantern's glass (light level 10) now lifts, and the level-15 bright blocks still look
right.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 09:34:28 +01:00
SenjinandClaude Opus 5.5 f52e94cfb9 docs: glowing particles shine in HDR now; translucent blocks don't yet
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 06:41:34 +01:00
SenjinandClaude Opus 5.5 113d694a87 HDR: very bright lifts over bright's window, a step above bright
Very bright's window (0.88 to 0.94) was tuned on the sun alone: on a block
only the hottest pixels reached it, and they blew out while the rest
stayed below bright. It now lifts over bright's window with the whole
headroom; the sun keeps its yellow corona near the horizon.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 05:22:02 +01:00
Ludovic MarieandClaude Opus 5.5 f5f5532c19 Merge main into fix/goat-horns
Kept the goat horn use next to main's bundle use in use_item.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 22:41:36 +01:00
Kacpherek cb5743dcc8 Format
cargo fmt.
2026-10-27 22:36:44 +01:00
Kacpherek eea99bb586 Fix clippy
Return the arrow hit result directly.
2026-10-27 22:36:18 +01:00
Kacpherek 1944dd45e4 Fix display light borrow and format
display_light took &self while text displays were borrowed mutably; it now takes the world. Also rustfmt.
2026-10-27 22:35:25 +01:00
Kacpherek 295871fcab Turn dirt to mud with a water bottle
Right-clicking a water bottle on mud-convertible blocks started a drink, only dispensers swapped. Vanilla (PotionItem.useOn) pours it out onto any side but the underside and sets mud.
2026-10-27 22:26:57 +01:00
Kacpherek ae43424882 Place lily pads and frogspawn on the water aimed at
The aim ray skips water, so these items could not be placed on the surface. Vanilla (PlaceOnWaterBlockItem.use) uses a source-only fluid ray and places on the position above the block it meets.
2026-10-27 22:26:13 +01:00
Ludovic MarieandClaude Opus 5.5 e1d825312f Read the flat world's horizon from WorldGen's preset
main's dark disc and void fog read WorldGen.flat, which is now the preset
(seen by sirrayi's review).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 22:25:52 +01:00
Ludovic MarieandClaude Opus 5.5 5ea61ed3d8 Merge main into world-types
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 22:25:45 +01:00
Kacpherek b910cdd257 Draw block and item display entities on clients
A client only had an arm for text displays. DisplayRenderer draws a block display's model or an item display's item under the same billboard and transformation, with the brightness override or the light at the entity.
2026-10-27 22:25:37 +01:00
Kacpherek 3934833369 Send text, block and item display data to clients
Summoned displays reached clients as bare entities, so a text display showed nothing. Vanilla syncs Display's entries 8 to 22 and each type's own (text 23 to 27, block state 23, item and context 23 and 24) from the saved compound.
2026-10-27 22:25:37 +01:00
Kacpherek d5ae9945fa Honour can_break and can_place_on in adventure mode
Adventure players could never place or break. Vanilla (Player.blockActionRestricted, ItemStack.useOn) allows it when the held item's can_break matches the block, or can_place_on matches the clicked one.
2026-10-27 22:25:25 +01:00
Ludovic MarieandClaude Opus 5.5 231b309634 Name the forced terrain ring where the protos are kept
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 22:24:48 +01:00
Kacpherek c20247d708 Hurt mobs walking on magma blocks
Only the player took hot floor damage. Vanilla (MagmaBlock.stepOn) deals 1 hot_floor damage to any living entity on the block that is not sneaking.
2026-10-27 22:22:51 +01:00
Kacpherek 08947cd922 Burn mobs standing in a lit campfire
Only the player took campfire damage. Vanilla (CampfireBlock.entityInside) hurts any living entity in a lit campfire for 1, or 2 for a soul campfire.
2026-10-27 22:22:36 +01:00
Kacpherek 0e18c68b4d Hurt mobs with the lightning_bolt damage type
A strike hurt mobs as generic damage, which bypasses armour and wolf armour and loses the is_lightning loot condition (a struck turtle dropped no bowl). Vanilla (Entity.thunderHit) uses lightning_bolt.
2026-10-27 22:21:37 +01:00
Kacpherek 621473f60e Send the ominous item spawner to guests and draw its floating item
The spawner existed only on the server, so a client never saw the item grow and turn. Vanilla tracks it with DATA_ITEM; the client draws OminousItemSpawnerRenderer and runs tickClient's particles.
2026-10-27 22:21:29 +01:00
Kacpherek 1b0b0a8149 Hurt crowded mobs with cramming damage
The cramming roll was drawn but nothing hurt the mob. Vanilla (LivingEntity.pushEntities) deals 6 cramming damage, 1 in 4 ticks, above max_entity_cramming - 1 pushers who are not riding.
2026-10-27 22:21:18 +01:00
Kacpherek 2b2dc1929f Show tipped and spectral arrows to guests and clients
A server sent every arrow as a plain one. Vanilla sends a spectral arrow as its own type and a tipped arrow's ID_EFFECT_COLOR, and the client draws arrow_spectral.png and sheds the effect swirls (Arrow.tick) and sparkles (SpectralArrow.tick).
2026-10-27 22:20:33 +01:00
Kacpherek ac22c4db04 Apply tipped and spectral arrow effects to the mobs they hit
Arrows built from a bow or crossbow carried no effect and mobs never got one. Vanilla (Arrow, SpectralArrow doPostHurtEffects) applies the pickup item's potion contents at its duration scale, or Glowing for 200 ticks.
2026-10-27 22:19:06 +01:00
Kacpherek e204d3c028 Drink a potion's custom effects at its duration scale
A stack's potion_contents lost custom_effects and custom_color on load, and drinking used scale 1. Vanilla (PotionContents.onConsume) applies the potion and custom effects at potion_duration_scale.
2026-10-27 22:18:00 +01:00
Ludovic MarieandClaude Opus 5.5 3246732087 Read the inline instrument through horizon_client_core::scoreboard
#2215 moved items.rs into horizon-items, where scoreboard is not in the
crate root.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 19:13:32 +01:00
Ludovic MarieandClaude Opus 5.5 c215a48c91 Merge main into fix/goat-horns
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 19:11:21 +01:00
Ludovic MarieandClaude Opus 5.5 6aabf3f618 Merge main into fix/goat-horns
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 18:11:43 +01:00
Senjin fbab7d29a5 Merge remote-tracking branch 'origin/main' into hdr-tiers
# Conflicts:
#	crates/horizon-client/src/entity.wgsl
2026-10-27 17:57:13 +01:00
levzzz b901415c80 Merge remote-tracking branch 'upstream/main' into fix/forceload-rings 2026-10-27 20:32:05 +05:00
levzzzandminimax-m3.1-flash da877fe1db Give a forced chunk vanilla's rings
A `/forceload`ed chunk holds a FORCED ticket at level 31, and vanilla's
level rises one per ring, so the chunk itself and the two rings around it
are level chunks with their light, the third ring has its features and the
fourth only its terrain. Horizon took the forced chunk's reach from the
caller's margin instead, so only the chunk itself ever finished and its
neighbours stayed proto chunks.

The reach now follows the ticket levels: the full ring is two chunks out,
the features ring three and the terrain ring four, and the protos of the
terrain ring are kept so the features ring can be decorated from them. A
decorated proto chunk is saved as `minecraft:initialize_light`, the status
vanilla gives a chunk that has its features but no light.

Co-Authored-By: minimax-m3.1-flash (Claude Code) <[email protected]>
2026-10-27 20:18:42 +05:00
sirrayiandDevin 6143e258ab Release notes: a Contributors heading and a rule before the disclaimer
The "Thanks to ..." line read as part of the section before it (often Known issues), on GitHub and on playhorizon.dev/releases. It now has its own heading, and a horizontal rule sets the disclaimer apart. Fixes #2314.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-10-27 14:55:35 +00:00
levzzzandminimax-m3.1-flash f9ca0a76cf The death message names the cause's item when it has a custom name
`DamageSource.getLocalizedDeathMessage` uses the `<id>.item` message when
the cause holds an item with a custom name, with the item's name as a
third argument: "Steve was shot by Zombie using My Sword". Horizon always
used the two-argument message, so the item was never named.

The mob's main hand item now keeps its custom name, and the death message
picks the message and its arguments from it.

Fixes #2802

Co-Authored-By: minimax-m3.1-flash (Claude Code) <[email protected]>
2026-10-27 18:38:37 +05:00
levzzzandminimax-m3.1-flash 1232745064 Keep a traveller that waits for an End gateway's exit
The traveller was dropped from the queue before the exit was resolved, so a
failure to resolve it lost the entity for good. The traveller now waits and
the failure is retried, with the reason in the log.

Co-Authored-By: minimax-m3.1-flash (Claude Code) <[email protected]>
2026-10-27 18:34:07 +05:00
levzzzandminimax-m3.1-flash 3382b666ce Add the audit that drives a cow and a stack through an End gateway
The script plays the End in a scratch home: it places a gateway beside the
spawn platform, puts a cow and a seven-diamond stack in it, and checks that
both leave it and land at the gateway's exit with their data, in the
server-thread and the in-frame singleplayer.

Co-Authored-By: minimax-m3.1-flash (Claude Code) <[email protected]>
2026-10-27 18:27:43 +05:00
Ludovic Marie 36ba5c65a6 Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	crates/horizon-client/src/item_tooltip.rs
2026-10-27 13:44:46 +01:00
levzzzandminimax-m3.1-flash 92c073de61 Merge upstream/main into fix/end-gateway-entities
Upstream now keeps a gateway's exit in the gateway's own block entity
(TheEndGatewayBlockEntity.setExitPosition), so the player travels to the
exit the gateway was given (#1517). The entity travel stays: the mobs and
the dropped items go through the same gateway, and the exit the first
traveller found is reused, so the player and the entities land in the same
place and only one island is built for a gateway.

Co-Authored-By: minimax-m3.1-flash (Claude Code) <[email protected]>
2026-10-27 17:27:46 +05:00
levzzzandminimax-m3.1-flash 139de824aa Re-run the checks after the audit script fix
The pull request's last push did not start a run; this empty commit
starts one on the same tree.

Co-Authored-By: minimax-m3.1-flash (Claude Code) <[email protected]>
2026-10-27 17:10:44 +05:00
Senjin 523dd491c4 Merge remote-tracking branch 'origin/main' into hdr-tiers
# Conflicts:
#	crates/horizon-client/src/entity.wgsl
#	crates/horizon-client/src/gfx.rs
2026-10-27 13:07:04 +01:00
Ludovic MarieandClaude Opus 5.5 ed01a93df6 Merge main into fix/world-types
main's Superflat Customize screen (#2214) still set the removed WorldOptions.flat: it now picks WorldPreset::Flat,
and the agent's customize-flat state reads the preset. structure_mobs.rs's test passes the new preset argument
(minecraft:normal) to VanillaTerrain::for_dimension.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 12:39:11 +01:00
levzzzandminimax-m3.1-flash 1a56e74324 Fix the f-string in the end cargo audit script
The braces were one too many, so the file did not parse and the Python
tests failed on it. The command it builds is the same now: the item
stack {Item:{id:"minecraft:diamond",count:3}}.

Co-Authored-By: minimax-m3.1-flash (Claude Code) <[email protected]>
2026-10-27 16:35:44 +05:00
Claude Codeandminimax-m3.1-flash 25b84dfc2e Format the world preset test
rustfmt keeps the registry read on one line.

Co-Authored-By: minimax-m3.1-flash (Claude Code) <[email protected]>
2026-10-27 16:11:14 +05:00
levzzzandminimax-m3.1-flash a2098c2ffa Let mobs and dropped items through End gateways
Only the player was checked for End gateways, so a cow or a dropped
stack standing in one stayed there for good. The entities now go
through a gateway the way the player does: the block their box swept
through takes them in (unless the gateway is cooling down, as
EndGatewayBlock.entityInside does), they travel on the next tick
(Entity.handlePortal, with the End gateway's transition time of 0) and
land where the gateway leads once its chunks have loaded, keeping their
data and counts.

Co-Authored-By: minimax-m3.1-flash (Claude Code) <[email protected]>
2026-10-27 16:11:14 +05:00
Claude Codeandminimax-m3.1-flash d98dc8edc9 Read the test registry without the explicit deref
clippy's explicit_auto_deref asks for the LazyLock itself, which
derefs to the registry the generator data keeps.

Co-Authored-By: minimax-m3.1-flash (Claude Code) <[email protected]>
2026-10-27 16:11:14 +05:00
Claude Codeandminimax-m3.1-flash bf05176692 Add the amplified, large-biome and single-biome world types
The create screen only offered Default and Superflat, so the amplified
world type of #1873 could not be chosen at all, and the generator
always built the overworld's noise settings.

The world-type button now cycles through the presets vanilla's
WorldPresetTags.NORMAL tag holds (normal, flat, large_biomes, amplified,
single_biome_surface), the chosen preset is written into the new world's
world_gen_settings.dat with the generator
worldgen/world_preset/<preset>.json has, and the generator is built from
that preset, so an amplified world gets the amplified noise settings.
A world opened again reads its preset back from its generator.

Co-Authored-By: minimax-m3.1-flash (Claude Code) <[email protected]>
2026-10-27 16:11:14 +05:00
FusselTVandClaude Opus 5.5 8401cde519 Dedicated server: nothing kept around the spawn while nobody is on
While nobody was online, the dedicated server behaved as if a player
stood at the world spawn: at startup it streamed a view-distance area
there and placed a stand-in player, and afterwards it kept that area
loaded, generated and ticked. Vanilla only loads the chunks its spawn
spiral tests (MinecraftServer.setInitialSpawn: getChunk(FULL), whose
3x3 is decorated in one generation task), has no spawn ticket, and finds
a player's spawn when one joins. In a pre-generated world the startup
area decorated in another order made ore blobs and a mineshaft start's
saved flags near spawn differ from vanilla's.

A streaming radius below 0 now means no area around the centre. The
dedicated server only finds the world spawn, loading each tested chunk
as an extra area of radius -1 ranked as one FULL task (x-outer,
z-inner), and keeps the radius at -1 while no guest is online.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 09:36:12 +01:00
SenjinandClaude Opus 5.5 58f2ea700e HDR: light sources shine by the kind of light, not its level
Light level says how far a source lights its surroundings, not how bright
it looks: a candle's flame is as bright as a torch's. Light sources now
get a tier (mesher::hdr_tier): very bright (the sun), bright (glowstone,
campfires, the soul fires), incandescent (flames, lava), low (redstone
torch, magma, a candle's wick) or none (glow lichen). Unlisted ones go by
their level. The tier rides in the emission bits as the level did, and
each has its own share of the headroom and its own lift window
(gfx/hdr.rs TIERS), tuned by eye on an HDR1000 OLED.

Flames, lava drops and obsidian tears now shine too: their tier rides in
the particle vertex's overlay bits, and with HDR on a second draw of the
entities writes only the frame's alpha for them, so their colour still
blends as before.

HORIZON_HDR_DEBUG=1 now greys what isn't lifted and tints what is, so a
lift shows on purple and red light too.

Part of #1441.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 09:07:23 +01:00
Senjin 9da81f9293 Merge remote-tracking branch 'origin/main' into hdr-tiers 2026-10-27 09:01:54 +01:00
levzzz a3489d33b4 Merge remote-tracking branch 'upstream/main' into fix/root-vehicle-restore 2026-10-27 10:53:42 +05:00
Ludovic Marie 9bb3fc077e Merge #2570 2026-10-27 06:43:30 +01:00
Ludovic MarieandClaude Opus 5.5 2aa9056259 Structure mobs test: pass the world preset for_dimension now takes
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 06:43:30 +01:00
Ludovic Marie 8117e2767f Merge main 2026-10-27 06:43:23 +01:00
Ludovic MarieandClaude Opus 5.5 bc5ec6fb46 Structure mobs test: pass the world preset #2570 added to for_dimension
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 06:42:39 +01:00
Ludovic Marie e5ebeddb90 Merge #2585
# Conflicts:
#	crates/horizon-client/src/entity_nbt.rs
2026-10-27 06:42:33 +01:00
Ludovic Marie d0b42fb88e Merge #2570 2026-10-27 06:42:19 +01:00
Ludovic Marie bca77d1ac4 Merge origin/main 2026-10-27 06:42:18 +01:00
Ludovic MarieandClaude Opus 5.5 815c09b1f8 Merge #2214 (world presets in the create-world screen)
The superflat screen and the agent's state read the world preset that
#2214 adds instead of the old flat flag; drop a stray parenthesis in
the horizon-prepare hint.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 06:40:03 +01:00
Claude Codeandminimax-m3.1-flash 0104eeaf33 Format the world preset test
rustfmt keeps the registry read on one line.

Co-Authored-By: minimax-m3.1-flash (Claude Code) <[email protected]>
2026-10-27 05:06:02 +05:00
levzzz 9c16d40db1 Merge remote-tracking branch 'upstream/main' into fix/root-vehicle-restore 2026-10-27 04:54:43 +05:00
Claude Codeandminimax-m3.1-flash 729a224eef Read the test registry without the explicit deref
clippy's explicit_auto_deref asks for the LazyLock itself, which
derefs to the registry the generator data keeps.

Co-Authored-By: minimax-m3.1-flash (Claude Code) <[email protected]>
2026-10-27 04:52:31 +05:00
Claude Code 730184c64f Riding a horse survives a save and a reopen
The player's file now names the vehicle it rides, the way vanilla's
ServerPlayer.saveParentVehicle does, and the ride comes back on the next
login in both single player's modes.

- The player compound holds a "RootVehicle" compound whose "Attach" is the
  UUID of the vehicle at the root of the rider chain (Entity.getRootVehicle).
  Horizon keeps the vehicle in the world, so the file names it instead of
  holding a second copy of it: the horse and its equipment stay in the
  chunk's entity file, and nothing is duplicated.
- The single player's own player writes the vehicle it rides, and a server's
  guests write theirs; on the next login the vehicle is looked up by its
  UUID among the entities in the world, and the player rides it again.
- A guest whose file names a vehicle gets back on it once the vehicle is
  loaded, as ServerPlayer.loadAndSpawnParentVehicle does.

Co-Authored-By: minimax-m3.1-flash (Claude Code) <[email protected]>
2026-10-27 04:40:43 +05:00
FusselTVandClaude Opus 5.5 22054eee90 Worldgen: chunk generation spawns its animals as vanilla, ticking or not
NaturalSpawner.spawnMobsForChunkGeneration runs in the generation
pipeline (spawnOriginalMobs), with the WorldGenRegion's random for the
spawn rules and finalizeSpawn. Horizon ran it from the game tick for
chunks that were fresh and lit, so:

- a world generated with ticks frozen, as a seed generator does, got no
  animals at all, and a chunk saved before a tick saw it lost them;
- the rules and finalizeSpawn drew from other randoms, and the reduced
  spawning::finalize gave no variants, babies or group data;
- the spawn list came from the biome's noise cell, not the zoomed biome
  (fullResolutionBiomes) vanilla reads;
- members of a pack were kept apart, though a WorldGenRegion has no
  entities in the way.

A chunk now gets its animals as soon as it is lit, whatever the tick
state. The positions come from the same selection, the rules and the
finalize from the chunk's region random, and each mob is made with its
constructor's state, finalized like a structure mob
(Reason::ChunkGeneration, group data per pack) and loaded from the NBT
generation would save. The natural spawn oracle's generation mode sees
no entities, as a WorldGenRegion.

Goats and frogs keep their long jump and ram cooldowns under vanilla's
memory names (long_jump_cooling_down, ram_cooldown_ticks), and rabbits
save the attack damage attribute Rabbit.setVariant makes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 00:37:18 +01:00
Claude Codeandminimax-m3.1-flash 52f0e38d41 Add the amplified, large-biome and single-biome world types
The create screen only offered Default and Superflat, so the amplified
world type of #1873 could not be chosen at all, and the generator
always built the overworld's noise settings.

The world-type button now cycles through the presets vanilla's
WorldPresetTags.NORMAL tag holds (normal, flat, large_biomes, amplified,
single_biome_surface), the chosen preset is written into the new world's
world_gen_settings.dat with the generator
worldgen/world_preset/<preset>.json has, and the generator is built from
that preset, so an amplified world gets the amplified noise settings.
A world opened again reads its preset back from its generator.

Co-Authored-By: minimax-m3.1-flash (Claude Code) <[email protected]>
2026-10-27 04:20:01 +05:00
FusselTVandClaude Opus 5.5 1a80673d50 Worldgen: structure mobs save the fields vanilla's chunk keeps
ProtoChunk.addEntity saves a structure's entity as soon as it is placed,
and the chunk loads it again when it becomes full, so vanilla keeps what
each entity's own save writes. Horizon kept the template's NBT with its
model on top, and its model left out some fields:

- the keys in vanilla's templates that no entity reads (food_level,
  lastRestock, CatType, OwnerUUID, ...) are dropped;
- villagers save VillagerDataFinalized and their age (AgeableMob writes
  Age, ForcedAge and AgeLocked whenever canBeABaby, not only for
  creatures; never for a frog, a parrot or a zombie nautilus), and the
  age is read back for the same mobs (a baby villager or hoglin no
  longer grows up on load);
- iron golems and the other neutral mobs save anger_end_time;
- zombies, drowned and piglins save the movement speed attribute that
  their setBaby creates on load;
- a drowned with a nautilus shell keeps drop_chances (offhand 2.0), and
  saved drop chances are read back;
- the rider of a new chicken jockey is saved as it was when the chicken
  was added, before its equipment and attributes, as vanilla's chunk
  saves the chicken with its passenger at that point.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 23:12:29 +01:00
Kacpherek 75267d2fc6 Read inline goat horn instruments as well as registry ids 2026-10-26 21:43:33 +01:00
Kacpherek 9b88df32d3 Make goat horns play their sound and show the horn pose
A goat horn did nothing when used. It now plays its instrument at the
player, is held up for the instrument's duration, goes on cooldown, posts
the instrument_play game event and counts as used. Other players hear it,
see the arm raised to the head, and the tooltip names the call.
2026-10-26 19:54:15 +01:00
821 changed files with 66462 additions and 21892 deletions

No files matched your search

+12
View File
@@ -4,6 +4,18 @@
<!-- What this changes, and why. Link the issue it fixes ("Fixes #123"). -->
## Kind
<!-- Tick one: it sets the pull request's label (CONTRIBUTING.md "Pull requests"). -->
- [ ] parity: Horizon now does what vanilla 26.3 does
- [ ] bug: a crash or a breakage
- [ ] perf: faster, or less memory
- [ ] feature: something new for players (listed under New in the release notes)
- [ ] extra: Horizon-only, off by default
- [ ] tooling: tools, CI, tests, harnesses
- [ ] docs
## Vanilla reference
<!-- The vanilla classes and methods this follows (tools/rea_vanilla.py), and the harness that checks it.
+4 -5
View File
@@ -51,7 +51,7 @@ jobs:
if: steps.rust.outputs.required != 'false'
run: |
sudo apt-get update && sudo apt-get install -y --no-install-recommends libasound2-dev libudev-dev
rustup toolchain install stable --profile minimal --component rustfmt --component clippy --target wasm32-unknown-unknown
rustup toolchain install stable --profile minimal --component rustfmt --component clippy
# Dependencies and the workspace's own build, saved from main's runs (pull requests read main's cache).
- uses: Swatinem/rust-cache@v2
if: steps.rust.outputs.required != 'false'
@@ -62,7 +62,6 @@ jobs:
if: steps.rust.outputs.required != 'false'
run: |
cargo +stable fmt --all -- --check
# With the game's code mods (on in every release build, off by default).
cargo +stable clippy --workspace --all-targets -- -D warnings
# The server build (released as horizon-engine): the game without sound or controllers.
cargo +stable clippy -p horizon-client --all-targets --no-default-features -- -D warnings
@@ -71,11 +70,11 @@ jobs:
- name: Test Rust core and voxel kernel correctness
if: steps.rust.outputs.required != 'false'
run: |
cargo +stable test --workspace --lib --bins --tests --features horizon-mods/pack
cargo +stable test --workspace --lib --bins --tests
# The full content-root tests (#[ignore]d: minutes each on a laptop). The same build as above; they need the
# prepared vanilla data, so without it they pass at once.
cargo +stable test --workspace --lib --features horizon-mods/pack mod_content::tests:: -- --ignored
cargo +stable test --workspace --doc --features horizon-mods/pack
cargo +stable test --workspace --lib mod_content::tests:: -- --ignored
cargo +stable test --workspace --doc
# The launcher is its own workspace (launcher/Cargo.toml), so verify's cargo runs never build it. A pull request that
# changes it or a crate it builds is checked here, and so is every push to main: two pull requests can each pass
# alone and break it together (#2059 and the registry ratings did, 2026-10-26).
+76
View File
@@ -0,0 +1,76 @@
name: claim command
# `/claim` and `/unclaim` comments: anyone takes an issue before working on it, and a daily run releases the claims
# older than 5 days that no open pull request links (CONTRIBUTING.md "Claim before you start",
# tools/ci/claim_command.py).
#
# Why no pull request's code runs here, though the token can write:
# - `issue_comment` and `schedule` always run this file from main, whoever comments and wherever.
# - It checks out main's script and list only, never a pull request; it reads threads through the API.
# - The comment's text and author reach the script as env vars, never in a shell line. The token stays in the step
# and can only write issues (assignees, comments, reactions).
on:
issue_comment:
types: [created]
schedule:
- cron: "23 5 * * *"
workflow_dispatch:
permissions:
contents: read
jobs:
command:
# Every other comment skips here, before a runner starts. Pull requests are answered by the script.
if: >-
github.event_name == 'issue_comment' && github.event.comment.user.type != 'Bot' && (
startsWith(github.event.comment.body, '/claim') ||
startsWith(github.event.comment.body, '/unclaim') ||
startsWith(github.event.comment.body, '🤖 Agent: /claim') ||
startsWith(github.event.comment.body, '🤖 Agent: /unclaim'))
# One command per issue at a time, so two `/claim`s can't both find it free. On the job, not the workflow:
# the skipped runs of ordinary comments must not cancel a waiting one.
concurrency:
group: claim-${{ github.event.issue.number }}
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
issues: write
steps:
- uses: actions/checkout@v4
with:
ref: main
persist-credentials: false
sparse-checkout: |
.github/trusted-reviewers.txt
tools/ci/nightly_set.py
tools/ci/claim_command.py
sparse-checkout-cone-mode: false
- name: Run the command
env:
GH_TOKEN: ${{ github.token }}
BODY: ${{ github.event.comment.body }}
AUTHOR: ${{ github.event.comment.user.login }}
ISSUE: ${{ github.event.issue.number }}
COMMENT_ID: ${{ github.event.comment.id }}
REPO: ${{ github.repository }}
run: python3 tools/ci/claim_command.py command
release:
if: github.event_name != 'issue_comment' && github.repository == 'horizon-rust/horizon'
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
issues: write
steps:
- uses: actions/checkout@v4
with:
ref: main
persist-credentials: false
sparse-checkout: |
tools/ci/nightly_set.py
tools/ci/claim_command.py
sparse-checkout-cone-mode: false
- name: Release stale claims
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
run: python3 tools/ci/claim_command.py release
+3 -3
View File
@@ -233,9 +233,9 @@ jobs:
# before the Nightly-only switch keep (they don't read Nightlies).
gh release create nightly --prerelease --latest=false --target "$SHA" \
--title "Nightly $DATE · ${SHA:0:7}" --notes-file dist/nightly-notes.md \
"dist/horizon-linux-x86_64.tar.gz#Nightly game files: Linux (horizon-linux-x86_64.tar.gz)" \
"dist/horizon-windows-x64.zip#Nightly game files: Windows (horizon-windows-x64.zip)" \
"dist/horizon-macos-arm64.zip#Nightly game files: macOS (horizon-macos-arm64.zip)" \
"dist/horizon-linux-x86_64.tar.gz#Game files the launcher installs (Nightly): Linux (horizon-linux-x86_64.tar.gz)" \
"dist/horizon-windows-x64.zip#Game files the launcher installs (Nightly): Windows (horizon-windows-x64.zip)" \
"dist/horizon-macos-arm64.zip#Game files the launcher installs (Nightly): macOS (horizon-macos-arm64.zip)" \
"dist/horizon-server-linux-x86_64.tar.gz#Nightly dedicated server for Linux (horizon-server-linux-x86_64.tar.gz)" \
"dist/horizon-source.tar.gz#Source of this Nightly, commit ${SHA:0:7} (horizon-source.tar.gz; kept for good as the tag $SOURCE_TAG)" \
dist/SHA256SUMS "${signature[@]}" dist/smoke-test.json
+41
View File
@@ -0,0 +1,41 @@
name: overlap note
# One comment on a pull request naming the other open pull requests that close the same issue or change the same
# functions, edited on every push (tools/ci/overlap_note.py, issue #3859).
#
# Why no pull request's code runs here, though `pull_request_target` gives a token that can write:
# - `pull_request_target` runs this file and the script from main, never the pull request's copy.
# - The checkout is main's (`ref: main`), blobless, with the script alone on disk. The pull requests' heads are fetched
# as git objects and only diffed, never checked out; git runs with hooks, fsmonitor, external diff and textconv off.
# - The rest comes from the API. The token writes the comment only.
on:
pull_request_target:
types: [opened, reopened, synchronize, ready_for_review]
permissions:
contents: read
jobs:
note:
if: github.event.pull_request.base.ref == 'main'
# A newer push replaces the note being computed.
concurrency:
group: overlap-note-${{ github.event.pull_request.number }}
cancel-in-progress: true
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
filter: blob:none
persist-credentials: false
sparse-checkout: |
tools/ci/overlap_note.py
sparse-checkout-cone-mode: false
- name: Note
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
run: python3 tools/ci/overlap_note.py event
+36
View File
@@ -0,0 +1,36 @@
name: pr labels
# A pull request's kind label (the box ticked in the template) and area labels (the paths it changes):
# tools/ci/pr_labels.py, CONTRIBUTING.md "Pull requests".
#
# Why no pull request's code runs here, though `pull_request_target` gives a token that can write to fork PRs:
# - `pull_request_target` runs this file and the script from main, never the pull request's copy.
# - It checks out main's script only (`ref: main`), never the pull request's head or merge commit.
# - The script reads the event file (the description is data in JSON, never in a shell line) and the API's list of
# changed file names; it runs, builds and imports nothing of theirs. The token writes labels only.
on:
pull_request_target:
types: [opened, reopened, synchronize, edited, ready_for_review]
permissions:
contents: read
jobs:
label:
# Title-only edits change nothing: skip them before a runner starts.
if: github.event.action != 'edited' || github.event.changes.body != null
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
ref: main
persist-credentials: false
sparse-checkout: |
tools/ci/pr_labels.py
sparse-checkout-cone-mode: false
- name: Label
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
run: python3 tools/ci/pr_labels.py event
+4 -5
View File
@@ -30,6 +30,8 @@ Feature → files → harness for the most-changed areas: [docs/architecture.md]
change), none for a fix. Agents never add `release-now`: the maintainer decides it. Merges ship in batches of 5, or after
6 hours ([docs/release-flow.md](docs/release-flow.md)).
- Contributors first: `gh pr list --state open --search <area>` before you start; never duplicate theirs.
- **Claim before you start**: comment `/claim` on the issue (no issue yet: open one, then claim it). An assigned
issue is taken: pick another. `/unclaim` when you stop; a claim with no open PR linking it is released after 5 days.
## Crates
@@ -51,7 +53,7 @@ Game workspace (root `Cargo.toml`); `launcher/` and `crates/horizon-telemetry-se
| `horizon-server` | `horizon-server`: `server.toml`, CLI, supervisor of the headless game ([docs/hosting.md](docs/hosting.md)) |
| `horizon-server-files` | `server.properties`, eula, ops/whitelist/bans, usercache |
| `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-mods`, `cargo-horizon-mod` | Content mods (`.hmod`: manifest, content fence, no code), the registry index and `.hpack`, and `cargo horizon-mod` (`new`, `build`, `run`, `check`, `registry`) ([docs/mods.md](docs/mods.md)). Code mods are native, built by the launcher ([docs/native-mods.md](docs/native-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 |
@@ -71,7 +73,7 @@ reads `README.md`, `launcher/links.json`, `docs/api/`, `roadmap/roadmap.json` an
python3 tools/pr_ready.py # the self-check: fmt, clippy -D warnings, touched crates' tests, harnesses; paste its block in the PR
python3 tools/pr_ready.py --quick # same without harnesses
cargo test -p horizon-client --lib --bins --tests # skips the 104 examples (pr_ready does this); `--doc` separately
cargo test -p horizon-client --features horizon-client/mods --lib mod_content::tests:: -- --ignored # the 5 slow content-root tests, #[ignore]d; pr_ready runs them when mod content, assets, blocks or items change
cargo test -p horizon-client --lib mod_content::tests:: -- --ignored # the 5 slow content-root tests, #[ignore]d; pr_ready runs them when mod content, assets, blocks or items change
cargo build --profile fast -p horizon-client # optimized, quick to link: use it to play or run lan_e2e
python3 tools/parity.py --changed origin/main # the harnesses your branch can affect (CI's parity job)
python3 tools/parity.py --changed-files paths.txt --list # which harnesses cover these files, without running them
@@ -91,9 +93,6 @@ python3 tools/agent_control_e2e.py # horizon-ctl / MCP end to end
- What a change reruns (of 329 harnesses, measured 2026-10-23): a file of the game binary (`game.rs`, `game/`)
~25, a file of the client lib ~103, of `horizon-world` ~103–109, of `horizon-core` ~119. Plan for it.
- Rust integration tests: `crates/horizon-client/tests/` (`lan_bot.rs`, `generation_saves.rs`, `streaming_meshes.rs`).
- **macOS:** `cargo build/test --workspace` may fail to link the two wasm guest cdylibs (undefined
`horizon:mods/events` symbols) until #1446 lands: add `--exclude coords-hud --exclude predator-missile --exclude horizon-mods-test-guest --exclude horizon-mods-test-ui-guest`.
Their real check is `cargo test -p horizon-mods` (builds them for `wasm32-unknown-unknown`).
- Linux needs `libasound2-dev libudev-dev`; `--no-default-features` drops audio and controllers (the server build).
- Run and drive the game (starts the `horizon-client` beside `horizon-ctl`; other arguments go to the game):
`target/fast/horizon-ctl --socket $PWD/ctl.sock launch --world W --creative --offscreen --wait --resources $PWD/.local/horizon-client/26.3`,
+20 -3
View File
@@ -74,6 +74,19 @@ including examples. The dependency scope includes optional, platform, build and
Tests run library, binary, integration and doc tests without building unrelated example executables. Shared Cargo
configuration and toolchain changes select the whole workspace; CI also keeps its workspace-wide checks.
## Claim before you start
Work is tracked in GitHub issues, and an issue that is assigned is taken (so is one with the `in progress` label:
claimed on Discord with Kira's `/claim`): pick another, or ask its holder in the thread. Before you start, comment
**`/claim`** on the issue; you are assigned at once, no role needed. No issue for your work yet? Open one (a line is
enough), then claim it. `/unclaim` gives it back.
A claim with no open pull request linking the issue (`Fixes #123` in the description, or a draft) is released after
5 days, with a comment: open a draft early. You can hold 5 open issues at a time. Agents claim the same way.
When your pull request changes the same functions as another open one, or closes the same issue, a bot comment names
it (edited on every push, never repeated): talk to its author in the thread before you both finish the same work.
## Pull requests
- **Small.** One change per pull request, under about 500 lines of code where you can; split bigger work into
@@ -82,8 +95,12 @@ configuration and toolchain changes select the whole workspace; CI also keeps it
can see.
- **Tick "Allow edits by maintainers".** When something small is left (a lint, a rebase, a nit) we push the fixup
ourselves instead of sending it back to you; only design questions come back.
- **Labels** (we set them if you can't): `feature` when players get something new (it appears under "New" in the
release notes), `skip-release` when players see no change (tooling, docs, tests), nothing for a fix.
- **Tick its kind** in the template: `parity` (Horizon now does what vanilla does), `bug` (a crash or breakage),
`perf`, `feature` (new for players), `extra` (Horizon-only, off by default), `tooling` or `docs`. A workflow sets
that label, and area labels (`launcher`, `mobs`, `worldgen`, `rendering`...) from the paths you change.
`label:parity` is the list of real progress toward vanilla.
- **Release labels** (we set them if you can't): `feature` also puts it under "New" in the release notes,
`skip-release` when players see no change (tooling, docs, tests), nothing for a fix.
`release-now` is for crash fixes that shouldn't wait. pr_ready suggests one.
Who reviews and merges: the Horizon Team, on CI for ordinary pull requests; risky ones (saves, network, world
@@ -102,4 +119,4 @@ new pushes, we add it again.
## Talk to us
[Discord](https://discord.gg/HcTeMZxe5E) for questions and ideas, [issues](https://github.com/horizon-rust/horizon/issues)
for bugs. If you want to take something on, say so in its issue so nobody else starts the same work.
for bugs. To take something on, `/claim` its issue ([above](#claim-before-you-start)).
Generated
+28 -811
View File
File diff suppressed because it is too large. Load diff
-13
View File
@@ -23,26 +23,13 @@ members = [
"crates/horizon-bench",
"crates/horizon-friends",
"crates/horizon-relay",
"crates/horizon-mod-sdk",
"crates/horizon-mods",
"crates/horizon-mods/tests/guest",
"crates/horizon-mods/tests/ui_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",
"crates/horizon-mod-sdk/examples/predator-missile",
"crates/horizon-mod-sdk/examples/welcome",
"crates/horizon-mod-sdk/examples/beacons",
"mods/official/fps-overlay",
"mods/official/keystrokes",
"mods/official/far-view",
"mods/official/minimap",
"mods/official/zoom",
"xtask",
"mods/official/recipes",
]
resolver = "2"
+6 -3
View File
@@ -7,6 +7,7 @@
<img src="https://img.shields.io/badge/Minecraft-Java%2026.3-5D9C3F" alt="Minecraft Java 26.3">
<img src="https://img.shields.io/badge/Rust-stable-B7410E?logo=rust&logoColor=white" alt="Rust">
<img src="https://img.shields.io/badge/vanilla%20parity-100%25-F0795A" alt="Vanilla parity 100%">
<a href="#project-status"><img src="https://img.shields.io/badge/player--visible%20gaps-833%20open-F0795A" alt="Player-visible gaps open"></a>
<img src="https://img.shields.io/badge/platform-Linux%20%7C%20macOS%20%7C%20Windows-2A2470" alt="Linux, macOS and Windows">
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-3B2F7E" alt="MIT license"></a>
</p>
@@ -46,9 +47,9 @@ The [documentation](https://playhorizon.dev/docs/) covers each of these.
- **The game:** singleplayer with vanilla's world generation, mobs, villagers, raids, redstone, every command, the HUD and the recipe book, on saves in vanilla's format. Worlds from 1.8 to 26.2 are upgraded as vanilla does. [Status table](#project-status).
- **Horizon's own extras:** new menus (vanilla's are one setting away), graphics presets, distant terrain up to 1024 chunks, controller support, optional zoom, minimap and more, all off by default where they would change the vanilla look. See [Settings](https://playhorizon.dev/docs/settings).
- **Resource packs and data packs:** resource packs work, and data packs load functions, predicates, item modifiers and world generation (vanilla's heights and biomes for now).
- **Resource packs and data packs:** resource packs work, and data packs load functions, predicates, item modifiers and world generation, taller levels included (vanilla's biomes for now).
- **Playing with others:** invite friends from the pause menu's Friends button with a code, Open to LAN, and joining servers, online-mode ones with the Microsoft account the launcher signs in with. See [Multiplayer](https://playhorizon.dev/docs/multiplayer).
- **Mods:** Horizon has its own mods, installed from the launcher. The official ones (Zoom, FPS Counter, Keystrokes and Minimap) are native Rust that the launcher builds into your game, with no Rust to install; older WebAssembly mods still run while they move. Java mod jars do not run in Horizon. See [Mods and data packs](https://playhorizon.dev/docs/mods).
- **Mods:** content mods add blocks, items and data, and native mods change the game's own Rust code, built by the launcher on your copy, with no Rust to install. Horizon's own (Zoom, FPS Counter, Keystrokes, Minimap, Recipes and Coordinates HUD) are native mods. Java mod jars do not run in Horizon. See [Mods and data packs](https://playhorizon.dev/docs/mods).
Screenshots, captured in the Rust client itself with vanilla assets and no mods or shaders:
@@ -127,6 +128,8 @@ It runs rustfmt, clippy with warnings denied, the tests of the crates you touche
## Project status
**Player-visible gaps: 833 open** of the 833 the [port ledger](tools/port_ledger.py) found, reading every vanilla 26.3 method against Horizon's code: vanilla behaviour a player would notice that Horizon doesn't have yet. By area: Screens, HUD and client packets [197](https://github.com/horizon-rust/horizon/issues/3518); Entity and block rendering, models [129](https://github.com/horizon-rust/horizon/issues/3519); Animals [110](https://github.com/horizon-rust/horizon/issues/3512); Server and players on the server [106](https://github.com/horizon-rust/horizon/issues/3520); Blocks, redstone and fluids [86](https://github.com/horizon-rust/horizon/issues/3516); Entities, projectiles, vehicles and decorations [64](https://github.com/horizon-rust/horizon/issues/3514); Monsters and bosses [53](https://github.com/horizon-rust/horizon/issues/3513); Mob AI, villagers and raids [35](https://github.com/horizon-rust/horizon/issues/3521); World, world generation and saves [32](https://github.com/horizon-rust/horizon/issues/3517); Items, enchantments and inventories [21](https://github.com/horizon-rust/horizon/issues/3515). This number goes down as gaps close (`tools/parity_gaps.py`); the harness results below say that what is tested matches.
The table below is the project's own audit of each subsystem. Every subsystem now matches vanilla in every harness that compares it. 100% means 100% of what the harnesses compare, not proof that nothing else differs. The remaining known differences are listed below.
### Java parity: 100%
@@ -163,7 +166,7 @@ lists every method of vanilla 26.3 next to the Rust functions that port it, with
### Known issues
Skins served over https show the default skin unless already cached; pack icons show the unknown-pack texture in game; the creative hotbar keys (C/X) aren't wired to the hotbar loader; item tooltips lack attribute lines.
Skins served over https show the default skin unless already cached; pack icons show the unknown-pack texture in game; item tooltips lack attribute lines.
## Licence
+409 -554
View File
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,773 @@
{
"format": "horizon-benchmark-report",
"version": 1,
"kind": "game",
"created": "2026-10-29T01:13:01Z",
"app": {
"name": "horizon-client",
"version": "v0.2.97",
"commit": null
},
"hardware": {
"os": "windows",
"arch": "x86_64",
"cpu_threads": 16,
"os_version": "Microsoft Windows [Version 10.0.26200.8037]",
"cpu": "AMD Ryzen 7 9800X3D 8-Core Processor",
"ram_mb": 95943,
"gpu": {
"name": "NVIDIA GeForce RTX 5080",
"vendor": "nvidia",
"driver": "NVIDIA 617.42",
"backend": "vulkan",
"kind": "discrete"
}
},
"conditions": {
"scenario": "perf_bench:village,forest,ocean,mountain",
"seed": "1234",
"render_distance": 16,
"simulation_distance": 12,
"vsync": false,
"offscreen": false,
"repeats": 3,
"warmup_s": 2.0,
"window": [
1280,
720
]
},
"metrics": {
"startup.title_ms": {
"n": 3,
"mean": 3158.208,
"stdev": 215.77,
"min": 3023.046,
"max": 3407.049,
"ci95": 536.046
},
"startup.world_ms": {
"n": 3,
"mean": 7170.164,
"stdev": 557.958,
"min": 6703.242,
"max": 7788.08,
"ci95": 1386.157
},
"chunks.village.load_ms": {
"n": 3,
"mean": 1694.647,
"stdev": 41.285,
"min": 1653.122,
"max": 1735.687,
"ci95": 102.566
},
"chunks.village.meshed_count": {
"n": 3,
"mean": 23544.0,
"stdev": 47.127,
"min": 23495.0,
"max": 23589.0,
"ci95": 117.081
},
"fps.village.avg_fps": {
"n": 3,
"mean": 1711.652,
"stdev": 77.412,
"min": 1623.403,
"max": 1768.093,
"ci95": 192.317
},
"fps.village.low_1pct_fps": {
"n": 3,
"mean": 593.407,
"stdev": 32.279,
"min": 571.485,
"max": 630.473,
"ci95": 80.191
},
"fps.village.low_01pct_fps": {
"n": 3,
"mean": 358.473,
"stdev": 27.832,
"min": 326.35,
"max": 375.353,
"ci95": 69.143
},
"memory.village.gpu_mb": {
"n": 3,
"mean": 631.813,
"stdev": 8.381,
"min": 626.803,
"max": 641.489,
"ci95": 20.822
},
"chunks.forest.load_ms": {
"n": 3,
"mean": 2521.363,
"stdev": 291.624,
"min": 2336.881,
"max": 2857.57,
"ci95": 724.493
},
"chunks.forest.meshed_count": {
"n": 3,
"mean": 27346.667,
"stdev": 57.934,
"min": 27306.0,
"max": 27413.0,
"ci95": 143.927
},
"fps.forest.avg_fps": {
"n": 3,
"mean": 2423.783,
"stdev": 55.746,
"min": 2386.353,
"max": 2487.851,
"ci95": 138.493
},
"fps.forest.low_1pct_fps": {
"n": 3,
"mean": 709.165,
"stdev": 66.309,
"min": 638.666,
"max": 770.286,
"ci95": 164.734
},
"fps.forest.low_01pct_fps": {
"n": 3,
"mean": 401.039,
"stdev": 40.413,
"min": 354.472,
"max": 426.929,
"ci95": 100.399
},
"memory.forest.gpu_mb": {
"n": 3,
"mean": 705.008,
"stdev": 6.062,
"min": 698.466,
"max": 710.435,
"ci95": 15.06
},
"chunks.ocean.load_ms": {
"n": 3,
"mean": 2094.909,
"stdev": 521.225,
"min": 1758.024,
"max": 2695.274,
"ci95": 1294.9
},
"chunks.ocean.meshed_count": {
"n": 3,
"mean": 24312.667,
"stdev": 261.934,
"min": 24116.0,
"max": 24610.0,
"ci95": 650.732
},
"fps.ocean.avg_fps": {
"n": 3,
"mean": 2201.125,
"stdev": 73.595,
"min": 2153.6,
"max": 2285.897,
"ci95": 182.834
},
"fps.ocean.low_1pct_fps": {
"n": 3,
"mean": 553.968,
"stdev": 100.955,
"min": 445.599,
"max": 645.355,
"ci95": 250.806
},
"fps.ocean.low_01pct_fps": {
"n": 3,
"mean": 325.078,
"stdev": 131.154,
"min": 177.4,
"max": 427.981,
"ci95": 325.831
},
"memory.ocean.gpu_mb": {
"n": 3,
"mean": 652.944,
"stdev": 5.177,
"min": 647.51,
"max": 657.818,
"ci95": 12.862
},
"chunks.mountain.load_ms": {
"n": 3,
"mean": 3304.58,
"stdev": 134.041,
"min": 3155.996,
"max": 3416.409,
"ci95": 333.003
},
"chunks.mountain.meshed_count": {
"n": 3,
"mean": 26591.0,
"stdev": 57.472,
"min": 26525.0,
"max": 26630.0,
"ci95": 142.779
},
"fps.mountain.avg_fps": {
"n": 3,
"mean": 1961.086,
"stdev": 39.725,
"min": 1921.241,
"max": 2000.69,
"ci95": 98.69
},
"fps.mountain.low_1pct_fps": {
"n": 3,
"mean": 536.973,
"stdev": 38.828,
"min": 495.61,
"max": 572.635,
"ci95": 96.461
},
"fps.mountain.low_01pct_fps": {
"n": 3,
"mean": 296.586,
"stdev": 30.236,
"min": 275.859,
"max": 331.281,
"ci95": 75.118
},
"memory.mountain.gpu_mb": {
"n": 3,
"mean": 896.941,
"stdev": 5.177,
"min": 891.506,
"max": 901.814,
"ci95": 12.862
},
"memory.rss_peak_mb": {
"n": 3,
"mean": 1458.578,
"stdev": 3.229,
"min": 1455.32,
"max": 1461.777,
"ci95": 8.022
},
"memory.rss_steady_mb": {
"n": 3,
"mean": 1236.28,
"stdev": 4.869,
"min": 1230.701,
"max": 1239.672,
"ci95": 12.096
}
},
"frames": [
{
"phase": "village",
"repeat": 0,
"frames": 21218,
"seconds": 12.0,
"avg_fps": 1768.093,
"low_1pct_fps": 630.473,
"low_01pct_fps": 375.353,
"p50_ms": 0.537,
"p95_ms": 0.846,
"p99_ms": 1.222,
"p999_ms": 2.081,
"max_ms": 6.256,
"cpu_p50_ms": 0.38,
"gpu_p50_ms": 0.104,
"histogram": [
20695,
499,
22,
1,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "village",
"repeat": 1,
"frames": 19482,
"seconds": 12.001,
"avg_fps": 1623.403,
"low_1pct_fps": 578.262,
"low_01pct_fps": 373.717,
"p50_ms": 0.586,
"p95_ms": 0.95,
"p99_ms": 1.357,
"p999_ms": 2.158,
"max_ms": 7.35,
"cpu_p50_ms": 0.445,
"gpu_p50_ms": 0.104,
"histogram": [
18729,
713,
38,
1,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "village",
"repeat": 2,
"frames": 20922,
"seconds": 12.0,
"avg_fps": 1743.46,
"low_1pct_fps": 571.485,
"low_01pct_fps": 326.35,
"p50_ms": 0.526,
"p95_ms": 0.883,
"p99_ms": 1.313,
"p999_ms": 2.14,
"max_ms": 12.027,
"cpu_p50_ms": 0.379,
"gpu_p50_ms": 0.104,
"histogram": [
20308,
582,
28,
2,
1,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "forest",
"repeat": 0,
"frames": 29855,
"seconds": 12.0,
"avg_fps": 2487.851,
"low_1pct_fps": 770.286,
"low_01pct_fps": 421.717,
"p50_ms": 0.365,
"p95_ms": 0.619,
"p99_ms": 0.948,
"p999_ms": 1.717,
"max_ms": 9.446,
"cpu_p50_ms": 0.232,
"gpu_p50_ms": 0.157,
"histogram": [
29607,
233,
13,
0,
0,
1,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "forest",
"repeat": 1,
"frames": 28766,
"seconds": 12.0,
"avg_fps": 2397.145,
"low_1pct_fps": 718.542,
"low_01pct_fps": 426.929,
"p50_ms": 0.374,
"p95_ms": 0.662,
"p99_ms": 1.016,
"p999_ms": 1.858,
"max_ms": 6.379,
"cpu_p50_ms": 0.239,
"gpu_p50_ms": 0.157,
"histogram": [
28457,
293,
14,
0,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "forest",
"repeat": 2,
"frames": 28637,
"seconds": 12.0,
"avg_fps": 2386.353,
"low_1pct_fps": 638.666,
"low_01pct_fps": 354.472,
"p50_ms": 0.373,
"p95_ms": 0.704,
"p99_ms": 1.159,
"p999_ms": 1.952,
"max_ms": 14.388,
"cpu_p50_ms": 0.233,
"gpu_p50_ms": 0.157,
"histogram": [
28198,
415,
18,
5,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "ocean",
"repeat": 0,
"frames": 25968,
"seconds": 12.001,
"avg_fps": 2163.877,
"low_1pct_fps": 570.949,
"low_01pct_fps": 369.854,
"p50_ms": 0.408,
"p95_ms": 0.767,
"p99_ms": 1.339,
"p999_ms": 2.38,
"max_ms": 3.329,
"cpu_p50_ms": 0.271,
"gpu_p50_ms": 0.141,
"histogram": [
25383,
534,
47,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "ocean",
"repeat": 1,
"frames": 25843,
"seconds": 12.0,
"avg_fps": 2153.6,
"low_1pct_fps": 445.599,
"low_01pct_fps": 177.4,
"p50_ms": 0.413,
"p95_ms": 0.725,
"p99_ms": 1.309,
"p999_ms": 3.451,
"max_ms": 12.071,
"cpu_p50_ms": 0.275,
"gpu_p50_ms": 0.142,
"histogram": [
25375,
373,
56,
22,
1,
7,
3,
5,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "ocean",
"repeat": 2,
"frames": 27431,
"seconds": 12.0,
"avg_fps": 2285.897,
"low_1pct_fps": 645.355,
"low_01pct_fps": 427.981,
"p50_ms": 0.388,
"p95_ms": 0.693,
"p99_ms": 1.163,
"p999_ms": 2.041,
"max_ms": 3.068,
"cpu_p50_ms": 0.254,
"gpu_p50_ms": 0.141,
"histogram": [
27036,
363,
31,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "mountain",
"repeat": 0,
"frames": 23536,
"seconds": 12.0,
"avg_fps": 1961.326,
"low_1pct_fps": 542.675,
"low_01pct_fps": 331.281,
"p50_ms": 0.436,
"p95_ms": 0.856,
"p99_ms": 1.425,
"p999_ms": 2.22,
"max_ms": 9.458,
"cpu_p50_ms": 0.296,
"gpu_p50_ms": 0.14,
"histogram": [
22819,
671,
40,
5,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "mountain",
"repeat": 1,
"frames": 23056,
"seconds": 12.001,
"avg_fps": 1921.241,
"low_1pct_fps": 495.61,
"low_01pct_fps": 282.617,
"p50_ms": 0.44,
"p95_ms": 0.911,
"p99_ms": 1.516,
"p999_ms": 2.543,
"max_ms": 14.342,
"cpu_p50_ms": 0.299,
"gpu_p50_ms": 0.141,
"histogram": [
22198,
783,
65,
7,
0,
2,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "mountain",
"repeat": 2,
"frames": 24009,
"seconds": 12.0,
"avg_fps": 2000.69,
"low_1pct_fps": 572.635,
"low_01pct_fps": 275.859,
"p50_ms": 0.436,
"p95_ms": 0.819,
"p99_ms": 1.274,
"p999_ms": 2.085,
"max_ms": 14.003,
"cpu_p50_ms": 0.297,
"gpu_p50_ms": 0.14,
"histogram": [
23421,
560,
22,
0,
1,
0,
2,
2,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
],
"label": "horizon-win-9800x3d-5080"
}
@@ -0,0 +1,773 @@
{
"format": "horizon-benchmark-report",
"version": 1,
"kind": "game",
"created": "2026-10-29T18:55:59Z",
"app": {
"name": "horizon-client",
"version": "v0.2.97",
"commit": null
},
"hardware": {
"os": "windows",
"arch": "x86_64",
"cpu_threads": 16,
"os_version": "Microsoft Windows [Version 10.0.26200.8037]",
"cpu": "AMD Ryzen 7 9800X3D 8-Core Processor",
"ram_mb": 95943,
"gpu": {
"name": "NVIDIA GeForce RTX 5080",
"vendor": "nvidia",
"driver": "NVIDIA 617.42",
"backend": "vulkan",
"kind": "discrete"
}
},
"conditions": {
"scenario": "perf_bench:village,forest,ocean,mountain",
"seed": "1234",
"render_distance": 32,
"simulation_distance": 12,
"vsync": false,
"offscreen": false,
"repeats": 3,
"warmup_s": 2.0,
"window": [
1280,
720
]
},
"metrics": {
"startup.title_ms": {
"n": 3,
"mean": 2897.812,
"stdev": 82.455,
"min": 2844.677,
"max": 2992.8,
"ci95": 204.846
},
"startup.world_ms": {
"n": 3,
"mean": 10503.454,
"stdev": 493.592,
"min": 9934.491,
"max": 10816.992,
"ci95": 1226.251
},
"chunks.village.load_ms": {
"n": 3,
"mean": 3717.47,
"stdev": 1330.649,
"min": 2942.872,
"max": 5253.954,
"ci95": 3305.783
},
"chunks.village.meshed_count": {
"n": 3,
"mean": 47525.333,
"stdev": 1369.122,
"min": 46133.0,
"max": 48870.0,
"ci95": 3401.363
},
"fps.village.avg_fps": {
"n": 3,
"mean": 1163.541,
"stdev": 3.485,
"min": 1159.52,
"max": 1165.693,
"ci95": 8.658
},
"fps.village.low_1pct_fps": {
"n": 3,
"mean": 415.992,
"stdev": 15.742,
"min": 399.062,
"max": 430.188,
"ci95": 39.108
},
"fps.village.low_01pct_fps": {
"n": 3,
"mean": 215.549,
"stdev": 34.678,
"min": 177.857,
"max": 246.101,
"ci95": 86.151
},
"memory.village.gpu_mb": {
"n": 3,
"mean": 1833.432,
"stdev": 4.415,
"min": 1828.334,
"max": 1835.997,
"ci95": 10.969
},
"chunks.forest.load_ms": {
"n": 3,
"mean": 5455.049,
"stdev": 593.897,
"min": 4973.659,
"max": 6118.723,
"ci95": 1475.44
},
"chunks.forest.meshed_count": {
"n": 3,
"mean": 82758.0,
"stdev": 413.547,
"min": 82487.0,
"max": 83234.0,
"ci95": 1027.39
},
"fps.forest.avg_fps": {
"n": 3,
"mean": 1389.46,
"stdev": 28.128,
"min": 1371.096,
"max": 1421.843,
"ci95": 69.88
},
"fps.forest.low_1pct_fps": {
"n": 3,
"mean": 504.377,
"stdev": 13.251,
"min": 492.444,
"max": 518.637,
"ci95": 32.919
},
"fps.forest.low_01pct_fps": {
"n": 3,
"mean": 329.682,
"stdev": 47.451,
"min": 294.872,
"max": 383.732,
"ci95": 117.885
},
"memory.forest.gpu_mb": {
"n": 3,
"mean": 1985.175,
"stdev": 6.354,
"min": 1978.907,
"max": 1991.612,
"ci95": 15.786
},
"chunks.ocean.load_ms": {
"n": 3,
"mean": 4504.145,
"stdev": 745.393,
"min": 3650.589,
"max": 5026.8,
"ci95": 1851.809
},
"chunks.ocean.meshed_count": {
"n": 3,
"mean": 74927.333,
"stdev": 399.375,
"min": 74476.0,
"max": 75235.0,
"ci95": 992.182
},
"fps.ocean.avg_fps": {
"n": 3,
"mean": 1188.639,
"stdev": 10.807,
"min": 1177.005,
"max": 1198.365,
"ci95": 26.849
},
"fps.ocean.low_1pct_fps": {
"n": 3,
"mean": 154.773,
"stdev": 3.712,
"min": 151.38,
"max": 158.738,
"ci95": 9.223
},
"fps.ocean.low_01pct_fps": {
"n": 3,
"mean": 67.809,
"stdev": 3.032,
"min": 65.903,
"max": 71.305,
"ci95": 7.532
},
"memory.ocean.gpu_mb": {
"n": 3,
"mean": 2084.845,
"stdev": 9.674,
"min": 2074.009,
"max": 2092.615,
"ci95": 24.034
},
"chunks.mountain.load_ms": {
"n": 3,
"mean": 9048.431,
"stdev": 344.33,
"min": 8821.41,
"max": 9444.624,
"ci95": 855.432
},
"chunks.mountain.meshed_count": {
"n": 3,
"mean": 89659.667,
"stdev": 87.123,
"min": 89561.0,
"max": 89726.0,
"ci95": 216.442
},
"fps.mountain.avg_fps": {
"n": 3,
"mean": 1085.847,
"stdev": 13.819,
"min": 1070.378,
"max": 1096.974,
"ci95": 34.332
},
"fps.mountain.low_1pct_fps": {
"n": 3,
"mean": 257.7,
"stdev": 31.437,
"min": 224.366,
"max": 286.814,
"ci95": 78.101
},
"fps.mountain.low_01pct_fps": {
"n": 3,
"mean": 107.783,
"stdev": 14.883,
"min": 91.541,
"max": 120.768,
"ci95": 36.975
},
"memory.mountain.gpu_mb": {
"n": 3,
"mean": 2708.833,
"stdev": 9.674,
"min": 2697.997,
"max": 2716.603,
"ci95": 24.034
},
"memory.rss_peak_mb": {
"n": 3,
"mean": 2044.895,
"stdev": 10.562,
"min": 2032.875,
"max": 2052.691,
"ci95": 26.238
},
"memory.rss_steady_mb": {
"n": 3,
"mean": 1730.107,
"stdev": 14.764,
"min": 1717.52,
"max": 1746.357,
"ci95": 36.678
}
},
"frames": [
{
"phase": "village",
"repeat": 0,
"frames": 13986,
"seconds": 12.001,
"avg_fps": 1165.41,
"low_1pct_fps": 399.062,
"low_01pct_fps": 177.857,
"p50_ms": 0.822,
"p95_ms": 1.21,
"p99_ms": 1.691,
"p999_ms": 3.499,
"max_ms": 13.089,
"cpu_p50_ms": 0.665,
"gpu_p50_ms": 0.193,
"histogram": [
12380,
1527,
58,
13,
2,
2,
1,
2,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "village",
"repeat": 1,
"frames": 13915,
"seconds": 12.001,
"avg_fps": 1159.52,
"low_1pct_fps": 430.188,
"low_01pct_fps": 246.101,
"p50_ms": 0.809,
"p95_ms": 1.212,
"p99_ms": 1.702,
"p999_ms": 3.291,
"max_ms": 6.894,
"cpu_p50_ms": 0.648,
"gpu_p50_ms": 0.192,
"histogram": [
11996,
1839,
59,
17,
2,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "village",
"repeat": 2,
"frames": 13989,
"seconds": 12.001,
"avg_fps": 1165.693,
"low_1pct_fps": 418.725,
"low_01pct_fps": 222.688,
"p50_ms": 0.816,
"p95_ms": 1.22,
"p99_ms": 1.692,
"p999_ms": 3.264,
"max_ms": 7.781,
"cpu_p50_ms": 0.669,
"gpu_p50_ms": 0.193,
"histogram": [
12321,
1578,
72,
11,
2,
4,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "forest",
"repeat": 0,
"frames": 17063,
"seconds": 12.001,
"avg_fps": 1421.843,
"low_1pct_fps": 502.049,
"low_01pct_fps": 294.872,
"p50_ms": 0.666,
"p95_ms": 0.935,
"p99_ms": 1.549,
"p999_ms": 2.692,
"max_ms": 6.831,
"cpu_p50_ms": 0.533,
"gpu_p50_ms": 0.362,
"histogram": [
16417,
596,
40,
7,
2,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "forest",
"repeat": 1,
"frames": 16454,
"seconds": 12.001,
"avg_fps": 1371.096,
"low_1pct_fps": 492.444,
"low_01pct_fps": 310.443,
"p50_ms": 0.688,
"p95_ms": 0.979,
"p99_ms": 1.556,
"p999_ms": 2.693,
"max_ms": 4.596,
"cpu_p50_ms": 0.553,
"gpu_p50_ms": 0.36,
"histogram": [
15692,
697,
57,
7,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "forest",
"repeat": 2,
"frames": 16506,
"seconds": 12.001,
"avg_fps": 1375.442,
"low_1pct_fps": 518.637,
"low_01pct_fps": 383.732,
"p50_ms": 0.675,
"p95_ms": 1.017,
"p99_ms": 1.605,
"p999_ms": 2.369,
"max_ms": 3.201,
"cpu_p50_ms": 0.54,
"gpu_p50_ms": 0.364,
"histogram": [
15628,
833,
44,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "ocean",
"repeat": 0,
"frames": 14381,
"seconds": 12.001,
"avg_fps": 1198.365,
"low_1pct_fps": 154.2,
"low_01pct_fps": 66.219,
"p50_ms": 0.731,
"p95_ms": 1.023,
"p99_ms": 3.003,
"p999_ms": 12.478,
"max_ms": 18.863,
"cpu_p50_ms": 0.596,
"gpu_p50_ms": 0.315,
"histogram": [
13586,
546,
105,
60,
13,
13,
8,
16,
8,
11,
5,
7,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "ocean",
"repeat": 1,
"frames": 14287,
"seconds": 12.0,
"avg_fps": 1190.548,
"low_1pct_fps": 158.738,
"low_01pct_fps": 71.305,
"p50_ms": 0.741,
"p95_ms": 1.041,
"p99_ms": 2.9,
"p999_ms": 12.0,
"max_ms": 17.23,
"cpu_p50_ms": 0.602,
"gpu_p50_ms": 0.315,
"histogram": [
13450,
591,
109,
57,
13,
8,
10,
11,
14,
10,
7,
6,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "ocean",
"repeat": 2,
"frames": 14124,
"seconds": 12.0,
"avg_fps": 1177.005,
"low_1pct_fps": 151.38,
"low_01pct_fps": 65.903,
"p50_ms": 0.739,
"p95_ms": 1.096,
"p99_ms": 2.928,
"p999_ms": 11.884,
"max_ms": 19.375,
"cpu_p50_ms": 0.604,
"gpu_p50_ms": 0.314,
"histogram": [
13052,
822,
114,
54,
16,
8,
4,
14,
11,
15,
3,
8,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "mountain",
"repeat": 0,
"frames": 12845,
"seconds": 12.0,
"avg_fps": 1070.378,
"low_1pct_fps": 224.366,
"low_01pct_fps": 91.541,
"p50_ms": 0.825,
"p95_ms": 1.362,
"p99_ms": 2.325,
"p999_ms": 9.621,
"max_ms": 13.309,
"cpu_p50_ms": 0.689,
"gpu_p50_ms": 0.307,
"histogram": [
10937,
1699,
143,
25,
5,
6,
4,
8,
8,
8,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "mountain",
"repeat": 1,
"frames": 13083,
"seconds": 12.001,
"avg_fps": 1090.188,
"low_1pct_fps": 261.921,
"low_01pct_fps": 111.039,
"p50_ms": 0.816,
"p95_ms": 1.335,
"p99_ms": 2.14,
"p999_ms": 8.222,
"max_ms": 11.95,
"cpu_p50_ms": 0.681,
"gpu_p50_ms": 0.306,
"histogram": [
11105,
1812,
112,
21,
5,
5,
5,
6,
11,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "mountain",
"repeat": 2,
"frames": 13164,
"seconds": 12.0,
"avg_fps": 1096.974,
"low_1pct_fps": 286.814,
"low_01pct_fps": 120.768,
"p50_ms": 0.822,
"p95_ms": 1.307,
"p99_ms": 1.989,
"p999_ms": 7.701,
"max_ms": 9.429,
"cpu_p50_ms": 0.687,
"gpu_p50_ms": 0.307,
"histogram": [
11280,
1758,
82,
13,
5,
5,
6,
8,
7,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
],
"label": "horizon-win-9800x3d-5080"
}
@@ -0,0 +1,773 @@
{
"format": "horizon-benchmark-report",
"version": 1,
"kind": "game",
"created": "2026-10-29T18:37:03Z",
"app": {
"name": "horizon-client",
"version": "v0.2.97",
"commit": null
},
"hardware": {
"os": "windows",
"arch": "x86_64",
"cpu_threads": 16,
"os_version": "Microsoft Windows [Version 10.0.26200.8037]",
"cpu": "AMD Ryzen 7 9800X3D 8-Core Processor",
"ram_mb": 95943,
"gpu": {
"name": "NVIDIA GeForce RTX 5080",
"vendor": "nvidia",
"driver": "NVIDIA 617.42",
"backend": "vulkan",
"kind": "discrete"
}
},
"conditions": {
"scenario": "perf_bench:village,forest,ocean,mountain",
"seed": "1234",
"render_distance": 8,
"simulation_distance": 12,
"vsync": false,
"offscreen": false,
"repeats": 3,
"warmup_s": 2.0,
"window": [
1280,
720
]
},
"metrics": {
"startup.title_ms": {
"n": 3,
"mean": 2950.343,
"stdev": 162.732,
"min": 2822.925,
"max": 3133.657,
"ci95": 404.282
},
"startup.world_ms": {
"n": 3,
"mean": 6135.1,
"stdev": 863.831,
"min": 5547.861,
"max": 7126.98,
"ci95": 2146.05
},
"chunks.village.load_ms": {
"n": 3,
"mean": 985.519,
"stdev": 28.184,
"min": 956.244,
"max": 1012.469,
"ci95": 70.019
},
"chunks.village.meshed_count": {
"n": 3,
"mean": 6908.0,
"stdev": 9.849,
"min": 6897.0,
"max": 6916.0,
"ci95": 24.468
},
"fps.village.avg_fps": {
"n": 3,
"mean": 2941.608,
"stdev": 79.283,
"min": 2850.416,
"max": 2994.188,
"ci95": 196.965
},
"fps.village.low_1pct_fps": {
"n": 3,
"mean": 1271.318,
"stdev": 58.797,
"min": 1203.758,
"max": 1310.917,
"ci95": 146.072
},
"fps.village.low_01pct_fps": {
"n": 3,
"mean": 839.261,
"stdev": 37.982,
"min": 795.415,
"max": 862.067,
"ci95": 94.36
},
"memory.village.gpu_mb": {
"n": 3,
"mean": 363.984,
"stdev": 0.926,
"min": 363.449,
"max": 365.053,
"ci95": 2.299
},
"chunks.forest.load_ms": {
"n": 3,
"mean": 1350.752,
"stdev": 293.128,
"min": 1106.764,
"max": 1675.913,
"ci95": 728.23
},
"chunks.forest.meshed_count": {
"n": 3,
"mean": 8066.0,
"stdev": 108.885,
"min": 7986.0,
"max": 8190.0,
"ci95": 270.508
},
"fps.forest.avg_fps": {
"n": 3,
"mean": 3494.693,
"stdev": 110.997,
"min": 3389.894,
"max": 3610.993,
"ci95": 275.755
},
"fps.forest.low_1pct_fps": {
"n": 3,
"mean": 1295.14,
"stdev": 159.638,
"min": 1148.468,
"max": 1465.171,
"ci95": 396.596
},
"fps.forest.low_01pct_fps": {
"n": 3,
"mean": 859.326,
"stdev": 119.845,
"min": 721.994,
"max": 942.743,
"ci95": 297.734
},
"memory.forest.gpu_mb": {
"n": 3,
"mean": 381.189,
"stdev": 5.222,
"min": 376.423,
"max": 386.77,
"ci95": 12.972
},
"chunks.ocean.load_ms": {
"n": 3,
"mean": 1123.386,
"stdev": 604.175,
"min": 734.302,
"max": 1819.414,
"ci95": 1500.976
},
"chunks.ocean.meshed_count": {
"n": 3,
"mean": 6613.0,
"stdev": 135.632,
"min": 6523.0,
"max": 6769.0,
"ci95": 336.955
},
"fps.ocean.avg_fps": {
"n": 3,
"mean": 3346.003,
"stdev": 59.312,
"min": 3303.535,
"max": 3413.77,
"ci95": 147.352
},
"fps.ocean.low_1pct_fps": {
"n": 3,
"mean": 1357.991,
"stdev": 95.364,
"min": 1248.887,
"max": 1425.451,
"ci95": 236.917
},
"fps.ocean.low_01pct_fps": {
"n": 3,
"mean": 911.822,
"stdev": 94.717,
"min": 802.528,
"max": 969.989,
"ci95": 235.308
},
"memory.ocean.gpu_mb": {
"n": 3,
"mean": 391.636,
"stdev": 5.435,
"min": 387.424,
"max": 397.771,
"ci95": 13.502
},
"chunks.mountain.load_ms": {
"n": 3,
"mean": 1588.954,
"stdev": 458.924,
"min": 1309.548,
"max": 2118.606,
"ci95": 1140.123
},
"chunks.mountain.meshed_count": {
"n": 3,
"mean": 7887.667,
"stdev": 41.041,
"min": 7862.0,
"max": 7935.0,
"ci95": 101.959
},
"fps.mountain.avg_fps": {
"n": 3,
"mean": 3375.623,
"stdev": 26.82,
"min": 3352.309,
"max": 3404.933,
"ci95": 66.629
},
"fps.mountain.low_1pct_fps": {
"n": 3,
"mean": 1383.745,
"stdev": 67.628,
"min": 1324.071,
"max": 1457.203,
"ci95": 168.01
},
"fps.mountain.low_01pct_fps": {
"n": 3,
"mean": 850.213,
"stdev": 103.149,
"min": 790.305,
"max": 969.318,
"ci95": 256.256
},
"memory.mountain.gpu_mb": {
"n": 3,
"mean": 448.64,
"stdev": 5.435,
"min": 444.428,
"max": 454.775,
"ci95": 13.502
},
"memory.rss_peak_mb": {
"n": 3,
"mean": 1171.629,
"stdev": 0.337,
"min": 1171.398,
"max": 1172.016,
"ci95": 0.837
},
"memory.rss_steady_mb": {
"n": 3,
"mean": 1082.078,
"stdev": 12.494,
"min": 1069.117,
"max": 1094.047,
"ci95": 31.04
}
},
"frames": [
{
"phase": "village",
"repeat": 0,
"frames": 35764,
"seconds": 12.0,
"avg_fps": 2980.22,
"low_1pct_fps": 1310.917,
"low_01pct_fps": 860.301,
"p50_ms": 0.317,
"p95_ms": 0.433,
"p99_ms": 0.633,
"p999_ms": 0.937,
"max_ms": 2.807,
"cpu_p50_ms": 0.192,
"gpu_p50_ms": 0.063,
"histogram": [
35741,
22,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "village",
"repeat": 1,
"frames": 35931,
"seconds": 12.0,
"avg_fps": 2994.188,
"low_1pct_fps": 1299.278,
"low_01pct_fps": 795.415,
"p50_ms": 0.318,
"p95_ms": 0.428,
"p99_ms": 0.62,
"p999_ms": 0.943,
"max_ms": 5.797,
"cpu_p50_ms": 0.191,
"gpu_p50_ms": 0.063,
"histogram": [
35906,
23,
1,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "village",
"repeat": 2,
"frames": 34206,
"seconds": 12.0,
"avg_fps": 2850.416,
"low_1pct_fps": 1203.758,
"low_01pct_fps": 862.067,
"p50_ms": 0.326,
"p95_ms": 0.508,
"p99_ms": 0.705,
"p999_ms": 1.025,
"max_ms": 1.398,
"cpu_p50_ms": 0.196,
"gpu_p50_ms": 0.063,
"histogram": [
34167,
39,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "forest",
"repeat": 0,
"frames": 41800,
"seconds": 12.0,
"avg_fps": 3483.193,
"low_1pct_fps": 1271.782,
"low_01pct_fps": 913.242,
"p50_ms": 0.264,
"p95_ms": 0.415,
"p99_ms": 0.657,
"p999_ms": 0.935,
"max_ms": 1.482,
"cpu_p50_ms": 0.144,
"gpu_p50_ms": 0.075,
"histogram": [
41768,
32,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "forest",
"repeat": 1,
"frames": 43333,
"seconds": 12.0,
"avg_fps": 3610.993,
"low_1pct_fps": 1465.171,
"low_01pct_fps": 942.743,
"p50_ms": 0.263,
"p95_ms": 0.355,
"p99_ms": 0.561,
"p999_ms": 0.859,
"max_ms": 1.694,
"cpu_p50_ms": 0.143,
"gpu_p50_ms": 0.074,
"histogram": [
43310,
23,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "forest",
"repeat": 2,
"frames": 40679,
"seconds": 12.0,
"avg_fps": 3389.894,
"low_1pct_fps": 1148.468,
"low_01pct_fps": 721.994,
"p50_ms": 0.267,
"p95_ms": 0.446,
"p99_ms": 0.67,
"p999_ms": 1.183,
"max_ms": 2.434,
"cpu_p50_ms": 0.146,
"gpu_p50_ms": 0.076,
"histogram": [
40590,
87,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "ocean",
"repeat": 0,
"frames": 39849,
"seconds": 12.0,
"avg_fps": 3320.704,
"low_1pct_fps": 1399.634,
"low_01pct_fps": 969.989,
"p50_ms": 0.281,
"p95_ms": 0.404,
"p99_ms": 0.601,
"p999_ms": 0.875,
"max_ms": 1.494,
"cpu_p50_ms": 0.159,
"gpu_p50_ms": 0.069,
"histogram": [
39831,
18,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "ocean",
"repeat": 1,
"frames": 40966,
"seconds": 12.0,
"avg_fps": 3413.77,
"low_1pct_fps": 1425.451,
"low_01pct_fps": 962.948,
"p50_ms": 0.278,
"p95_ms": 0.372,
"p99_ms": 0.581,
"p999_ms": 0.857,
"max_ms": 1.576,
"cpu_p50_ms": 0.157,
"gpu_p50_ms": 0.069,
"histogram": [
40947,
19,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "ocean",
"repeat": 2,
"frames": 39643,
"seconds": 12.0,
"avg_fps": 3303.535,
"low_1pct_fps": 1248.887,
"low_01pct_fps": 802.528,
"p50_ms": 0.28,
"p95_ms": 0.413,
"p99_ms": 0.642,
"p999_ms": 1.087,
"max_ms": 2.215,
"cpu_p50_ms": 0.158,
"gpu_p50_ms": 0.069,
"histogram": [
39582,
60,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "mountain",
"repeat": 0,
"frames": 40436,
"seconds": 12.0,
"avg_fps": 3369.626,
"low_1pct_fps": 1369.962,
"low_01pct_fps": 790.305,
"p50_ms": 0.279,
"p95_ms": 0.403,
"p99_ms": 0.604,
"p999_ms": 0.812,
"max_ms": 10.313,
"cpu_p50_ms": 0.159,
"gpu_p50_ms": 0.069,
"histogram": [
40425,
8,
1,
1,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "mountain",
"repeat": 1,
"frames": 40860,
"seconds": 12.0,
"avg_fps": 3404.933,
"low_1pct_fps": 1457.203,
"low_01pct_fps": 969.318,
"p50_ms": 0.278,
"p95_ms": 0.389,
"p99_ms": 0.574,
"p999_ms": 0.814,
"max_ms": 2.714,
"cpu_p50_ms": 0.158,
"gpu_p50_ms": 0.069,
"histogram": [
40847,
11,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "mountain",
"repeat": 2,
"frames": 40229,
"seconds": 12.0,
"avg_fps": 3352.309,
"low_1pct_fps": 1324.071,
"low_01pct_fps": 791.016,
"p50_ms": 0.28,
"p95_ms": 0.402,
"p99_ms": 0.617,
"p999_ms": 0.968,
"max_ms": 3.746,
"cpu_p50_ms": 0.159,
"gpu_p50_ms": 0.069,
"histogram": [
40192,
35,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
],
"label": "horizon-win-9800x3d-5080"
}
@@ -0,0 +1,706 @@
{
"format": "horizon-benchmark-report",
"version": 1,
"kind": "game",
"created": "2026-10-29T01:25:53Z",
"app": {
"name": "minecraft",
"version": "26.3",
"mods": [
{
"name": "fabric-loader",
"version": "0.19.5"
},
{
"name": "sodium",
"version": "mc26.3-0.9.2-fabric"
},
{
"name": "lithium",
"version": "mc26.3-0.26.2-fabric"
},
{
"name": "ferrite-core",
"version": "9.0.0-fabric"
},
{
"name": "immediatelyfast",
"version": "1.17.1+26.3-fabric"
}
]
},
"hardware": {
"os": "windows",
"arch": "x86_64",
"cpu_threads": 16,
"os_version": "Microsoft Windows [Version 10.0.26200.8037]",
"cpu": "AMD Ryzen 7 9800X3D 8-Core Processor",
"ram_mb": 95943,
"gpu": {
"name": "NVIDIA GeForce RTX 5080/PCIe/SSE2",
"vendor": "NVIDIA Corporation",
"driver": "3.3.0 NVIDIA 617.42",
"backend": "opengl",
"kind": ""
}
},
"conditions": {
"scenario": "perf_bench:village,forest,ocean,mountain",
"seed": "1234",
"render_distance": 16,
"simulation_distance": 12,
"vsync": false,
"offscreen": false,
"repeats": 3,
"warmup_s": 2.0,
"window": [
1280,
720
]
},
"metrics": {
"startup.title_ms": {
"n": 3,
"mean": 10777.756,
"stdev": 129.67,
"min": 10636.92,
"max": 10892.2,
"ci95": 322.144
},
"startup.world_ms": {
"n": 3,
"mean": 23477.423,
"stdev": 346.614,
"min": 23130.92,
"max": 23824.148,
"ci95": 861.106
},
"chunks.village.load_ms": {
"n": 3,
"mean": 6007.033,
"stdev": 104.227,
"min": 5891.431,
"max": 6093.825,
"ci95": 258.936
},
"fps.village.avg_fps": {
"n": 3,
"mean": 1282.11,
"stdev": 65.207,
"min": 1228.13,
"max": 1354.56,
"ci95": 161.997
},
"fps.village.low_1pct_fps": {
"n": 3,
"mean": 343.465,
"stdev": 9.96,
"min": 335.223,
"max": 354.532,
"ci95": 24.744
},
"fps.village.low_01pct_fps": {
"n": 3,
"mean": 131.669,
"stdev": 4.692,
"min": 126.427,
"max": 135.476,
"ci95": 11.656
},
"chunks.forest.load_ms": {
"n": 3,
"mean": 8669.311,
"stdev": 434.39,
"min": 8280.854,
"max": 9138.35,
"ci95": 1079.173
},
"fps.forest.avg_fps": {
"n": 3,
"mean": 1745.757,
"stdev": 13.014,
"min": 1734.41,
"max": 1759.963,
"ci95": 32.332
},
"fps.forest.low_1pct_fps": {
"n": 3,
"mean": 460.958,
"stdev": 10.859,
"min": 449.051,
"max": 470.316,
"ci95": 26.978
},
"fps.forest.low_01pct_fps": {
"n": 3,
"mean": 178.955,
"stdev": 3.777,
"min": 175.213,
"max": 182.766,
"ci95": 9.383
},
"chunks.ocean.load_ms": {
"n": 3,
"mean": 7056.368,
"stdev": 117.329,
"min": 6986.912,
"max": 7191.833,
"ci95": 291.485
},
"fps.ocean.avg_fps": {
"n": 3,
"mean": 1815.056,
"stdev": 47.875,
"min": 1759.788,
"max": 1843.745,
"ci95": 118.937
},
"fps.ocean.low_1pct_fps": {
"n": 3,
"mean": 514.215,
"stdev": 57.205,
"min": 452.445,
"max": 565.368,
"ci95": 142.117
},
"fps.ocean.low_01pct_fps": {
"n": 3,
"mean": 191.842,
"stdev": 23.217,
"min": 175.546,
"max": 218.426,
"ci95": 57.68
},
"chunks.mountain.load_ms": {
"n": 3,
"mean": 14094.582,
"stdev": 399.624,
"min": 13641.534,
"max": 14397.0,
"ci95": 992.801
},
"fps.mountain.avg_fps": {
"n": 3,
"mean": 1499.768,
"stdev": 22.197,
"min": 1477.269,
"max": 1521.651,
"ci95": 55.146
},
"fps.mountain.low_1pct_fps": {
"n": 3,
"mean": 408.466,
"stdev": 16.114,
"min": 395.097,
"max": 426.358,
"ci95": 40.032
},
"fps.mountain.low_01pct_fps": {
"n": 3,
"mean": 139.743,
"stdev": 3.969,
"min": 136.465,
"max": 144.156,
"ci95": 9.86
},
"memory.rss_peak_mb": {
"n": 3,
"mean": 2495.607,
"stdev": 75.339,
"min": 2412.738,
"max": 2559.965,
"ci95": 187.166
},
"memory.rss_steady_mb": {
"n": 3,
"mean": 2326.611,
"stdev": 15.702,
"min": 2314.98,
"max": 2344.473,
"ci95": 39.01
}
},
"frames": [
{
"phase": "village",
"repeat": 0,
"frames": 14738,
"seconds": 12.0,
"avg_fps": 1228.13,
"low_1pct_fps": 335.223,
"low_01pct_fps": 133.103,
"p50_ms": 0.722,
"p95_ms": 1.384,
"p99_ms": 2.043,
"p999_ms": 5.224,
"max_ms": 11.459,
"histogram": [
12159,
2421,
128,
14,
1,
5,
2,
3,
4,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "village",
"repeat": 1,
"frames": 16255,
"seconds": 12.0,
"avg_fps": 1354.56,
"low_1pct_fps": 354.532,
"low_01pct_fps": 135.476,
"p50_ms": 0.672,
"p95_ms": 1.136,
"p99_ms": 1.841,
"p999_ms": 4.913,
"max_ms": 16.94,
"histogram": [
14841,
1298,
86,
13,
2,
5,
4,
1,
3,
1,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "village",
"repeat": 2,
"frames": 15164,
"seconds": 12.0,
"avg_fps": 1263.64,
"low_1pct_fps": 340.639,
"low_01pct_fps": 126.427,
"p50_ms": 0.708,
"p95_ms": 1.299,
"p99_ms": 1.895,
"p999_ms": 5.173,
"max_ms": 16.748,
"histogram": [
13026,
2014,
94,
13,
1,
3,
3,
6,
2,
1,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "forest",
"repeat": 0,
"frames": 20915,
"seconds": 12.0,
"avg_fps": 1742.897,
"low_1pct_fps": 470.316,
"low_01pct_fps": 182.766,
"p50_ms": 0.5,
"p95_ms": 0.936,
"p99_ms": 1.437,
"p999_ms": 2.77,
"max_ms": 13.414,
"histogram": [
20067,
788,
44,
4,
0,
4,
3,
3,
1,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "forest",
"repeat": 1,
"frames": 21120,
"seconds": 12.0,
"avg_fps": 1759.963,
"low_1pct_fps": 449.051,
"low_01pct_fps": 178.887,
"p50_ms": 0.49,
"p95_ms": 0.901,
"p99_ms": 1.531,
"p999_ms": 3.005,
"max_ms": 12.907,
"histogram": [
20414,
644,
40,
10,
1,
3,
2,
2,
2,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "forest",
"repeat": 2,
"frames": 20813,
"seconds": 12.0,
"avg_fps": 1734.41,
"low_1pct_fps": 463.506,
"low_01pct_fps": 175.213,
"p50_ms": 0.496,
"p95_ms": 0.924,
"p99_ms": 1.414,
"p999_ms": 2.733,
"max_ms": 16.832,
"histogram": [
20049,
707,
41,
5,
0,
1,
5,
2,
2,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "ocean",
"repeat": 0,
"frames": 22100,
"seconds": 12.0,
"avg_fps": 1841.634,
"low_1pct_fps": 565.368,
"low_01pct_fps": 218.426,
"p50_ms": 0.483,
"p95_ms": 0.835,
"p99_ms": 1.209,
"p999_ms": 2.082,
"max_ms": 14.627,
"histogram": [
21540,
532,
18,
1,
1,
1,
2,
2,
1,
1,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "ocean",
"repeat": 1,
"frames": 21118,
"seconds": 12.0,
"avg_fps": 1759.788,
"low_1pct_fps": 452.445,
"low_01pct_fps": 175.546,
"p50_ms": 0.489,
"p95_ms": 0.915,
"p99_ms": 1.532,
"p999_ms": 2.811,
"max_ms": 11.846,
"histogram": [
20308,
755,
36,
9,
0,
2,
0,
3,
2,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "ocean",
"repeat": 2,
"frames": 22125,
"seconds": 12.0,
"avg_fps": 1843.745,
"low_1pct_fps": 524.832,
"low_01pct_fps": 181.555,
"p50_ms": 0.477,
"p95_ms": 0.855,
"p99_ms": 1.241,
"p999_ms": 2.236,
"max_ms": 12.478,
"histogram": [
21487,
608,
18,
1,
1,
1,
2,
2,
1,
2,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "mountain",
"repeat": 0,
"frames": 18005,
"seconds": 12.0,
"avg_fps": 1500.383,
"low_1pct_fps": 403.944,
"low_01pct_fps": 136.465,
"p50_ms": 0.591,
"p95_ms": 1.058,
"p99_ms": 1.592,
"p999_ms": 3.186,
"max_ms": 12.608,
"histogram": [
16864,
1084,
32,
8,
0,
5,
3,
5,
1,
2,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "mountain",
"repeat": 1,
"frames": 17728,
"seconds": 12.001,
"avg_fps": 1477.269,
"low_1pct_fps": 395.097,
"low_01pct_fps": 138.609,
"p50_ms": 0.598,
"p95_ms": 1.042,
"p99_ms": 1.561,
"p999_ms": 5.033,
"max_ms": 11.462,
"histogram": [
16612,
1051,
39,
7,
1,
6,
5,
3,
1,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "mountain",
"repeat": 2,
"frames": 18260,
"seconds": 12.0,
"avg_fps": 1521.651,
"low_1pct_fps": 426.358,
"low_01pct_fps": 144.156,
"p50_ms": 0.585,
"p95_ms": 1.015,
"p99_ms": 1.458,
"p999_ms": 3.609,
"max_ms": 11.945,
"histogram": [
17267,
943,
26,
6,
5,
2,
3,
3,
2,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
],
"label": "vanilla-mods-win-9800x3d-5080"
}
@@ -0,0 +1,706 @@
{
"format": "horizon-benchmark-report",
"version": 1,
"kind": "game",
"created": "2026-10-29T19:27:56Z",
"app": {
"name": "minecraft",
"version": "26.3",
"mods": [
{
"name": "fabric-loader",
"version": "0.19.5"
},
{
"name": "sodium",
"version": "mc26.3-0.9.2-fabric"
},
{
"name": "lithium",
"version": "mc26.3-0.26.2-fabric"
},
{
"name": "ferrite-core",
"version": "9.0.0-fabric"
},
{
"name": "immediatelyfast",
"version": "1.17.1+26.3-fabric"
}
]
},
"hardware": {
"os": "windows",
"arch": "x86_64",
"cpu_threads": 16,
"os_version": "Microsoft Windows [Version 10.0.26200.8037]",
"cpu": "AMD Ryzen 7 9800X3D 8-Core Processor",
"ram_mb": 95943,
"gpu": {
"name": "NVIDIA GeForce RTX 5080/PCIe/SSE2",
"vendor": "NVIDIA Corporation",
"driver": "3.3.0 NVIDIA 617.42",
"backend": "opengl",
"kind": ""
}
},
"conditions": {
"scenario": "perf_bench:village,forest,ocean,mountain",
"seed": "1234",
"render_distance": 32,
"simulation_distance": 12,
"vsync": false,
"offscreen": false,
"repeats": 3,
"warmup_s": 2.0,
"window": [
1280,
720
]
},
"metrics": {
"startup.title_ms": {
"n": 3,
"mean": 11038.922,
"stdev": 118.058,
"min": 10935.424,
"max": 11167.506,
"ci95": 293.295
},
"startup.world_ms": {
"n": 3,
"mean": 39248.588,
"stdev": 479.755,
"min": 38964.834,
"max": 39802.506,
"ci95": 1191.875
},
"chunks.village.load_ms": {
"n": 3,
"mean": 11176.953,
"stdev": 356.144,
"min": 10836.65,
"max": 11547.064,
"ci95": 884.781
},
"fps.village.avg_fps": {
"n": 3,
"mean": 925.977,
"stdev": 6.727,
"min": 918.832,
"max": 932.189,
"ci95": 16.713
},
"fps.village.low_1pct_fps": {
"n": 3,
"mean": 250.092,
"stdev": 1.868,
"min": 248.431,
"max": 252.114,
"ci95": 4.64
},
"fps.village.low_01pct_fps": {
"n": 3,
"mean": 92.692,
"stdev": 4.466,
"min": 88.423,
"max": 97.332,
"ci95": 11.095
},
"chunks.forest.load_ms": {
"n": 3,
"mean": 17335.638,
"stdev": 687.588,
"min": 16544.168,
"max": 17785.772,
"ci95": 1708.201
},
"fps.forest.avg_fps": {
"n": 3,
"mean": 929.034,
"stdev": 3.11,
"min": 926.32,
"max": 932.428,
"ci95": 7.727
},
"fps.forest.low_1pct_fps": {
"n": 3,
"mean": 312.69,
"stdev": 16.386,
"min": 297.667,
"max": 330.163,
"ci95": 40.708
},
"fps.forest.low_01pct_fps": {
"n": 3,
"mean": 129.331,
"stdev": 12.786,
"min": 115.486,
"max": 140.694,
"ci95": 31.765
},
"chunks.ocean.load_ms": {
"n": 3,
"mean": 12601.063,
"stdev": 148.042,
"min": 12430.182,
"max": 12690.506,
"ci95": 367.785
},
"fps.ocean.avg_fps": {
"n": 3,
"mean": 1016.598,
"stdev": 5.481,
"min": 1010.482,
"max": 1021.068,
"ci95": 13.618
},
"fps.ocean.low_1pct_fps": {
"n": 3,
"mean": 325.361,
"stdev": 15.112,
"min": 315.682,
"max": 342.774,
"ci95": 37.543
},
"fps.ocean.low_01pct_fps": {
"n": 3,
"mean": 117.042,
"stdev": 11.095,
"min": 107.807,
"max": 129.349,
"ci95": 27.563
},
"chunks.mountain.load_ms": {
"n": 3,
"mean": 38513.008,
"stdev": 958.119,
"min": 37447.333,
"max": 39303.226,
"ci95": 2380.292
},
"fps.mountain.avg_fps": {
"n": 3,
"mean": 644.782,
"stdev": 3.94,
"min": 640.866,
"max": 648.745,
"ci95": 9.788
},
"fps.mountain.low_1pct_fps": {
"n": 3,
"mean": 166.029,
"stdev": 4.758,
"min": 162.326,
"max": 171.395,
"ci95": 11.819
},
"fps.mountain.low_01pct_fps": {
"n": 3,
"mean": 86.231,
"stdev": 8.587,
"min": 76.632,
"max": 93.184,
"ci95": 21.334
},
"memory.rss_peak_mb": {
"n": 3,
"mean": 2964.911,
"stdev": 8.27,
"min": 2959.813,
"max": 2974.453,
"ci95": 20.545
},
"memory.rss_steady_mb": {
"n": 3,
"mean": 2894.541,
"stdev": 12.847,
"min": 2879.928,
"max": 2904.059,
"ci95": 31.917
}
},
"frames": [
{
"phase": "village",
"repeat": 0,
"frames": 11123,
"seconds": 12.0,
"avg_fps": 926.911,
"low_1pct_fps": 249.732,
"low_01pct_fps": 92.322,
"p50_ms": 0.989,
"p95_ms": 1.492,
"p99_ms": 2.33,
"p999_ms": 7.409,
"max_ms": 15.258,
"histogram": [
6224,
4701,
147,
28,
3,
2,
5,
3,
3,
3,
1,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "village",
"repeat": 1,
"frames": 11187,
"seconds": 12.001,
"avg_fps": 932.189,
"low_1pct_fps": 252.114,
"low_01pct_fps": 88.423,
"p50_ms": 0.984,
"p95_ms": 1.496,
"p99_ms": 2.328,
"p999_ms": 7.858,
"max_ms": 16.843,
"histogram": [
6518,
4486,
138,
20,
9,
1,
1,
6,
1,
2,
3,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "village",
"repeat": 2,
"frames": 11026,
"seconds": 12.0,
"avg_fps": 918.832,
"low_1pct_fps": 248.431,
"low_01pct_fps": 97.332,
"p50_ms": 0.989,
"p95_ms": 1.524,
"p99_ms": 2.37,
"p999_ms": 7.446,
"max_ms": 16.573,
"histogram": [
6075,
4740,
162,
23,
5,
2,
4,
7,
4,
1,
1,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "forest",
"repeat": 0,
"frames": 11117,
"seconds": 12.001,
"avg_fps": 926.32,
"low_1pct_fps": 310.239,
"low_01pct_fps": 131.814,
"p50_ms": 1.011,
"p95_ms": 1.34,
"p99_ms": 2.045,
"p999_ms": 4.711,
"max_ms": 14.077,
"histogram": [
3849,
7150,
78,
26,
5,
1,
3,
2,
1,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "forest",
"repeat": 1,
"frames": 11190,
"seconds": 12.001,
"avg_fps": 932.428,
"low_1pct_fps": 330.163,
"low_01pct_fps": 140.694,
"p50_ms": 1.008,
"p95_ms": 1.307,
"p99_ms": 1.869,
"p999_ms": 4.341,
"max_ms": 13.489,
"histogram": [
4273,
6822,
60,
20,
7,
0,
3,
3,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "forest",
"repeat": 2,
"frames": 11141,
"seconds": 12.001,
"avg_fps": 928.354,
"low_1pct_fps": 297.667,
"low_01pct_fps": 115.486,
"p50_ms": 1.005,
"p95_ms": 1.352,
"p99_ms": 2.054,
"p999_ms": 5.292,
"max_ms": 14.339,
"histogram": [
4901,
6118,
83,
23,
3,
2,
4,
3,
0,
1,
2,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "ocean",
"repeat": 0,
"frames": 12126,
"seconds": 12.0,
"avg_fps": 1010.482,
"low_1pct_fps": 317.626,
"low_01pct_fps": 113.971,
"p50_ms": 0.933,
"p95_ms": 1.23,
"p99_ms": 1.935,
"p999_ms": 4.393,
"max_ms": 14.824,
"histogram": [
9183,
2830,
82,
17,
3,
1,
2,
3,
0,
1,
3,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "ocean",
"repeat": 1,
"frames": 12219,
"seconds": 12.0,
"avg_fps": 1018.243,
"low_1pct_fps": 342.774,
"low_01pct_fps": 129.349,
"p50_ms": 0.929,
"p95_ms": 1.222,
"p99_ms": 1.867,
"p999_ms": 4.329,
"max_ms": 10.33,
"histogram": [
9421,
2710,
60,
15,
3,
0,
0,
5,
3,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "ocean",
"repeat": 2,
"frames": 12253,
"seconds": 12.0,
"avg_fps": 1021.068,
"low_1pct_fps": 315.682,
"low_01pct_fps": 107.807,
"p50_ms": 0.923,
"p95_ms": 1.225,
"p99_ms": 1.969,
"p999_ms": 5.235,
"max_ms": 19.524,
"histogram": [
9231,
2904,
92,
10,
2,
5,
0,
4,
1,
2,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "mountain",
"repeat": 0,
"frames": 7691,
"seconds": 12.001,
"avg_fps": 640.866,
"low_1pct_fps": 164.367,
"low_01pct_fps": 93.184,
"p50_ms": 1.454,
"p95_ms": 1.95,
"p99_ms": 3.4,
"p999_ms": 9.754,
"max_ms": 14.995,
"histogram": [
36,
7331,
233,
26,
17,
13,
20,
3,
6,
5,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "mountain",
"repeat": 1,
"frames": 7737,
"seconds": 12.0,
"avg_fps": 644.736,
"low_1pct_fps": 162.326,
"low_01pct_fps": 76.632,
"p50_ms": 1.454,
"p95_ms": 1.905,
"p99_ms": 3.676,
"p999_ms": 9.926,
"max_ms": 18.459,
"histogram": [
46,
7399,
199,
24,
21,
24,
10,
6,
1,
1,
4,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "mountain",
"repeat": 2,
"frames": 7785,
"seconds": 12.0,
"avg_fps": 648.745,
"low_1pct_fps": 171.395,
"low_01pct_fps": 88.876,
"p50_ms": 1.439,
"p95_ms": 1.886,
"p99_ms": 3.562,
"p999_ms": 10.342,
"max_ms": 12.927,
"histogram": [
57,
7432,
186,
44,
23,
20,
9,
3,
3,
7,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
],
"label": "vanilla-mods-win-9800x3d-5080"
}
@@ -0,0 +1,706 @@
{
"format": "horizon-benchmark-report",
"version": 1,
"kind": "game",
"created": "2026-10-29T18:49:40Z",
"app": {
"name": "minecraft",
"version": "26.3",
"mods": [
{
"name": "fabric-loader",
"version": "0.19.5"
},
{
"name": "sodium",
"version": "mc26.3-0.9.2-fabric"
},
{
"name": "lithium",
"version": "mc26.3-0.26.2-fabric"
},
{
"name": "ferrite-core",
"version": "9.0.0-fabric"
},
{
"name": "immediatelyfast",
"version": "1.17.1+26.3-fabric"
}
]
},
"hardware": {
"os": "windows",
"arch": "x86_64",
"cpu_threads": 16,
"os_version": "Microsoft Windows [Version 10.0.26200.8037]",
"cpu": "AMD Ryzen 7 9800X3D 8-Core Processor",
"ram_mb": 95943,
"gpu": {
"name": "NVIDIA GeForce RTX 5080/PCIe/SSE2",
"vendor": "NVIDIA Corporation",
"driver": "3.3.0 NVIDIA 617.42",
"backend": "opengl",
"kind": ""
}
},
"conditions": {
"scenario": "perf_bench:village,forest,ocean,mountain",
"seed": "1234",
"render_distance": 8,
"simulation_distance": 12,
"vsync": false,
"offscreen": false,
"repeats": 3,
"warmup_s": 2.0,
"window": [
1280,
720
]
},
"metrics": {
"startup.title_ms": {
"n": 3,
"mean": 11089.831,
"stdev": 46.336,
"min": 11036.36,
"max": 11118.192,
"ci95": 115.114
},
"startup.world_ms": {
"n": 3,
"mean": 17643.831,
"stdev": 47.672,
"min": 17589.192,
"max": 17676.942,
"ci95": 118.433
},
"chunks.village.load_ms": {
"n": 3,
"mean": 3603.773,
"stdev": 161.342,
"min": 3488.106,
"max": 3788.086,
"ci95": 400.828
},
"fps.village.avg_fps": {
"n": 3,
"mean": 2103.54,
"stdev": 40.465,
"min": 2078.464,
"max": 2150.222,
"ci95": 100.529
},
"fps.village.low_1pct_fps": {
"n": 3,
"mean": 577.326,
"stdev": 33.693,
"min": 557.613,
"max": 616.23,
"ci95": 83.704
},
"fps.village.low_01pct_fps": {
"n": 3,
"mean": 195.53,
"stdev": 18.899,
"min": 181.495,
"max": 217.019,
"ci95": 46.951
},
"chunks.forest.load_ms": {
"n": 3,
"mean": 3282.612,
"stdev": 48.569,
"min": 3233.16,
"max": 3330.246,
"ci95": 120.661
},
"fps.forest.avg_fps": {
"n": 3,
"mean": 2424.739,
"stdev": 26.074,
"min": 2394.789,
"max": 2442.383,
"ci95": 64.777
},
"fps.forest.low_1pct_fps": {
"n": 3,
"mean": 732.987,
"stdev": 11.926,
"min": 724.144,
"max": 746.55,
"ci95": 29.627
},
"fps.forest.low_01pct_fps": {
"n": 3,
"mean": 249.926,
"stdev": 8.826,
"min": 241.293,
"max": 258.934,
"ci95": 21.928
},
"chunks.ocean.load_ms": {
"n": 3,
"mean": 2705.954,
"stdev": 173.487,
"min": 2538.486,
"max": 2884.891,
"ci95": 431.0
},
"fps.ocean.avg_fps": {
"n": 3,
"mean": 2431.99,
"stdev": 33.071,
"min": 2394.02,
"max": 2454.493,
"ci95": 82.159
},
"fps.ocean.low_1pct_fps": {
"n": 3,
"mean": 764.065,
"stdev": 14.782,
"min": 747.287,
"max": 775.168,
"ci95": 36.723
},
"fps.ocean.low_01pct_fps": {
"n": 3,
"mean": 261.954,
"stdev": 14.724,
"min": 252.457,
"max": 278.916,
"ci95": 36.58
},
"chunks.mountain.load_ms": {
"n": 3,
"mean": 4982.865,
"stdev": 115.523,
"min": 4849.837,
"max": 5057.932,
"ci95": 286.997
},
"fps.mountain.avg_fps": {
"n": 3,
"mean": 2538.05,
"stdev": 67.405,
"min": 2462.815,
"max": 2592.938,
"ci95": 167.458
},
"fps.mountain.low_1pct_fps": {
"n": 3,
"mean": 760.16,
"stdev": 13.503,
"min": 746.001,
"max": 772.895,
"ci95": 33.547
},
"fps.mountain.low_01pct_fps": {
"n": 3,
"mean": 240.897,
"stdev": 17.872,
"min": 224.391,
"max": 259.878,
"ci95": 44.401
},
"memory.rss_peak_mb": {
"n": 3,
"mean": 2052.982,
"stdev": 57.756,
"min": 1992.574,
"max": 2107.66,
"ci95": 143.487
},
"memory.rss_steady_mb": {
"n": 3,
"mean": 1903.921,
"stdev": 62.254,
"min": 1838.307,
"max": 1962.156,
"ci95": 154.659
}
},
"frames": [
{
"phase": "village",
"repeat": 0,
"frames": 25803,
"seconds": 12.0,
"avg_fps": 2150.222,
"low_1pct_fps": 616.23,
"low_01pct_fps": 217.019,
"p50_ms": 0.433,
"p95_ms": 0.642,
"p99_ms": 1.04,
"p999_ms": 2.307,
"max_ms": 7.466,
"histogram": [
25503,
269,
8,
6,
7,
6,
2,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "village",
"repeat": 1,
"frames": 24942,
"seconds": 12.0,
"avg_fps": 2078.464,
"low_1pct_fps": 557.613,
"low_01pct_fps": 181.495,
"p50_ms": 0.45,
"p95_ms": 0.665,
"p99_ms": 1.1,
"p999_ms": 2.305,
"max_ms": 9.819,
"histogram": [
24615,
288,
17,
2,
4,
9,
2,
3,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "village",
"repeat": 2,
"frames": 24984,
"seconds": 12.0,
"avg_fps": 2081.934,
"low_1pct_fps": 558.135,
"low_01pct_fps": 188.076,
"p50_ms": 0.444,
"p95_ms": 0.682,
"p99_ms": 1.101,
"p999_ms": 2.412,
"max_ms": 11.567,
"histogram": [
24645,
308,
9,
3,
5,
5,
7,
1,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "forest",
"repeat": 0,
"frames": 29245,
"seconds": 12.0,
"avg_fps": 2437.044,
"low_1pct_fps": 728.266,
"low_01pct_fps": 249.55,
"p50_ms": 0.38,
"p95_ms": 0.555,
"p99_ms": 0.892,
"p999_ms": 1.851,
"max_ms": 6.973,
"histogram": [
29066,
154,
4,
6,
7,
6,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "forest",
"repeat": 1,
"frames": 28738,
"seconds": 12.0,
"avg_fps": 2394.789,
"low_1pct_fps": 724.144,
"low_01pct_fps": 241.293,
"p50_ms": 0.384,
"p95_ms": 0.571,
"p99_ms": 0.907,
"p999_ms": 1.833,
"max_ms": 8.35,
"histogram": [
28573,
140,
6,
3,
6,
5,
3,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "forest",
"repeat": 2,
"frames": 29309,
"seconds": 12.0,
"avg_fps": 2442.383,
"low_1pct_fps": 746.55,
"low_01pct_fps": 258.934,
"p50_ms": 0.378,
"p95_ms": 0.566,
"p99_ms": 0.876,
"p999_ms": 1.744,
"max_ms": 10.291,
"histogram": [
29138,
148,
5,
6,
5,
2,
4,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "ocean",
"repeat": 0,
"frames": 29454,
"seconds": 12.0,
"avg_fps": 2454.493,
"low_1pct_fps": 769.741,
"low_01pct_fps": 252.457,
"p50_ms": 0.378,
"p95_ms": 0.55,
"p99_ms": 0.853,
"p999_ms": 1.471,
"max_ms": 6.629,
"histogram": [
29323,
110,
2,
2,
7,
7,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "ocean",
"repeat": 1,
"frames": 28729,
"seconds": 12.0,
"avg_fps": 2394.02,
"low_1pct_fps": 747.287,
"low_01pct_fps": 254.49,
"p50_ms": 0.383,
"p95_ms": 0.579,
"p99_ms": 0.896,
"p999_ms": 1.56,
"max_ms": 7.367,
"histogram": [
28567,
141,
3,
5,
4,
4,
4,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "ocean",
"repeat": 2,
"frames": 29370,
"seconds": 12.0,
"avg_fps": 2447.458,
"low_1pct_fps": 775.168,
"low_01pct_fps": 278.916,
"p50_ms": 0.376,
"p95_ms": 0.559,
"p99_ms": 0.887,
"p999_ms": 1.567,
"max_ms": 9.65,
"histogram": [
29209,
141,
3,
9,
0,
5,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "mountain",
"repeat": 0,
"frames": 31116,
"seconds": 12.0,
"avg_fps": 2592.938,
"low_1pct_fps": 761.584,
"low_01pct_fps": 224.391,
"p50_ms": 0.356,
"p95_ms": 0.511,
"p99_ms": 0.767,
"p999_ms": 1.843,
"max_ms": 8.478,
"histogram": [
31011,
76,
4,
3,
13,
4,
3,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "mountain",
"repeat": 1,
"frames": 29554,
"seconds": 12.0,
"avg_fps": 2462.815,
"low_1pct_fps": 746.001,
"low_01pct_fps": 238.423,
"p50_ms": 0.366,
"p95_ms": 0.579,
"p99_ms": 0.849,
"p999_ms": 1.75,
"max_ms": 7.607,
"histogram": [
29430,
101,
2,
3,
9,
4,
3,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "mountain",
"repeat": 2,
"frames": 30701,
"seconds": 12.0,
"avg_fps": 2558.396,
"low_1pct_fps": 772.895,
"low_01pct_fps": 259.878,
"p50_ms": 0.357,
"p95_ms": 0.537,
"p99_ms": 0.81,
"p999_ms": 1.702,
"max_ms": 6.682,
"histogram": [
30568,
112,
1,
6,
5,
3,
6,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
],
"label": "vanilla-mods-win-9800x3d-5080"
}
@@ -0,0 +1,690 @@
{
"format": "horizon-benchmark-report",
"version": 1,
"kind": "game",
"created": "2026-10-29T01:19:23Z",
"app": {
"name": "minecraft",
"version": "26.3",
"mods": [
{
"name": "fabric-loader",
"version": "0.19.5"
}
]
},
"hardware": {
"os": "windows",
"arch": "x86_64",
"cpu_threads": 16,
"os_version": "Microsoft Windows [Version 10.0.26200.8037]",
"cpu": "AMD Ryzen 7 9800X3D 8-Core Processor",
"ram_mb": 95943,
"gpu": {
"name": "NVIDIA GeForce RTX 5080/PCIe/SSE2",
"vendor": "NVIDIA Corporation",
"driver": "3.3.0 NVIDIA 617.42",
"backend": "opengl",
"kind": ""
}
},
"conditions": {
"scenario": "perf_bench:village,forest,ocean,mountain",
"seed": "1234",
"render_distance": 16,
"simulation_distance": 12,
"vsync": false,
"offscreen": false,
"repeats": 3,
"warmup_s": 2.0,
"window": [
1280,
720
]
},
"metrics": {
"startup.title_ms": {
"n": 3,
"mean": 7681.834,
"stdev": 189.48,
"min": 7538.777,
"max": 7896.728,
"ci95": 470.732
},
"startup.world_ms": {
"n": 3,
"mean": 19898.834,
"stdev": 192.981,
"min": 19695.728,
"max": 20079.777,
"ci95": 479.431
},
"chunks.village.load_ms": {
"n": 3,
"mean": 6127.947,
"stdev": 26.756,
"min": 6097.19,
"max": 6145.854,
"ci95": 66.471
},
"fps.village.avg_fps": {
"n": 3,
"mean": 1218.486,
"stdev": 26.337,
"min": 1188.13,
"max": 1235.248,
"ci95": 65.43
},
"fps.village.low_1pct_fps": {
"n": 3,
"mean": 318.468,
"stdev": 6.292,
"min": 313.2,
"max": 325.435,
"ci95": 15.632
},
"fps.village.low_01pct_fps": {
"n": 3,
"mean": 126.59,
"stdev": 1.844,
"min": 124.744,
"max": 128.431,
"ci95": 4.58
},
"chunks.forest.load_ms": {
"n": 3,
"mean": 8548.814,
"stdev": 152.302,
"min": 8380.912,
"max": 8678.071,
"ci95": 378.37
},
"fps.forest.avg_fps": {
"n": 3,
"mean": 1912.359,
"stdev": 130.238,
"min": 1791.386,
"max": 2050.215,
"ci95": 323.555
},
"fps.forest.low_1pct_fps": {
"n": 3,
"mean": 401.907,
"stdev": 35.911,
"min": 379.849,
"max": 443.345,
"ci95": 89.216
},
"fps.forest.low_01pct_fps": {
"n": 3,
"mean": 149.26,
"stdev": 9.983,
"min": 139.809,
"max": 159.701,
"ci95": 24.801
},
"chunks.ocean.load_ms": {
"n": 3,
"mean": 6953.478,
"stdev": 276.636,
"min": 6635.649,
"max": 7140.072,
"ci95": 687.258
},
"fps.ocean.avg_fps": {
"n": 3,
"mean": 1860.512,
"stdev": 116.512,
"min": 1726.149,
"max": 1933.597,
"ci95": 289.454
},
"fps.ocean.low_1pct_fps": {
"n": 3,
"mean": 446.336,
"stdev": 56.993,
"min": 382.26,
"max": 491.369,
"ci95": 141.589
},
"fps.ocean.low_01pct_fps": {
"n": 3,
"mean": 164.934,
"stdev": 11.839,
"min": 152.493,
"max": 176.062,
"ci95": 29.413
},
"chunks.mountain.load_ms": {
"n": 3,
"mean": 15211.386,
"stdev": 256.348,
"min": 14938.008,
"max": 15446.375,
"ci95": 636.856
},
"fps.mountain.avg_fps": {
"n": 3,
"mean": 1653.223,
"stdev": 61.705,
"min": 1584.652,
"max": 1704.273,
"ci95": 153.297
},
"fps.mountain.low_1pct_fps": {
"n": 3,
"mean": 331.929,
"stdev": 10.858,
"min": 319.394,
"max": 338.396,
"ci95": 26.974
},
"fps.mountain.low_01pct_fps": {
"n": 3,
"mean": 113.436,
"stdev": 3.255,
"min": 110.869,
"max": 117.097,
"ci95": 8.086
},
"memory.rss_peak_mb": {
"n": 3,
"mean": 2540.129,
"stdev": 152.057,
"min": 2373.152,
"max": 2670.633,
"ci95": 377.761
},
"memory.rss_steady_mb": {
"n": 3,
"mean": 2299.514,
"stdev": 81.451,
"min": 2207.129,
"max": 2360.973,
"ci95": 202.352
}
},
"frames": [
{
"phase": "village",
"repeat": 0,
"frames": 14785,
"seconds": 12.0,
"avg_fps": 1232.081,
"low_1pct_fps": 325.435,
"low_01pct_fps": 128.431,
"p50_ms": 0.742,
"p95_ms": 1.265,
"p99_ms": 2.032,
"p999_ms": 5.653,
"max_ms": 12.791,
"histogram": [
12845,
1784,
127,
7,
1,
8,
4,
3,
5,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "village",
"repeat": 1,
"frames": 14258,
"seconds": 12.0,
"avg_fps": 1188.13,
"low_1pct_fps": 313.2,
"low_01pct_fps": 126.595,
"p50_ms": 0.757,
"p95_ms": 1.349,
"p99_ms": 2.12,
"p999_ms": 5.541,
"max_ms": 13.998,
"histogram": [
11994,
2076,
157,
9,
2,
8,
2,
4,
5,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "village",
"repeat": 2,
"frames": 14823,
"seconds": 12.0,
"avg_fps": 1235.248,
"low_1pct_fps": 316.768,
"low_01pct_fps": 124.744,
"p50_ms": 0.744,
"p95_ms": 1.199,
"p99_ms": 2.047,
"p999_ms": 5.628,
"max_ms": 15.519,
"histogram": [
13214,
1453,
118,
16,
2,
8,
6,
3,
0,
1,
0,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "forest",
"repeat": 0,
"frames": 21497,
"seconds": 12.0,
"avg_fps": 1791.386,
"low_1pct_fps": 382.527,
"low_01pct_fps": 139.809,
"p50_ms": 0.474,
"p95_ms": 0.931,
"p99_ms": 1.646,
"p999_ms": 5.274,
"max_ms": 13.459,
"histogram": [
20598,
799,
66,
9,
3,
8,
8,
2,
2,
0,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "forest",
"repeat": 1,
"frames": 24603,
"seconds": 12.0,
"avg_fps": 2050.215,
"low_1pct_fps": 443.345,
"low_01pct_fps": 159.701,
"p50_ms": 0.426,
"p95_ms": 0.752,
"p99_ms": 1.442,
"p999_ms": 3.134,
"max_ms": 13.282,
"histogram": [
24041,
487,
48,
6,
5,
6,
2,
3,
3,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "forest",
"repeat": 2,
"frames": 22746,
"seconds": 12.0,
"avg_fps": 1895.476,
"low_1pct_fps": 379.849,
"low_01pct_fps": 148.269,
"p50_ms": 0.456,
"p95_ms": 0.829,
"p99_ms": 1.561,
"p999_ms": 4.176,
"max_ms": 10.671,
"histogram": [
22092,
523,
91,
17,
4,
7,
3,
4,
4,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "ocean",
"repeat": 0,
"frames": 23062,
"seconds": 12.0,
"avg_fps": 1921.791,
"low_1pct_fps": 465.379,
"low_01pct_fps": 166.247,
"p50_ms": 0.463,
"p95_ms": 0.809,
"p99_ms": 1.45,
"p999_ms": 2.398,
"max_ms": 11.808,
"histogram": [
22454,
561,
27,
3,
2,
6,
0,
4,
3,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "ocean",
"repeat": 1,
"frames": 23204,
"seconds": 12.0,
"avg_fps": 1933.597,
"low_1pct_fps": 491.369,
"low_01pct_fps": 176.062,
"p50_ms": 0.466,
"p95_ms": 0.766,
"p99_ms": 1.406,
"p999_ms": 2.229,
"max_ms": 15.102,
"histogram": [
22699,
469,
19,
4,
1,
1,
4,
2,
2,
2,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "ocean",
"repeat": 2,
"frames": 20714,
"seconds": 12.0,
"avg_fps": 1726.149,
"low_1pct_fps": 382.26,
"low_01pct_fps": 152.493,
"p50_ms": 0.5,
"p95_ms": 0.956,
"p99_ms": 1.742,
"p999_ms": 3.852,
"max_ms": 12.888,
"histogram": [
19814,
787,
83,
11,
2,
7,
3,
5,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "mountain",
"repeat": 0,
"frames": 20049,
"seconds": 12.0,
"avg_fps": 1670.745,
"low_1pct_fps": 338.396,
"low_01pct_fps": 117.097,
"p50_ms": 0.502,
"p95_ms": 0.949,
"p99_ms": 1.673,
"p999_ms": 6.456,
"max_ms": 16.791,
"histogram": [
19187,
753,
70,
8,
1,
6,
12,
4,
3,
4,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "mountain",
"repeat": 1,
"frames": 19016,
"seconds": 12.0,
"avg_fps": 1584.652,
"low_1pct_fps": 337.998,
"low_01pct_fps": 112.343,
"p50_ms": 0.531,
"p95_ms": 1.082,
"p99_ms": 1.717,
"p999_ms": 5.939,
"max_ms": 12.958,
"histogram": [
17849,
1069,
63,
7,
3,
6,
2,
7,
4,
5,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "mountain",
"repeat": 2,
"frames": 20452,
"seconds": 12.0,
"avg_fps": 1704.273,
"low_1pct_fps": 319.394,
"low_01pct_fps": 110.869,
"p50_ms": 0.496,
"p95_ms": 0.911,
"p99_ms": 1.706,
"p999_ms": 5.938,
"max_ms": 24.863,
"histogram": [
19694,
626,
82,
14,
3,
14,
5,
4,
5,
3,
1,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
],
"label": "vanilla-win-9800x3d-5080"
}
@@ -0,0 +1,690 @@
{
"format": "horizon-benchmark-report",
"version": 1,
"kind": "game",
"created": "2026-10-29T19:06:49Z",
"app": {
"name": "minecraft",
"version": "26.3",
"mods": [
{
"name": "fabric-loader",
"version": "0.19.5"
}
]
},
"hardware": {
"os": "windows",
"arch": "x86_64",
"cpu_threads": 16,
"os_version": "Microsoft Windows [Version 10.0.26200.8037]",
"cpu": "AMD Ryzen 7 9800X3D 8-Core Processor",
"ram_mb": 95943,
"gpu": {
"name": "NVIDIA GeForce RTX 5080/PCIe/SSE2",
"vendor": "NVIDIA Corporation",
"driver": "3.3.0 NVIDIA 617.42",
"backend": "opengl",
"kind": ""
}
},
"conditions": {
"scenario": "perf_bench:village,forest,ocean,mountain",
"seed": "1234",
"render_distance": 32,
"simulation_distance": 12,
"vsync": false,
"offscreen": false,
"repeats": 3,
"warmup_s": 2.0,
"window": [
1280,
720
]
},
"metrics": {
"startup.title_ms": {
"n": 3,
"mean": 7518.874,
"stdev": 42.968,
"min": 7469.532,
"max": 7548.049,
"ci95": 106.748
},
"startup.world_ms": {
"n": 3,
"mean": 35424.207,
"stdev": 144.711,
"min": 35318.049,
"max": 35589.041,
"ci95": 359.511
},
"chunks.village.load_ms": {
"n": 3,
"mean": 11146.828,
"stdev": 49.683,
"min": 11094.798,
"max": 11193.773,
"ci95": 123.43
},
"fps.village.avg_fps": {
"n": 3,
"mean": 882.053,
"stdev": 19.433,
"min": 866.126,
"max": 903.706,
"ci95": 48.279
},
"fps.village.low_1pct_fps": {
"n": 3,
"mean": 183.995,
"stdev": 4.924,
"min": 178.512,
"max": 188.041,
"ci95": 12.234
},
"fps.village.low_01pct_fps": {
"n": 3,
"mean": 83.193,
"stdev": 6.797,
"min": 77.734,
"max": 90.806,
"ci95": 16.886
},
"chunks.forest.load_ms": {
"n": 3,
"mean": 18184.002,
"stdev": 266.879,
"min": 17880.667,
"max": 18382.735,
"ci95": 663.017
},
"fps.forest.avg_fps": {
"n": 3,
"mean": 1202.907,
"stdev": 20.426,
"min": 1179.9,
"max": 1218.906,
"ci95": 50.744
},
"fps.forest.low_1pct_fps": {
"n": 3,
"mean": 228.139,
"stdev": 5.166,
"min": 222.394,
"max": 232.401,
"ci95": 12.833
},
"fps.forest.low_01pct_fps": {
"n": 3,
"mean": 107.956,
"stdev": 4.675,
"min": 105.185,
"max": 113.354,
"ci95": 11.614
},
"chunks.ocean.load_ms": {
"n": 3,
"mean": 13146.632,
"stdev": 507.943,
"min": 12572.118,
"max": 13536.145,
"ci95": 1261.902
},
"fps.ocean.avg_fps": {
"n": 3,
"mean": 1223.169,
"stdev": 13.11,
"min": 1208.837,
"max": 1234.556,
"ci95": 32.569
},
"fps.ocean.low_1pct_fps": {
"n": 3,
"mean": 236.27,
"stdev": 6.77,
"min": 228.686,
"max": 241.702,
"ci95": 16.818
},
"fps.ocean.low_01pct_fps": {
"n": 3,
"mean": 99.089,
"stdev": 8.354,
"min": 91.897,
"max": 108.253,
"ci95": 20.755
},
"chunks.mountain.load_ms": {
"n": 3,
"mean": 41846.641,
"stdev": 661.649,
"min": 41435.666,
"max": 42609.895,
"ci95": 1643.76
},
"fps.mountain.avg_fps": {
"n": 3,
"mean": 815.008,
"stdev": 24.644,
"min": 797.565,
"max": 843.201,
"ci95": 61.224
},
"fps.mountain.low_1pct_fps": {
"n": 3,
"mean": 55.371,
"stdev": 5.128,
"min": 50.389,
"max": 60.633,
"ci95": 12.739
},
"fps.mountain.low_01pct_fps": {
"n": 3,
"mean": 7.966,
"stdev": 1.103,
"min": 6.848,
"max": 9.053,
"ci95": 2.74
},
"memory.rss_peak_mb": {
"n": 3,
"mean": 2892.492,
"stdev": 29.54,
"min": 2859.574,
"max": 2916.691,
"ci95": 73.387
},
"memory.rss_steady_mb": {
"n": 3,
"mean": 2799.159,
"stdev": 12.256,
"min": 2786.234,
"max": 2810.613,
"ci95": 30.447
}
},
"frames": [
{
"phase": "village",
"repeat": 0,
"frames": 10845,
"seconds": 12.001,
"avg_fps": 903.706,
"low_1pct_fps": 185.432,
"low_01pct_fps": 81.039,
"p50_ms": 0.98,
"p95_ms": 1.708,
"p99_ms": 3.082,
"p999_ms": 9.304,
"max_ms": 15.487,
"histogram": [
6030,
4403,
297,
49,
25,
16,
8,
2,
6,
2,
4,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "village",
"repeat": 1,
"frames": 10516,
"seconds": 12.0,
"avg_fps": 876.328,
"low_1pct_fps": 188.041,
"low_01pct_fps": 90.806,
"p50_ms": 1.012,
"p95_ms": 1.806,
"p99_ms": 3.354,
"p999_ms": 8.714,
"max_ms": 14.39,
"histogram": [
4927,
5158,
292,
70,
33,
13,
6,
5,
6,
2,
3,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "village",
"repeat": 2,
"frames": 10394,
"seconds": 12.001,
"avg_fps": 866.126,
"low_1pct_fps": 178.512,
"low_01pct_fps": 77.734,
"p50_ms": 1.026,
"p95_ms": 1.789,
"p99_ms": 3.399,
"p999_ms": 10.6,
"max_ms": 15.389,
"histogram": [
4437,
5552,
273,
65,
18,
28,
8,
1,
1,
3,
5,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "forest",
"repeat": 0,
"frames": 14519,
"seconds": 12.0,
"avg_fps": 1209.916,
"low_1pct_fps": 232.401,
"low_01pct_fps": 105.185,
"p50_ms": 0.726,
"p95_ms": 1.306,
"p99_ms": 2.25,
"p999_ms": 7.033,
"max_ms": 13.303,
"histogram": [
13121,
1197,
103,
36,
24,
19,
4,
3,
8,
2,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "forest",
"repeat": 1,
"frames": 14159,
"seconds": 12.0,
"avg_fps": 1179.9,
"low_1pct_fps": 222.394,
"low_01pct_fps": 105.33,
"p50_ms": 0.732,
"p95_ms": 1.366,
"p99_ms": 2.499,
"p999_ms": 8.061,
"max_ms": 11.797,
"histogram": [
12501,
1356,
195,
45,
25,
14,
6,
3,
9,
5,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "forest",
"repeat": 2,
"frames": 14627,
"seconds": 12.0,
"avg_fps": 1218.906,
"low_1pct_fps": 229.622,
"low_01pct_fps": 113.354,
"p50_ms": 0.713,
"p95_ms": 1.292,
"p99_ms": 2.317,
"p999_ms": 7.136,
"max_ms": 12.041,
"histogram": [
13194,
1224,
97,
47,
27,
21,
2,
6,
6,
2,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "ocean",
"repeat": 0,
"frames": 14714,
"seconds": 12.001,
"avg_fps": 1226.113,
"low_1pct_fps": 238.423,
"low_01pct_fps": 97.117,
"p50_ms": 0.722,
"p95_ms": 1.223,
"p99_ms": 2.243,
"p999_ms": 7.032,
"max_ms": 13.21,
"histogram": [
13490,
1027,
115,
29,
18,
13,
7,
3,
3,
5,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "ocean",
"repeat": 1,
"frames": 14507,
"seconds": 12.001,
"avg_fps": 1208.837,
"low_1pct_fps": 228.686,
"low_01pct_fps": 91.897,
"p50_ms": 0.719,
"p95_ms": 1.256,
"p99_ms": 2.354,
"p999_ms": 7.473,
"max_ms": 15.432,
"histogram": [
13124,
1112,
180,
35,
23,
9,
8,
4,
2,
6,
2,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "ocean",
"repeat": 2,
"frames": 14815,
"seconds": 12.0,
"avg_fps": 1234.556,
"low_1pct_fps": 241.702,
"low_01pct_fps": 108.253,
"p50_ms": 0.721,
"p95_ms": 1.2,
"p99_ms": 2.197,
"p999_ms": 6.689,
"max_ms": 12.791,
"histogram": [
13565,
1055,
107,
29,
23,
15,
8,
3,
4,
5,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "mountain",
"repeat": 0,
"frames": 10119,
"seconds": 12.001,
"avg_fps": 843.201,
"low_1pct_fps": 60.633,
"low_01pct_fps": 9.053,
"p50_ms": 0.891,
"p95_ms": 1.845,
"p99_ms": 3.91,
"p999_ms": 8.209,
"max_ms": 316.409,
"histogram": [
6956,
2747,
240,
83,
45,
22,
8,
8,
5,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0
]
},
{
"phase": "mountain",
"repeat": 1,
"frames": 9693,
"seconds": 12.052,
"avg_fps": 804.258,
"low_1pct_fps": 50.389,
"low_01pct_fps": 6.848,
"p50_ms": 0.906,
"p95_ms": 1.924,
"p99_ms": 4.157,
"p999_ms": 8.578,
"max_ms": 297.695,
"histogram": [
6578,
2678,
248,
94,
45,
18,
16,
5,
4,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
5,
0,
0
]
},
{
"phase": "mountain",
"repeat": 2,
"frames": 9571,
"seconds": 12.0,
"avg_fps": 797.565,
"low_1pct_fps": 55.09,
"low_01pct_fps": 7.997,
"p50_ms": 0.929,
"p95_ms": 1.944,
"p99_ms": 4.495,
"p999_ms": 7.764,
"max_ms": 321.994,
"histogram": [
5954,
3172,
230,
103,
39,
34,
19,
11,
4,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
0,
0
]
}
],
"label": "vanilla-win-9800x3d-5080"
}
@@ -0,0 +1,690 @@
{
"format": "horizon-benchmark-report",
"version": 1,
"kind": "game",
"created": "2026-10-29T18:43:17Z",
"app": {
"name": "minecraft",
"version": "26.3",
"mods": [
{
"name": "fabric-loader",
"version": "0.19.5"
}
]
},
"hardware": {
"os": "windows",
"arch": "x86_64",
"cpu_threads": 16,
"os_version": "Microsoft Windows [Version 10.0.26200.8037]",
"cpu": "AMD Ryzen 7 9800X3D 8-Core Processor",
"ram_mb": 95943,
"gpu": {
"name": "NVIDIA GeForce RTX 5080/PCIe/SSE2",
"vendor": "NVIDIA Corporation",
"driver": "3.3.0 NVIDIA 617.42",
"backend": "opengl",
"kind": ""
}
},
"conditions": {
"scenario": "perf_bench:village,forest,ocean,mountain",
"seed": "1234",
"render_distance": 8,
"simulation_distance": 12,
"vsync": false,
"offscreen": false,
"repeats": 3,
"warmup_s": 2.0,
"window": [
1280,
720
]
},
"metrics": {
"startup.title_ms": {
"n": 3,
"mean": 7676.526,
"stdev": 305.763,
"min": 7426.024,
"max": 8017.247,
"ci95": 759.617
},
"startup.world_ms": {
"n": 3,
"mean": 13862.526,
"stdev": 284.577,
"min": 13569.024,
"max": 14137.247,
"ci95": 706.985
},
"chunks.village.load_ms": {
"n": 3,
"mean": 3808.014,
"stdev": 61.275,
"min": 3737.989,
"max": 3851.799,
"ci95": 152.227
},
"fps.village.avg_fps": {
"n": 3,
"mean": 2216.576,
"stdev": 45.247,
"min": 2166.285,
"max": 2253.985,
"ci95": 112.409
},
"fps.village.low_1pct_fps": {
"n": 3,
"mean": 545.307,
"stdev": 14.876,
"min": 528.15,
"max": 554.607,
"ci95": 36.957
},
"fps.village.low_01pct_fps": {
"n": 3,
"mean": 215.412,
"stdev": 5.692,
"min": 209.522,
"max": 220.882,
"ci95": 14.14
},
"chunks.forest.load_ms": {
"n": 3,
"mean": 3212.958,
"stdev": 151.722,
"min": 3076.655,
"max": 3376.428,
"ci95": 376.928
},
"fps.forest.avg_fps": {
"n": 3,
"mean": 2456.542,
"stdev": 336.369,
"min": 2068.162,
"max": 2654.549,
"ci95": 835.654
},
"fps.forest.low_1pct_fps": {
"n": 3,
"mean": 624.759,
"stdev": 90.0,
"min": 521.303,
"max": 685.008,
"ci95": 223.59
},
"fps.forest.low_01pct_fps": {
"n": 3,
"mean": 252.469,
"stdev": 21.044,
"min": 229.228,
"max": 270.233,
"ci95": 52.28
},
"chunks.ocean.load_ms": {
"n": 3,
"mean": 2983.236,
"stdev": 168.416,
"min": 2788.777,
"max": 3082.249,
"ci95": 418.403
},
"fps.ocean.avg_fps": {
"n": 3,
"mean": 2469.831,
"stdev": 333.258,
"min": 2085.121,
"max": 2669.9,
"ci95": 827.925
},
"fps.ocean.low_1pct_fps": {
"n": 3,
"mean": 688.684,
"stdev": 96.943,
"min": 576.803,
"max": 747.759,
"ci95": 240.839
},
"fps.ocean.low_01pct_fps": {
"n": 3,
"mean": 286.444,
"stdev": 21.36,
"min": 262.183,
"max": 302.422,
"ci95": 53.066
},
"chunks.mountain.load_ms": {
"n": 3,
"mean": 6079.869,
"stdev": 719.864,
"min": 5542.196,
"max": 6897.69,
"ci95": 1788.385
},
"fps.mountain.avg_fps": {
"n": 3,
"mean": 2605.12,
"stdev": 326.424,
"min": 2228.824,
"max": 2812.075,
"ci95": 810.948
},
"fps.mountain.low_1pct_fps": {
"n": 3,
"mean": 699.63,
"stdev": 87.846,
"min": 599.44,
"max": 763.45,
"ci95": 218.239
},
"fps.mountain.low_01pct_fps": {
"n": 3,
"mean": 264.461,
"stdev": 28.459,
"min": 239.602,
"max": 295.503,
"ci95": 70.701
},
"memory.rss_peak_mb": {
"n": 3,
"mean": 2120.426,
"stdev": 116.406,
"min": 2046.93,
"max": 2254.637,
"ci95": 289.191
},
"memory.rss_steady_mb": {
"n": 3,
"mean": 1912.642,
"stdev": 38.925,
"min": 1889.766,
"max": 1957.586,
"ci95": 96.702
}
},
"frames": [
{
"phase": "village",
"repeat": 0,
"frames": 27048,
"seconds": 12.0,
"avg_fps": 2253.985,
"low_1pct_fps": 553.164,
"low_01pct_fps": 215.833,
"p50_ms": 0.412,
"p95_ms": 0.617,
"p99_ms": 1.187,
"p999_ms": 2.238,
"max_ms": 9.792,
"histogram": [
26716,
296,
15,
4,
7,
5,
2,
2,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "village",
"repeat": 1,
"frames": 26754,
"seconds": 12.0,
"avg_fps": 2229.458,
"low_1pct_fps": 554.607,
"low_01pct_fps": 220.882,
"p50_ms": 0.417,
"p95_ms": 0.626,
"p99_ms": 1.212,
"p999_ms": 2.448,
"max_ms": 8.388,
"histogram": [
26423,
293,
16,
9,
4,
5,
1,
1,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "village",
"repeat": 2,
"frames": 25996,
"seconds": 12.0,
"avg_fps": 2166.285,
"low_1pct_fps": 528.15,
"low_01pct_fps": 209.522,
"p50_ms": 0.43,
"p95_ms": 0.662,
"p99_ms": 1.308,
"p999_ms": 2.477,
"max_ms": 11.033,
"histogram": [
25615,
338,
23,
5,
5,
5,
2,
2,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "forest",
"repeat": 0,
"frames": 31855,
"seconds": 12.0,
"avg_fps": 2654.549,
"low_1pct_fps": 667.966,
"low_01pct_fps": 257.945,
"p50_ms": 0.341,
"p95_ms": 0.519,
"p99_ms": 0.932,
"p999_ms": 1.761,
"max_ms": 10.944,
"histogram": [
31558,
275,
6,
2,
7,
0,
4,
2,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "forest",
"repeat": 1,
"frames": 31763,
"seconds": 12.0,
"avg_fps": 2646.916,
"low_1pct_fps": 685.008,
"low_01pct_fps": 270.233,
"p50_ms": 0.344,
"p95_ms": 0.52,
"p99_ms": 0.94,
"p999_ms": 1.685,
"max_ms": 11.406,
"histogram": [
31474,
272,
3,
4,
2,
2,
1,
3,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "forest",
"repeat": 2,
"frames": 24818,
"seconds": 12.0,
"avg_fps": 2068.162,
"low_1pct_fps": 521.303,
"low_01pct_fps": 229.228,
"p50_ms": 0.439,
"p95_ms": 0.767,
"p99_ms": 1.284,
"p999_ms": 2.351,
"max_ms": 11.468,
"histogram": [
24356,
410,
36,
4,
4,
3,
2,
2,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "ocean",
"repeat": 0,
"frames": 32039,
"seconds": 12.0,
"avg_fps": 2669.9,
"low_1pct_fps": 741.491,
"low_01pct_fps": 294.727,
"p50_ms": 0.345,
"p95_ms": 0.501,
"p99_ms": 0.86,
"p999_ms": 1.431,
"max_ms": 9.257,
"histogram": [
31771,
250,
3,
2,
4,
6,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "ocean",
"repeat": 1,
"frames": 31854,
"seconds": 12.0,
"avg_fps": 2654.471,
"low_1pct_fps": 747.759,
"low_01pct_fps": 302.422,
"p50_ms": 0.347,
"p95_ms": 0.503,
"p99_ms": 0.853,
"p999_ms": 1.404,
"max_ms": 13.925,
"histogram": [
31580,
261,
3,
2,
0,
1,
3,
3,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "ocean",
"repeat": 2,
"frames": 25022,
"seconds": 12.0,
"avg_fps": 2085.121,
"low_1pct_fps": 576.803,
"low_01pct_fps": 262.183,
"p50_ms": 0.428,
"p95_ms": 0.758,
"p99_ms": 1.214,
"p999_ms": 2.109,
"max_ms": 9.206,
"histogram": [
24600,
390,
20,
3,
2,
3,
2,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "mountain",
"repeat": 0,
"frames": 33745,
"seconds": 12.0,
"avg_fps": 2812.075,
"low_1pct_fps": 736.0,
"low_01pct_fps": 258.279,
"p50_ms": 0.327,
"p95_ms": 0.471,
"p99_ms": 0.808,
"p999_ms": 1.689,
"max_ms": 10.07,
"histogram": [
33516,
205,
7,
0,
7,
4,
3,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "mountain",
"repeat": 1,
"frames": 33294,
"seconds": 12.0,
"avg_fps": 2774.461,
"low_1pct_fps": 763.45,
"low_01pct_fps": 295.503,
"p50_ms": 0.334,
"p95_ms": 0.471,
"p99_ms": 0.813,
"p999_ms": 1.63,
"max_ms": 8.512,
"histogram": [
33056,
221,
3,
5,
1,
2,
3,
2,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
},
{
"phase": "mountain",
"repeat": 2,
"frames": 26747,
"seconds": 12.0,
"avg_fps": 2228.824,
"low_1pct_fps": 599.44,
"low_01pct_fps": 239.602,
"p50_ms": 0.403,
"p95_ms": 0.678,
"p99_ms": 1.107,
"p999_ms": 2.054,
"max_ms": 9.178,
"histogram": [
26418,
298,
13,
6,
2,
8,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
],
"label": "vanilla-win-9800x3d-5080"
}
@@ -0,0 +1,106 @@
# Horizon v0.2.97 vs vanilla 26.3 on Windows 11: Ryzen 7 9800X3D + RTX 5080 (2026-10-29, RD 8 and 32 rerun 2026-10-30)
The first `tools/perf_bench.py` run on Windows ([docs/benchmark.md](../../docs/benchmark.md)): Horizon, vanilla 26.3 and
vanilla with performance mods, render distances 8, 16 and 32, 1280x720, three games each, every game from a fresh
world. The reports are the `*-win-9800x3d-5080-rd*.json` files next to this page.
```sh
python tools/perf_bench.py --table horizon-win-9800x3d-5080 vanilla-win-9800x3d-5080 vanilla-mods-win-9800x3d-5080
```
## Setup
- **Machine:** AMD Ryzen 7 9800X3D (8 cores, 16 threads), 94 GB RAM (DDR5, EXPO off), NVIDIA GeForce RTX 5080
(driver 617.42), Windows 11 Pro 26200, Balanced power plan, desktop. One 1920x1080 120 Hz display. The game windows
were on the desktop of an unlocked session.
- **Horizon:** release v0.2.97 as the launcher installs it (`--build %APPDATA%\horizon-launcher\versions\v0.2.97`,
`--resources` its `.local\horizon-client\26.3`), Vulkan.
- **Vanilla:** the 26.3 client jar with Fabric Loader 0.19.5 and the driver mod, Java 25.0.5 (Temurin), `-Xmx2G`
with the launcher's G1 flags and the manifest's `-XX:StackShadowPages=32`, OpenGL 3.3.
- **Vanilla + mods:** the same with Sodium mc26.3-0.9.2, Lithium mc26.3-0.26.2, FerriteCore 9.0.0 and
ImmediatelyFast 1.17.1 (`tools/benchmark-deps/mods.lock.json`).
- **Commands:** `python tools/perf_bench.py --game <game> --label <game>-win-9800x3d-5080 --distances <d>
--sizes 1280x720 --repeats 3` (plus `--build` and `--resources` for Horizon), with the games taking turns at
each distance.
- **Memory** is the working set on Windows (what Task Manager shows), sampled from outside the process. Horizon's
GPU figure is its own Vulkan allocator total. `nvidia-smi` gives no per-process figure under WDDM, so vanilla has
none.
## Load
Windows has no load average, so the reports have no `load_avg_1m`. Every game ran on an otherwise idle machine:
- **RD 8 and RD 32** (rerun on 2026-10-30, after the first pass had builds running alongside): a script started each
game only once no `rustc`, `cargo`, `link` (or other compiler) process and no other game (`horizon-client`, `java`,
`javaw`, Minecraft) was running, and the machine's CPU load had stayed under 15 % in every 5-second sample for
30 seconds. During each game it sampled every 2 seconds the machine's CPU load and the CPU of everything outside the
benchmark's own processes. A game during which a compiler or another game ran, or other processes used over 15 % of
the machine for 10 seconds, was discarded and run again: two of the 20 games were (vanilla + mods at RD 32, a
build started during one, background processes during the other).
- **RD 16** (2026-10-29): no `rustc`, `cargo` or `link` process at any point, the load logged every 5 seconds.
| Game | RD | Mean / max CPU load (machine, the game included) | Other processes' CPU, mean / max | Compiler processes |
|---|---|---|---|---|
| Horizon | 8 | 18 % / 49 % | 6 % / 12 % | 0 |
| Vanilla | 8 | 28 % / 75 % | 7 % / 20 % | 0 |
| Vanilla + mods | 8 | 30 % / 81 % | 7 % / 20 % | 0 |
| Horizon | 16 | 29 % / 80 % | – | 0 |
| Vanilla | 16 | 41 % / 91 % | – | 0 |
| Vanilla + mods | 16 | 51 % / 90 % | – | 0 |
| Horizon | 32 | 36 % / 100 % | 5 % / 15 % | 0 |
| Vanilla | 32 | 39 % / 73 % | 6 % / 18 % | 0 |
| Vanilla + mods | 32 | 42 % / 88 % | 6 % / 21 % | 0 |
"Other processes" is the machine's load minus the benchmark's own processes (the game and `perf_bench.py`), in
2-second samples. Most of it is the system's share of the game's own drawing (the graphics driver and the
compositor), which no process of the benchmark is charged for; the desktop apps left open (a browser, chat apps)
briefly reached 5 % at most. RD 16's load was logged from outside every 5 seconds, so it has no such split, and its mean includes the time between
games. Compared with the first pass, the idle RD 8 runs give Horizon about 10 % higher averages and about 50 % higher
1% lows, and vanilla up to 10 % higher averages.
## Results
Mean of 3 games ± 95% confidence interval. FPS over the 12-second flight at 16 blocks/s (average / 1% low /
0.1% low):
| RD | scene | Horizon v0.2.97 | Vanilla 26.3 | Vanilla + mods |
| --- | --- | --- | --- | --- |
| 8 | forest | 3495 ±276 / 1295 ±397 / 859 ±298 | 2457 ±836 / 625 ±224 / 252 ±52 | 2425 ±65 / 733 ±30 / 250 ±22 |
| 8 | mountain | 3376 ±67 / 1384 ±168 / 850 ±256 | 2605 ±811 / 700 ±218 / 264 ±71 | 2538 ±167 / 760 ±34 / 241 ±44 |
| 8 | ocean | 3346 ±147 / 1358 ±237 / 912 ±235 | 2470 ±828 / 689 ±241 / 286 ±53 | 2432 ±82 / 764 ±37 / 262 ±37 |
| 8 | village | 2942 ±197 / 1271 ±146 / 839 ±94 | 2217 ±112 / 545 ±37 / 215 ±14 | 2104 ±101 / 577 ±84 / 196 ±47 |
| 16 | forest | 2424 ±138 / 709 ±165 / 401 ±100 | 1912 ±324 / 402 ±89 / 149 ±25 | 1746 ±32 / 461 ±27 / 179 ±9 |
| 16 | mountain | 1961 ±99 / 537 ±96 / 297 ±75 | 1653 ±153 / 332 ±27 / 113 ±8 | 1500 ±55 / 408 ±40 / 140 ±10 |
| 16 | ocean | 2201 ±183 / 554 ±251 / 325 ±326 | 1861 ±289 / 446 ±142 / 165 ±29 | 1815 ±119 / 514 ±142 / 192 ±58 |
| 16 | village | 1712 ±192 / 593 ±80 / 358 ±69 | 1218 ±65 / 318 ±16 / 127 ±5 | 1282 ±162 / 343 ±25 / 132 ±12 |
| 32 | forest | 1389 ±70 / 504 ±33 / 330 ±118 | 1203 ±51 / 228 ±13 / 108 ±12 | 929 ±8 / 313 ±41 / 129 ±32 |
| 32 | mountain | 1086 ±34 / 258 ±78 / 108 ±37 | 815 ±61 / 55 ±13 / 8 ±3 | 645 ±10 / 166 ±12 / 86 ±21 |
| 32 | ocean | 1189 ±27 / 155 ±9 / 68 ±8 | 1223 ±33 / 236 ±17 / 99 ±21 | 1017 ±14 / 325 ±38 / 117 ±28 |
| 32 | village | 1164 ±9 / 416 ±39 / 216 ±86 | 882 ±48 / 184 ±12 / 83 ±17 | 926 ±17 / 250 ±5 / 93 ±11 |
Startup, loading and memory (means of 3 games):
| RD | | Horizon v0.2.97 | Vanilla 26.3 | Vanilla + mods |
| --- | --- | --- | --- | --- |
| 8 | start to title / in-world | 3.0 s / 6.1 s | 7.7 s / 13.9 s | 11.1 s / 17.6 s |
| 8 | mean scene load | 1.3 s | 4.0 s | 3.6 s |
| 8 | working set, steady / peak | 1082 / 1172 MB | 1913 / 2120 MB | 1904 / 2053 MB |
| 16 | start to title / in-world | 3.2 s / 7.2 s | 7.7 s / 19.9 s | 10.8 s / 23.5 s |
| 16 | mean scene load | 2.4 s | 9.2 s | 9.0 s |
| 16 | working set, steady / peak | 1236 / 1459 MB | 2300 / 2540 MB | 2327 / 2496 MB |
| 32 | start to title / in-world | 2.9 s / 10.5 s | 7.5 s / 35.4 s | 11.0 s / 39.2 s |
| 32 | mean scene load | 5.7 s | 21.1 s | 19.9 s |
| 32 | working set, steady / peak | 1730 / 2045 MB | 2799 / 2892 MB | 2895 / 2965 MB |
## What it shows
- At RD 8 and 16, Horizon's average FPS is 18–42 % above vanilla's in every scene. Its 1% lows are 1.2–2.3 times
vanilla's and its 0.1% lows 2.0–3.9 times. On this CPU and GPU the performance mods leave vanilla's averages
level or slightly lower, and raise its 1% lows by 6–23 %.
- At RD 32, Horizon's average is 15–33 % above vanilla's over the forest, the mountain and the village, with 1% lows
2.2–4.7 times vanilla's. Over the ocean its average is level with vanilla's, but its lows are lower than vanilla's
and the modded client's (155 vs 236 and 325 FPS 1% low, 68 vs 99 and 117 FPS 0.1% low), on an idle machine too.
That scene is worth a closer look.
- Horizon reaches the title screen 2.4–2.6 times faster than vanilla (3.4–3.8 times faster than the modded client)
and loads a scene's chunks 3–4 times faster. Its steady working set is 38–46 % smaller.
- Each game uses its own graphics API: Horizon Vulkan, vanilla OpenGL. That difference is part of what's compared.
+2 -2
View File
@@ -4,10 +4,10 @@ version = "0.1.0"
edition.workspace = true
license.workspace = true
rust-version = "1.86"
description = "cargo horizon-mod new/build/run/check: make Horizon mods in Rust (docs/mods.md)"
description = "cargo horizon-mod new/build/run/check: make Horizon content mods (docs/mods.md)"
[dependencies]
horizon-mods = { path = "../horizon-mods", default-features = false, features = ["pack", "runtime", "index"] }
horizon-mods = { path = "../horizon-mods", default-features = false, features = ["index"] }
serde_json = "1.0.151"
[lints]
+18 -167
View File
@@ -1,35 +1,19 @@
//! `cargo horizon-mod check <file>`: what the registry checks of a submission,
//! run anywhere: its kind's own checks (docs/api/mod-index.md), its signature
//! when given a key, and for a mod a trial run in the sandbox: it must start,
//! survive ticks, frames, a chat line and each of its commands (a server mod:
//! a player joining, chatting, typing them and leaving), and import no more
//! than its capabilities.
//! when given a key, and for a `.hmod` that it is content only.
use horizon_mods::{
Clock, GameMode, Mods, Output, Package, Player, ServerPlayer, Snapshot, Status,
Package,
index::{self, Facts, Kind},
manifest::component_imports,
};
use serde_json::{Value, json};
use std::path::Path;
/// How long the trial run plays: two seconds of game.
const TICKS: u64 = 40;
const FRAMES_PER_TICK: u64 = 3;
pub struct Report {
pub kind: Kind,
pub facts: Facts,
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<String>,
/// A mod's commands, each run once.
pub commands: Vec<String>,
/// What the mod showed during the trial run.
pub output: Vec<String>,
}
impl Report {
@@ -53,10 +37,6 @@ impl Report {
"sha256": self.sha256,
"size": self.size,
"signed": self.signed,
"code": self.code,
"imports": self.imports,
"commands": self.commands,
"output": self.output,
})
}
@@ -100,18 +80,8 @@ impl Report {
if self.kind == Kind::NativeMod {
out += " native source: unsandboxed; not executed by the registry check. Compile and test against the exact pinned Horizon and Mixins revisions before review.\n";
}
if self.kind == Kind::Mod && !self.code {
if self.kind == Kind::Mod {
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 {
format!(", /{}", self.commands.join(", /"))
};
out += &format!(
" trial run: started, {TICKS} ticks, {} frames, a chat line{commands}: ok\n",
TICKS * FRAMES_PER_TICK
);
}
out
}
@@ -153,145 +123,26 @@ pub fn check(
(None, None) => false,
_ => return Err("--key and --signature go together".into()),
};
let mut report = Report {
if kind == Kind::Mod {
content_only(path)?;
}
Ok(Report {
kind,
facts,
sha256: index::sha256_file(path)?,
size,
signed,
code: false,
imports: Vec::new(),
commands: Vec::new(),
output: Vec::new(),
};
if report.kind == Kind::Mod {
trial_run(path, &mut report)?;
}
Ok(report)
})
}
/// Runs a mod in the sandbox, as the game does, from a scratch copy so its
/// 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 Some(wasm) = package.wasm.as_deref() else {
return Ok(());
};
report.code = true;
report.imports = component_imports(wasm)?;
package
.manifest
.check_imports(report.imports.iter().map(String::as_str))?;
let dir = std::env::temp_dir().join(format!("horizon-mod-check-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
std::fs::create_dir_all(&dir).map_err(|e| e.to_string())?;
let copy = dir.join("mod.hmod");
let result = std::fs::copy(path, &copy)
.map_err(|e| e.to_string())
.and_then(|_| play(&copy, report));
let _ = std::fs::remove_dir_all(&dir);
result
}
fn play(path: &Path, report: &mut Report) -> Result<(), String> {
let mut mods = Mods::load(&[path.to_path_buf()], |_| true, |_| false);
let failed = |mods: &Mods| match &mods.entries()[0].status {
Status::Failed(reason) => Some(reason.clone()),
_ => None,
};
if let Some(reason) = failed(&mods) {
return Err(format!("it didn't start: {reason}"));
}
let client: Vec<String> = mods.commands().map(str::to_owned).collect();
let server: Vec<String> = mods.server_commands().map(|c| c.name.clone()).collect();
report.commands = [client.clone(), server.clone()].concat();
// A server mod plays with one player on, who joins, chats and leaves.
let steve = ServerPlayer {
id: "00000000-0000-4000-8000-000000000001".into(),
name: "Steve".into(),
x: 0.5,
y: 64.0,
z: 0.5,
dimension: "minecraft:overworld".into(),
game_mode: GameMode::Survival,
health: 20.0,
};
let snapshot = |t: u64| Snapshot {
player: Some(Player {
x: 0.5 + t as f64 * 0.1,
y: 64.0,
z: 0.5,
yaw: 90.0,
pitch: 0.0,
health: 20.0,
food: 20,
dimension: "minecraft:overworld".into(),
}),
clock: Some(Clock {
game_time: t,
day_time: 1000 + t,
}),
players: vec![steve.clone()],
// The GUI of a 1280 x 720 window at scale 3.
gui_size: (427.0, 240.0),
..Snapshot::default()
};
mods.set_snapshot(snapshot(0));
mods.player_joined(&steve);
for t in 0..TICKS {
mods.set_snapshot(snapshot(t));
mods.tick(t);
mods.server_tick(t);
for _ in 0..FRAMES_PER_TICK {
mods.frame(1.0 / 60.0);
}
}
mods.chat("<Steve> hello");
mods.player_chat(&steve, "hello");
for name in &client {
mods.command(name);
}
for name in &server {
mods.server_command(&steve, name);
}
mods.set_snapshot(Snapshot::default());
mods.player_left(&steve);
for out in mods.drain() {
report.output.push(match out {
Output::Chat { text, .. } => format!("chat: {text}"),
Output::Tell { text, .. } => format!("tell: {text}"),
Output::Broadcast { text, .. } => format!("broadcast: {text}"),
Output::Feedback { text, error } | Output::Reply { text, error, .. } => {
format!("{}: {text}", if error { "error" } else { "feedback" })
}
Output::Command { line } => format!("command: /{line}"),
Output::QuietCommands { lines, .. } => {
format!("{} quiet command(s)", lines.len())
}
Output::Stopped { reason, .. } => return Err(format!("it stopped: {reason}")),
Output::SetBlocks {
dimension, blocks, ..
} => {
format!("set {} block(s) in {dimension}", blocks.len())
}
Output::OpenScreen { .. } => "opened a screen".to_string(),
Output::CloseScreen { .. } => "closed its screen".to_string(),
Output::PlaceRecipe { book_id, all } => {
format!("placed recipe {book_id}{}", if all { " (all)" } else { "" })
}
Output::Give { item, count, .. } => format!("gave {count} {item}"),
Output::Shake { strength, seconds } => {
format!("shook the camera: {strength:.2} for {seconds:.1} s")
}
});
}
let shapes = mods.hud_shapes().count();
if shapes > 0 {
report.output.push(format!("drew {shapes} HUD shape(s)"));
}
match failed(&mods) {
Some(reason) => Err(format!("it stopped: {reason}")),
/// A mod is content only: WebAssembly code mods don't run any more, code mods are native
/// (`.hnmod`, docs/native-mods.md). `inspect` already read its content as the game does.
fn content_only(path: &Path) -> Result<(), String> {
match Package::read(path)?.wasm {
Some(_) => Err(
"it has WebAssembly code, which Horizon doesn't run any more: make it a native mod (docs/native-mods.md)"
.into(),
),
None => Ok(()),
}
}
@@ -316,7 +167,7 @@ mod tests {
.text()
.contains("cozy 1.0.0 (modpack, format 1, for 26.3)")
);
// The fixture mod's code is a stand-in: its manifest reads, its run fails.
// A mod with WebAssembly code is refused: code mods are native.
let hmod = fixture("coords_hud-0.1.0.hmod");
let key = std::fs::read_to_string(fixture("test.pub")).unwrap();
let sig = std::fs::read_to_string(fixture("coords_hud-0.1.0.hmod.minisig")).unwrap();
@@ -324,7 +175,7 @@ mod tests {
let e = check(&hmod, Kind::Mod, Some(key), Some(&sig))
.err()
.unwrap();
assert!(e.contains("didn't start"), "{e}");
assert!(e.contains("native mod"), "{e}");
let e = check(
&hmod,
Kind::Mod,
+38 -196
View File
@@ -1,32 +1,23 @@
//! `cargo horizon-mod`: make Horizon mods in Rust (`docs/mods.md`).
//! `cargo horizon-mod`: make Horizon content mods (`docs/modpacks.md`): blocks,
//! items, data and assets, no code. Code mods are native (docs/native-mods.md).
//!
//! - `new <path> [--template code|content] [--name "Name"] [--sdk-path <dir>]`:
//! 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.
//! - `new <path> [--name "Name"]`: a content mod from the template.
//! - `build`: the `.hmod` in `target/horizon-mod/`, with the mod's `assets/`
//! and `data/`.
//! - `run [--game <horizon-client>] [-- <game args>]`: build, then play with
//! the mod; run `build` again and the game reloads it.
//! - `test [--debug] [--hmod <file>] [<name>]`: build, then run the mod's
//! `tests/*.toml` scripts in the sandbox, with no game.
//! the mod.
//! - `check <file> [--json]`: what the registry checks of a submission
//! (`.hmod`, `.hpack`, resource pack `.zip`), with a trial run for a mod.
//! (`.hmod`, `.hnmod`, `.hpack`, resource pack `.zip`, `.hshader`).
//! - `registry build|review|check|list`: the registry repository's CI.
use horizon_mods::{
Capability, Content, Manifest, Package,
manifest::{MANIFEST, component_imports, componentize},
testing::{Script, TestGame},
};
use horizon_mods::{Capability, Content, Manifest, Package, manifest::MANIFEST};
mod check;
mod registry;
use std::{
path::{Path, PathBuf},
process::{Command, ExitCode, Stdio},
process::{Command, ExitCode},
};
const TARGET: &str = "wasm32-unknown-unknown";
const SDK_GIT: &str = "{ git = \"https://github.com/horizon-rust/horizon\" }";
fn main() -> ExitCode {
// Cargo runs `cargo-horizon-mod horizon-mod <args>`.
let mut args: Vec<String> = std::env::args().skip(1).collect();
@@ -35,14 +26,13 @@ fn main() -> ExitCode {
}
let result = match args.first().map(String::as_str) {
Some("new") => new(&args[1..]),
Some("build") => build(!args.iter().any(|a| a == "--debug")).map(|p| {
Some("build") => build().map(|p| {
println!("Built {}", p.display());
}),
Some("run") => run(&args[1..]),
Some("test") => test(&args[1..]),
Some("check") => check(&args[1..]),
Some("registry") => registry::main(&args[1..]),
_ => Err("usage: cargo horizon-mod new <path> [--template code|content] | build [--debug] | run [--game <horizon-client>] [-- <game args>] | test [--debug] [--hmod <file>] [<name>] | check <file> [--kind <kind>] [--key <public key> --signature <file.minisig>] [--json] | registry build|review|check|list".into()),
_ => Err("usage: cargo horizon-mod new <path> [--name \"Name\"] | build | run [--game <horizon-client>] [-- <game args>] | check <file> [--kind <kind>] [--key <public key> --signature <file.minisig>] [--json] | registry build|review|check|list".into()),
};
match result {
Ok(()) => ExitCode::SUCCESS,
@@ -83,31 +73,9 @@ fn new(args: &[String]) -> Result<(), String> {
})
.collect();
let name = flag(args, "--name").map_or_else(|| base.replace(['-', '_'], " "), str::to_string);
let sdk = match flag(args, "--sdk-path") {
Some(p) => {
let p = std::fs::canonicalize(p).map_err(|e| format!("--sdk-path {p}: {e}"))?;
format!("{{ path = {:?} }}", p.display().to_string())
}
None => SDK_GIT.to_string(),
};
let fill = |t: &str| {
t.replace("{crate}", &id.replace('_', "-"))
.replace("{id}", &id)
.replace("{name}", &name)
.replace("{sdk}", &sdk)
};
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")),
(
"tests/hello.toml",
include_str!("../template/tests/hello.toml"),
),
];
let fill = |t: &str| t.replace("{id}", &id).replace("{name}", &name);
// A block copying a vanilla one, with its model, name, loot, recipe and tag.
let content = [
let files = [
(
MANIFEST,
include_str!("../template/content/horizon-mod.toml"),
@@ -146,12 +114,12 @@ fn new(args: &[String]) -> Result<(), String> {
),
(".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 {
if flag(args, "--template").is_some_and(|t| t != "content") {
return Err(
"only content mods are made here: code mods are native (docs/native-mods.md)".into(),
);
}
for (file, text) in files {
let file = fill(file);
let file = file.as_str();
let to = dir.join(file);
@@ -169,29 +137,24 @@ fn new(args: &[String]) -> Result<(), String> {
Ok(())
}
/// Builds the mod in the current folder and packs `target/horizon-mod/<id>.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<PathBuf, String> {
build_in(Path::new("."), release)
/// Packs the content mod in the current folder into `target/horizon-mod/<id>.hmod`: the
/// manifest and the files in `assets/` and `data/`.
fn build() -> Result<PathBuf, String> {
build_in(Path::new("."))
}
fn build_in(root: &Path, release: bool) -> Result<PathBuf, String> {
fn build_in(root: &Path) -> Result<PathBuf, String> {
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 {
if root.join("Cargo.toml").exists() {
return Err("a Cargo.toml: code mods are native now (docs/native-mods.md)".into());
}
if !manifest.capabilities.contains(&Capability::Registries) {
return Err(format!(
"no Cargo.toml: only a content mod (capability registries in {MANIFEST}) has no code"
"a content mod has capability registries in {MANIFEST}"
));
};
}
// 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()?;
@@ -200,53 +163,17 @@ fn build_in(root: &Path, release: bool) -> Result<PathBuf, String> {
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");
let dir = root.join("target/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)?;
let bytes = Package::write_files(&manifest_text, None, &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<u8>, PathBuf), String> {
let cargo = std::env::var("CARGO").unwrap_or_else(|_| "cargo".into());
let mut cmd = Command::new(cargo);
cmd.current_dir(root).args([
"build",
"--lib",
"--target",
TARGET,
"--message-format=json-render-diagnostics",
]);
if release {
cmd.arg("--release");
}
let out = cmd
.stderr(Stdio::inherit())
.output()
.map_err(|e| e.to_string())?;
if !out.status.success() {
return Err(format!(
"cargo build failed (is the target installed? rustup target add {TARGET})"
));
}
let core = String::from_utf8_lossy(&out.stdout)
.lines()
.filter_map(|l| serde_json::from_str::<serde_json::Value>(l).ok())
.filter(|m| m["reason"] == "compiler-artifact")
.flat_map(|m| m["filenames"].as_array().cloned().unwrap_or_default())
.filter_map(|f| f.as_str().map(PathBuf::from))
.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())?)?;
let target = core.ancestors().nth(3).ok_or("unexpected target folder")?;
Ok((wasm, target.to_path_buf()))
}
/// `check <file>`: the registry's checks of a submission, printed; fails
/// when one does.
fn check(args: &[String]) -> Result<(), String> {
@@ -278,74 +205,14 @@ fn check(args: &[String]) -> Result<(), String> {
Ok(())
}
/// `test`: every `tests/*.toml` script (those whose name holds `<name>`)
/// against the built mod, or the `.hmod` given with `--hmod`.
fn test(args: &[String]) -> Result<(), String> {
let hmod = match flag(args, "--hmod") {
Some(p) => PathBuf::from(p),
None => build(!args.iter().any(|a| a == "--debug"))?,
};
let filter = args
.iter()
.enumerate()
.find(|(i, a)| !a.starts_with("--") && (*i == 0 || args[i - 1] != "--hmod"))
.map(|(_, a)| a.as_str());
let mut scripts: Vec<PathBuf> = std::fs::read_dir("tests")
.map_err(|e| {
format!(
"tests/: {e} (a mod's tests are tests/<name>.toml: docs/mods.md, \"Testing a mod\")"
)
})?
.filter_map(|e| Some(e.ok()?.path()))
.filter(|p| p.extension().is_some_and(|e| e == "toml"))
.filter(|p| filter.is_none_or(|f| p.to_string_lossy().contains(f)))
.collect();
scripts.sort();
if scripts.is_empty() {
return Err("no tests/*.toml to run".into());
}
println!(
"running {} scripts against {}",
scripts.len(),
hmod.display()
);
let mut failed = 0;
for path in &scripts {
let result = std::fs::read_to_string(path)
.map_err(|e| e.to_string())
.and_then(|text| Script::parse(&text))
.and_then(|script| {
let mut game = TestGame::load(&hmod)?;
script.run(&mut game)?;
Ok(script.steps.len())
});
match result {
Ok(steps) => println!("test {} ... ok ({steps} steps)", path.display()),
Err(e) => {
failed += 1;
println!("test {} ... FAILED\n {e}", path.display());
}
}
}
let passed = scripts.len() - failed;
if failed > 0 {
return Err(format!("{failed} failed, {passed} passed"));
}
println!("test result: ok. {passed} passed");
Ok(())
}
fn run(args: &[String]) -> Result<(), String> {
let path = build(true)?;
let path = build()?;
let game = flag(args, "--game")
.map(str::to_string)
.or_else(|| std::env::var("HORIZON_CLIENT").ok())
.unwrap_or_else(|| "horizon-client".into());
let extra = args.iter().skip_while(|a| *a != "--").skip(1);
println!(
"Starting {game} with {} (rebuild with `cargo horizon-mod build` to reload it)",
path.display()
);
println!("Starting {game} with {}", path.display());
let status = Command::new(&game)
.arg("--dev-mod")
.arg(&path)
@@ -364,28 +231,6 @@ fn run(args: &[String]) -> Result<(), String> {
mod tests {
use super::*;
#[test]
fn the_template_is_a_valid_mod() {
let dir = std::env::temp_dir().join(format!("horizon-mod-new-{}", std::process::id()));
let path = dir.join("My-Mod");
new(&[path.display().to_string(), "--name".into(), "My Mod".into()]).unwrap();
let manifest =
Manifest::parse(&std::fs::read_to_string(path.join(MANIFEST)).unwrap()).unwrap();
assert_eq!(
(manifest.id.as_str(), manifest.name.as_str()),
("my_mod", "My Mod")
);
let cargo = std::fs::read_to_string(path.join("Cargo.toml")).unwrap();
assert!(cargo.contains("name = \"my-mod\"") && cargo.contains(SDK_GIT));
let script = std::fs::read_to_string(path.join("tests/hello.toml")).unwrap();
assert_eq!(Script::parse(&script).unwrap().steps.len(), 3);
assert!(
new(&[path.display().to_string()]).is_err(),
"never overwrites"
);
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()));
@@ -397,7 +242,7 @@ mod tests {
];
new(&new_args).unwrap();
assert!(!path.join("Cargo.toml").exists());
let hmod = build_in(&path, true).unwrap();
let hmod = build_in(&path).unwrap();
assert_eq!(hmod, path.join("target/horizon-mod/gems.hmod"));
let package = Package::read(&hmod).unwrap();
assert!(package.wasm.is_none());
@@ -409,17 +254,14 @@ mod tests {
);
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"));
// Code is native now.
std::fs::write(path.join("Cargo.toml"), "").unwrap();
assert!(build_in(&path).unwrap_err().contains("native"));
assert!(
new(&[
dir.join("x").display().to_string(),
@@ -1,14 +0,0 @@
[package]
name = "{crate}"
version = "0.1.0"
edition = "2024"
[lib]
crate-type = ["cdylib"]
[dependencies]
horizon-mod-sdk = {sdk}
[profile.release]
opt-level = "s"
lto = true
@@ -1,12 +0,0 @@
id = "{id}"
name = "{name}"
version = "0.1.0"
description = ""
authors = []
# The Horizon mod API the SDK targets.
api = "0.1"
# client: runs in the player's game.
side = "client"
# What the mod may do, shown to players before they turn it on:
# game-read (position, health, time), chat (show messages), hud (draw text).
capabilities = ["chat"]
@@ -1,19 +0,0 @@
use horizon_mod_sdk::{Mod, Registration, chat};
struct MyMod {
greeted: u32,
}
impl Mod for MyMod {
fn init() -> Result<(Self, Registration), String> {
Ok((MyMod { greeted: 0 }, Registration::new().command("hello")))
}
fn command(&mut self, _name: &str, args: &str) -> Result<Option<String>, String> {
self.greeted += 1;
chat::show(&format!("Hello {args}! ({} so far)", self.greeted));
Ok(None)
}
}
horizon_mod_sdk::export_mod!(MyMod);
@@ -1,14 +0,0 @@
# `cargo horizon-mod test` runs every tests/*.toml against the built mod, with no game:
# steps happen in order, and `expect` checks what the mod showed during the step.
# Every key: docs/mods.md, "Testing a mod".
[[step]]
expect.commands = ["hello"]
[[step]]
command = "hello world"
expect.chat = ["Hello world! (1 so far)"]
[[step]]
command = "hello again"
expect.chat = ["Hello again! (2 so far)"]
+328 -11
View File
@@ -21,18 +21,19 @@ use horizon_protocol::{
connection::{ConnWriter, Connection},
crypto::offline_uuid,
ids,
item::Stack,
packets::{
Empty, configuration,
handshake::{self, Intention},
login::{self, ServerHello},
play,
play, recipes,
},
};
use serde_json::json;
use std::{
collections::HashSet,
sync::{
Arc, Mutex,
Arc, LazyLock, Mutex,
atomic::{AtomicBool, AtomicU64, Ordering},
},
thread,
@@ -44,29 +45,71 @@ horizon-bots: load-test bots for a Minecraft Java Edition 26.3 server (offline m
--server HOST:PORT default 127.0.0.1:25565
--bots N default 10
--behaviour B idle, walk, explore or mixed (60 % walk, 20 % explore, 20 % idle); default mixed
--behaviour B idle, walk, explore or mixed (60 % walk, 20 % explore, 20 % idle); default mixed.
stand: stays on the ground where the server puts it (/tp), for a survival test.
One abusive client, to test a server's limits (run it beside a normal crowd):
flood-move (--flood moves a tick, each 64 to 256 blocks away, ignoring chunks),
flood-acks (--flood chunk batch acks asking for 64 chunks a tick, while exploring),
flood-packets (--flood rotations a tick),
flood-chunks (one move a tick, 9.9 blocks straight ahead: as fast as the
moved-too-quickly check allows, never waiting for chunks),
and --flood a tick of packets that cost the server work:
flood-use (place and break stone around itself), flood-click (inventory
clicks with a stale state), flood-suggest (command suggestions, every
other one 30 000 characters long), flood-book (100 pages of 1024 characters
into a writable book), flood-sign (four 384-character lines on the block
below), flood-recipe (recipe book placements)
--flood N packets a tick for the flood behaviours; default 100
--attack NAME attack the player NAME twice a second, from wherever the bot is (a reach test);
the report gives each bot's last health
--attack-after S start attacking S seconds after joining; default 5
--no-read stop reading from the server once spawned (a client that lets the
server's replies pile up)
--join-every SECONDS default 1
--seconds N how long to run after the first bot joins; default 60
--view-distance N what the bots ask for; default 10
--seed N default 12345
--explore-speed B blocks a second an explore bot flies; default 22 (as fast as chunks come)
--name PREFIX bot names: PREFIX0, PREFIX1...; default Bot
--brand B the client brand sent in configuration (minecraft:brand); default none
--report FILE a JSON summary at the end (- prints it after the per-second lines)
";
#[derive(Clone, Copy, Debug, PartialEq)]
enum Behaviour {
Idle,
Stand,
Walk,
Explore,
FloodMove,
FloodAcks,
FloodPackets,
FloodChunks,
FloodUse,
FloodClick,
FloodSuggest,
FloodBook,
FloodSign,
FloodRecipe,
}
impl Behaviour {
fn name(self) -> &'static str {
match self {
Self::Idle => "idle",
Self::Stand => "stand",
Self::Walk => "walk",
Self::Explore => "explore",
Self::FloodMove => "flood-move",
Self::FloodAcks => "flood-acks",
Self::FloodPackets => "flood-packets",
Self::FloodChunks => "flood-chunks",
Self::FloodUse => "flood-use",
Self::FloodClick => "flood-click",
Self::FloodSuggest => "flood-suggest",
Self::FloodBook => "flood-book",
Self::FloodSign => "flood-sign",
Self::FloodRecipe => "flood-recipe",
}
}
}
@@ -81,7 +124,14 @@ struct Options {
view_distance: i8,
seed: u64,
explore_speed: f64,
/// The player to attack, and how long after joining to start.
attack: Option<String>,
attack_after: f64,
flood: usize,
no_read: bool,
name: String,
/// The `minecraft:brand` to send, if any.
brand: Option<String>,
report: Option<String>,
}
@@ -96,8 +146,13 @@ fn options() -> Result<Options, String> {
view_distance: 10,
seed: 12345,
explore_speed: 22.0,
attack: None,
attack_after: 5.0,
flood: 100,
no_read: false,
name: "Bot".into(),
report: None,
brand: None,
};
let mut args = std::env::args().skip(1);
while let Some(arg) = args.next() {
@@ -105,6 +160,10 @@ fn options() -> Result<Options, String> {
print!("{HELP}");
std::process::exit(0);
}
if arg == "--no-read" {
o.no_read = true;
continue;
}
let value = args.next().ok_or(format!("{arg} needs a value"))?;
let number = |what: &str| format!("{arg} needs {what}, not {value:?}");
match arg.as_str() {
@@ -122,14 +181,35 @@ fn options() -> Result<Options, String> {
"--explore-speed" => {
o.explore_speed = value.parse().map_err(|_| number("blocks a second"))?;
}
"--flood" => o.flood = value.parse().map_err(|_| number("packets a tick"))?,
"--attack" => o.attack = Some(value),
"--attack-after" => o.attack_after = value.parse().map_err(|_| number("seconds"))?,
"--name" => o.name = value,
"--report" => o.report = Some(value),
"--brand" => o.brand = Some(value),
_ => return Err(format!("unknown option {arg}; --help lists them")),
}
}
if !["idle", "walk", "explore", "mixed"].contains(&o.behaviour.as_str()) {
const BEHAVIOURS: [&str; 15] = [
"idle",
"walk",
"explore",
"mixed",
"stand",
"flood-move",
"flood-acks",
"flood-packets",
"flood-chunks",
"flood-use",
"flood-click",
"flood-suggest",
"flood-book",
"flood-sign",
"flood-recipe",
];
if !BEHAVIOURS.contains(&o.behaviour.as_str()) {
return Err(format!(
"--behaviour {}: use idle, walk, explore or mixed",
"--behaviour {}: use idle, walk, explore, mixed or a flood behaviour (--help lists them)",
o.behaviour
));
}
@@ -156,6 +236,13 @@ struct Bot {
teleport: Mutex<Option<[f64; 3]>>,
error: Mutex<Option<String>>,
joined_after_ms: AtomicU64,
/// The bot stopped reading (--no-read).
deaf: AtomicBool,
/// `--attack`: the target's UUID and, once AddEntity showed it, its entity id.
target: Mutex<(Option<u128>, Option<i32>)>,
attacks: AtomicU64,
/// The last SetHealth.
health: Mutex<Option<f32>>,
}
/// A small deterministic generator (SplitMix64), so every run moves the bots the same way.
@@ -185,6 +272,89 @@ fn raw(id: i32, write: impl FnOnce(&mut Writer)) -> Vec<u8> {
w.data
}
/// Item ids of the pinned version (26.3's item registry).
const STONE: i32 = 1;
const WRITABLE_BOOK: i32 = 1371;
/// The `i`th packet of a costly flood this tick, the bot at `pos`; none for other behaviours.
fn costly(
behaviour: Behaviour,
i: usize,
sequence: i32,
pos: [f64; 3],
random: &mut Random,
) -> Option<Vec<u8>> {
use ids::play::serverbound as sb;
static LONG_COMMAND: LazyLock<String> =
LazyLock::new(|| format!("/msg {}", "x".repeat(30_000)));
static BOOK: LazyLock<Vec<u8>> = LazyLock::new(|| {
play::Serverbound::EditBook(play::EditBook {
slot: 0,
pages: vec!["a".repeat(1024); 100],
title: None,
})
.encode()
});
let block = pos.map(|v| v.floor() as i32);
let packet = match behaviour {
Behaviour::FloodUse => {
// A block within reach: place stone there, or break what is there.
let at = [0, 1, 2].map(|k| block[k] + (random.unit() * 7.0) as i32 - 3);
if i % 2 == 0 {
play::Serverbound::UseItemOn(play::UseItemOn {
hand: 0,
pos: at,
face: 1,
cursor: [0.5, 1.0, 0.5],
inside: false,
world_border: false,
sequence,
})
} else {
play::Serverbound::PlayerAction(play::PlayerAction {
action: 0,
pos: at,
direction: 1,
sequence,
})
}
}
Behaviour::FloodClick => play::Serverbound::ContainerClick(play::ContainerClick {
container: 0,
state: 0,
slot: 36 + (i % 9) as i16,
button: 0,
input: 0,
changed: Vec::new(),
carried: None,
}),
Behaviour::FloodSuggest => {
let text = if i % 2 == 0 {
"/"
} else {
LONG_COMMAND.as_str()
};
return Some(raw(sb::COMMAND_SUGGESTION, |w| {
w.varint(sequence);
w.string(text);
}));
}
Behaviour::FloodBook => return Some(BOOK.clone()),
Behaviour::FloodSign => play::Serverbound::SignUpdate(play::SignUpdate {
pos: [block[0], block[1] - 1, block[2]],
lines: std::array::from_fn(|_| "a".repeat(384)),
front: true,
}),
Behaviour::FloodRecipe => play::Serverbound::PlaceRecipe(recipes::PlaceRecipe {
container: 0,
recipe: (i % 2042) as i32,
use_max: true,
}),
_ => return None,
};
Some(packet.encode())
}
fn err(e: impl std::fmt::Display) -> String {
e.to_string()
}
@@ -252,6 +422,19 @@ fn join(o: &Options, name: &str) -> Result<Connection, String> {
.encode(),
)
.map_err(err)?;
// ClientBrandRetriever: vanilla's client says "vanilla", Horizon's "horizon".
if let Some(brand) = &o.brand {
let mut w = Writer::new();
w.string(brand);
c.send(
&configuration::Serverbound::CustomPayload(configuration::CustomPayload {
channel: "minecraft:brand".into(),
data: w.data,
})
.encode(),
)
.map_err(err)?;
}
loop {
let (id, body) = c.recv().map_err(err)?;
let reply = match id {
@@ -279,8 +462,9 @@ fn join(o: &Options, name: &str) -> Result<Connection, String> {
payload: None,
})
}
configuration::Clientbound::Disconnect(_) => {
return Err("disconnected during configuration".into());
configuration::Clientbound::Disconnect(p) => {
let reason = horizon_protocol::text::plain(&p.reason, &Default::default());
return Err(format!("disconnected during configuration: {reason}"));
}
configuration::Clientbound::FinishConfiguration(_) => {
c.send(&configuration::Serverbound::FinishConfiguration(Empty).encode())
@@ -339,6 +523,12 @@ fn read(
let mut batch = BatchSize::new();
let mut teleports = 0u64;
loop {
if bot.deaf.load(Ordering::Relaxed) {
while bot.online.load(Ordering::SeqCst) {
thread::sleep(Duration::from_millis(100));
}
return;
}
let (id, body) = match reader.recv() {
Ok(packet) => packet,
Err(e) => {
@@ -379,6 +569,21 @@ fn read(
}
Ok(())
}
cb::ADD_ENTITY => {
if let Ok(play::Clientbound::AddEntity(p)) = play::Clientbound::decode(id, &body) {
let mut target = lock(&bot.target);
if target.0 == Some(p.uuid) {
target.1 = Some(p.id);
}
}
Ok(())
}
cb::SET_HEALTH => {
if let Ok(play::Clientbound::SetHealth(p)) = play::Clientbound::decode(id, &body) {
*lock(&bot.health) = Some(p.health);
}
Ok(())
}
cb::CHUNK_BATCH_START => {
batch.started = Instant::now();
Ok(())
@@ -466,6 +671,7 @@ fn run_bot(
};
let (reader, writer) = connection.split();
let writer = Arc::new(Mutex::new(writer));
lock(&bot.target).0 = o.attack.as_deref().map(offline_uuid);
bot.online.store(true, Ordering::SeqCst);
{
let (writer, bot) = (writer.clone(), bot.clone());
@@ -489,12 +695,31 @@ fn run_bot(
.store(asked.elapsed().as_millis() as u64, Ordering::SeqCst);
let send = |body: Vec<u8>| lock(&writer).send(&body).is_ok();
send(raw(sb::PLAYER_LOADED, |_| {}));
bot.deaf.store(o.no_read, Ordering::Relaxed);
// What the costly floods need in hand (creative: the server takes the bot's word for it).
let tool = match behaviour {
Behaviour::FloodUse => Some(Stack::new(STONE, 64)),
Behaviour::FloodBook => Some(Stack::new(WRITABLE_BOOK, 1)),
_ => None,
};
if tool.is_some() {
send(
play::Serverbound::SetCreativeModeSlot(play::SetCreativeModeSlot {
slot: 36,
item: tool,
})
.encode(),
);
send(play::Serverbound::SetCarriedItem(play::SetCarriedItem { slot: 0 }).encode());
}
let mut sequence = 0;
let mut random = Random(o.seed ^ (index as u64).wrapping_mul(0x2545_F491_4F6C_DD1D));
let mut pos = spawn;
let cruise = spawn[1] + 24.0;
let heading = random.unit() * std::f64::consts::TAU;
let mut target = pos;
let mut next = Instant::now();
let (joined, mut tick) = (Instant::now(), 0u64);
loop {
if lock(&until).is_some_and(|u| Instant::now() >= u) || !bot.online.load(Ordering::SeqCst) {
break;
@@ -504,13 +729,46 @@ fn run_bot(
pos = at;
}
let here = ((pos[0].floor() as i32) >> 4, (pos[2].floor() as i32) >> 4);
if !lock(&bot.held).contains(&here) {
// The abusive client doesn't wait for its chunk, as a real client must.
if behaviour == Behaviour::Stand {
// Where the server put it, on the ground.
} else if behaviour == Behaviour::FloodMove {
// The last of these moves goes out below, with the tick's end.
pos[1] = cruise;
for _ in 1..o.flood.max(1) {
let angle = random.unit() * std::f64::consts::TAU;
let reach = 64.0 + random.unit() * 192.0;
pos[0] += angle.cos() * reach;
pos[2] += angle.sin() * reach;
send(
play::Serverbound::MovePlayerPos(play::MovePlayerPos {
x: pos[0],
y: pos[1],
z: pos[2],
flags: 0,
})
.encode(),
);
}
let angle = random.unit() * std::f64::consts::TAU;
pos[0] += angle.cos() * 128.0;
pos[2] += angle.sin() * 128.0;
} else if behaviour == Behaviour::FloodChunks {
// Up to cruising height first, then just under the server's 10 blocks a tick:
// every tick asks for new chunks.
if pos[1] < cruise {
pos[1] = (pos[1] + 0.5).min(cruise);
} else {
pos[0] += heading.cos() * 9.9;
pos[2] += heading.sin() * 9.9;
}
} else if !lock(&bot.held).contains(&here) {
bot.waited.fetch_add(1, Ordering::Relaxed);
} else if pos[1] < cruise {
pos[1] = (pos[1] + 0.5).min(cruise);
} else {
match behaviour {
Behaviour::Idle => {}
Behaviour::Idle | Behaviour::Stand => {}
Behaviour::Walk => {
let (dx, dz) = (target[0] - pos[0], target[2] - pos[2]);
let distance = dx.hypot(dz);
@@ -529,7 +787,37 @@ fn run_bot(
pos[2] += dz / distance * step;
}
}
Behaviour::Explore => {
Behaviour::FloodMove
| Behaviour::FloodChunks
| Behaviour::FloodUse
| Behaviour::FloodClick
| Behaviour::FloodSuggest
| Behaviour::FloodBook
| Behaviour::FloodSign
| Behaviour::FloodRecipe => {}
Behaviour::FloodPackets => {
for i in 0..o.flood {
send(
play::Serverbound::MovePlayerRot(play::MovePlayerRot {
yaw: (i % 360) as f32,
pitch: 0.0,
flags: 0,
})
.encode(),
);
}
}
Behaviour::FloodAcks | Behaviour::Explore => {
if behaviour == Behaviour::FloodAcks {
for _ in 0..o.flood {
send(
play::Serverbound::ChunkBatchReceived(play::ChunkBatchReceived {
chunks_per_tick: 64.0,
})
.encode(),
);
}
}
// Flying in creative, by default about 22 blocks a second, which keeps new
// chunks coming as fast as the server sends them.
let step = o.explore_speed / 20.0;
@@ -538,12 +826,28 @@ fn run_bot(
}
}
}
// The costly floods go out wherever the bot is, chunks or not (--no-read gets none).
for i in 0..o.flood {
sequence += 1;
if let Some(body) = costly(behaviour, i, sequence, pos, &mut random) {
send(body);
}
}
let target = lock(&bot.target).1;
if let Some(id) = target
&& joined.elapsed().as_secs_f64() >= o.attack_after
&& tick % 10 == 0
{
send(play::Serverbound::Attack(play::Attack { id }).encode());
bot.attacks.fetch_add(1, Ordering::Relaxed);
}
tick += 1;
let ok = send(
play::Serverbound::MovePlayerPos(play::MovePlayerPos {
x: pos[0],
y: pos[1],
z: pos[2],
flags: 0,
flags: u8::from(behaviour == Behaviour::Stand),
})
.encode(),
) && send(raw(sb::CLIENT_TICK_END, |_| {}));
@@ -567,8 +871,19 @@ fn run_bot(
fn behaviour_of(mode: &str, index: usize) -> Behaviour {
match mode {
"idle" => Behaviour::Idle,
"stand" => Behaviour::Stand,
"walk" => Behaviour::Walk,
"explore" => Behaviour::Explore,
"flood-move" => Behaviour::FloodMove,
"flood-acks" => Behaviour::FloodAcks,
"flood-packets" => Behaviour::FloodPackets,
"flood-chunks" => Behaviour::FloodChunks,
"flood-use" => Behaviour::FloodUse,
"flood-click" => Behaviour::FloodClick,
"flood-suggest" => Behaviour::FloodSuggest,
"flood-book" => Behaviour::FloodBook,
"flood-sign" => Behaviour::FloodSign,
"flood-recipe" => Behaviour::FloodRecipe,
// mixed: of every five bots, three walk, one explores, one stands.
_ => match index % 5 {
0 | 2 | 4 => Behaviour::Walk,
@@ -670,6 +985,8 @@ fn main() {
"pulled_back": b.pulled_back.load(Ordering::Relaxed),
"waited_ticks": b.waited.load(Ordering::Relaxed),
"error": *lock(&b.error),
"attacks": b.attacks.load(Ordering::Relaxed),
"health": *lock(&b.health),
})).collect::<Vec<_>>(),
});
if o.report.as_deref() == Some("-") {
@@ -494,7 +494,11 @@ pub fn canonical(tag: &Tag) -> Option<Tag> {
_ => string("minecraft:air"),
},
);
f.put("facing", Tag::Int(int(tag.get("facing")).unwrap_or(0)));
// Direction.LEGACY_ID_CODEC: the 3D data value as a byte.
f.put(
"facing",
Tag::Byte(int(tag.get("facing")).unwrap_or(0) as i8),
);
f.float("progress", 0.0);
f.flag("extending", false);
f.flag("source", false);
@@ -873,6 +877,23 @@ mod tests {
);
}
/// `PistonMovingBlockEntity.saveAdditional`: `facing` through
/// `Direction.LEGACY_ID_CODEC` (a byte), `progress` a float.
#[test]
fn moving_piston_fields_match_vanilla() {
let out = canon(
"{id:\"minecraft:piston\",x:1,y:2,z:3,blockState:{Name:\"minecraft:stone\"},\
facing:5,progress:0.5f,extending:1b,source:0b}",
);
assert_eq!(out.get("facing"), Some(&Tag::Byte(5)));
assert_eq!(out.get("progress"), Some(&f32_tag(0.5)));
assert_eq!(out.get("extending"), Some(&Tag::Byte(1)));
assert_eq!(out.get("source"), Some(&Tag::Byte(0)));
let fresh = canon("{id:\"minecraft:piston\",x:1,y:2,z:3}");
assert_eq!(fresh.get("facing"), Some(&Tag::Byte(0)));
assert_eq!(fresh.get("blockState"), Some(&string("minecraft:air")));
}
#[test]
fn loot_table_replaces_items_and_zero_seed_is_omitted() {
let out = canon(
+44 -1
View File
@@ -195,6 +195,7 @@ fn object_style(o: &serde_json::Map<String, Value>) -> Style {
.and_then(|h| u32::from_str_radix(h, 16).ok())
});
}
style.shadow_color = o.get("shadow_color").and_then(shadow_color);
let flag = |k: &str| o.get(k).and_then(Value::as_bool);
style.bold = flag("bold");
style.italic = flag("italic");
@@ -236,7 +237,7 @@ fn object_style(o: &serde_json::Map<String, Value>) -> Style {
_ => None,
};
}
// HoverEvent.ShowText and ShowItem.
// HoverEvent.ShowText, ShowItem and ShowEntity.
if let Some(e) = o.get("hover_event").and_then(Value::as_object) {
match e.get("action").and_then(Value::as_str) {
Some("show_text") => {
@@ -247,6 +248,9 @@ fn object_style(o: &serde_json::Map<String, Value>) -> Style {
Some("show_item") if e.get("id").is_some_and(Value::is_string) => {
style.hover_item = Some(Box::new(Value::Object(e.clone())));
}
Some("show_entity") if e.get("id").is_some_and(Value::is_string) => {
style.hover_entity = Some(Box::new(Value::Object(e.clone())));
}
_ => {}
}
}
@@ -256,6 +260,28 @@ fn object_style(o: &serde_json::Map<String, Value>) -> Style {
.map(str::to_owned);
style
}
/// `Style.shadow_color`: a packed ARGB int or normalized RGBA array.
pub(crate) fn shadow_color(value: &Value) -> Option<u32> {
if let Some(packed) = value.as_i64() {
return i32::try_from(packed).ok().map(|n| n as u32);
}
let rgba = value.as_array()?;
if rgba.len() != 4 {
return None;
}
let channels = rgba
.iter()
.map(|channel| {
// ExtraCodecs.ARGB_COLOR_CODEC reads floats; ARGB.as8BitChannel
// floors each normalized channel multiplied by 255.
let value = channel.as_f64()? as f32;
(value.is_finite() && (0.0..=1.0).contains(&value))
.then_some((value * 255.0_f32).floor() as u32)
})
.collect::<Option<Vec<_>>>()?;
Some(channels[3] << 24 | channels[0] << 16 | channels[1] << 8 | channels[2])
}
/// `ComponentSerialization.CODEC` decoding into text. `selector` components
/// are resolved by `resolve` (ComponentUtils.updateForEntity).
pub fn to_text(v: &Value, resolve: &mut dyn FnMut(&str) -> Text) -> Text {
@@ -417,6 +443,23 @@ pub fn name_text(tag: &Tag) -> Text {
mod tests {
use super::*;
#[test]
fn shadow_color_accepts_packed_and_rgba_styles() {
let packed = serde_json::json!({"text": "A", "shadow_color": -16711936});
let text = to_text(&packed, &mut |_| Text::empty());
assert_eq!(text.spans[0].style.shadow_color, Some(0xff00ff00));
assert_eq!(text.component()["shadow_color"], -16711936);
let rgba = serde_json::json!({"text": "A", "shadow_color": [1, 0, 0.5, 1]});
let text = to_text(&rgba, &mut |_| Text::empty());
assert_eq!(text.spans[0].style.shadow_color, Some(0xffff007f));
let translucent = serde_json::json!({"text": "A", "shadow_color": [1, 0, 0.5, 0.5]});
let text = to_text(&translucent, &mut |_| Text::empty());
assert_eq!(text.spans[0].style.shadow_color, Some(0x7fff007f));
let no_shadow = serde_json::json!({"text": "A", "shadow_color": 0});
let text = to_text(&no_shadow, &mut |_| Text::empty());
assert_eq!(text.spans[0].style.shadow_color, Some(0));
}
#[test]
fn player_object_survives_text_parsing_and_keeps_its_siblings() {
let component = serde_json::json!({
+13
View File
@@ -60,6 +60,9 @@ impl ResourceSource for Bundled {
"assets/horizon/lang/ru_ru.json" => {
include_str!("../../horizon-client/assets/horizon/lang/ru_ru.json")
}
"assets/horizon/lang/pl_pl.json" => {
include_str!("../../horizon-client/assets/horizon/lang/pl_pl.json")
}
"assets/horizon/lang/uk_ua.json" => {
include_str!("../../horizon-client/assets/horizon/lang/uk_ua.json")
}
@@ -269,6 +272,16 @@ mod tests {
assert_eq!(en.get("horizon.options.controller"), Some("Controller"));
let ru = Language::load(&[&empty], "ru_ru");
assert_eq!(ru.get("horizon.options.controller"), Some("Геймпад"));
// Every bundled string carries both languages: a key added to one file
// and forgotten in the other shows as a key name on screen.
for key in en.map().keys() {
assert!(ru.get(key).is_some(), "{key} has no ru_ru value");
}
assert_eq!(en.get("horizon.pages.mods"), Some("Mods"));
assert_eq!(ru.get("horizon.pages.mods"), Some("Моды"));
let pl = Language::load(&[&empty], "pl_pl");
assert_eq!(pl.get("horizon.options.controller"), Some("Kontroler"));
assert_eq!(pl.get("horizon.options.vibration"), Some("Wibracje"));
let uk = Language::load(&[&empty], "uk_ua");
assert_eq!(
uk.get("horizon.options.on_screen_keyboard"),
@@ -55,6 +55,12 @@ particle_types! {
Rain = "rain",
Bubble = "bubble",
SulfurBubbles = "sulfur_bubbles",
NoxiousGas = "noxious_gas",
NoxiousGasCloud = "noxious_gas_cloud",
Geyser = "geyser",
GeyserBase = "geyser_base",
GeyserPoof = "geyser_poof",
GeyserPlume = "geyser_plume",
BubblePop = "bubble_pop",
BubbleColumnUp = "bubble_column_up",
CurrentDown = "current_down",
@@ -149,6 +155,10 @@ impl ParticleType {
matches!(
self,
Self::BlockMarker
| Self::Geyser
| Self::GeyserBase
| Self::GeyserPoof
| Self::GeyserPlume
| Self::DamageIndicator
| Self::ExplosionEmitter
| Self::Explosion
@@ -191,6 +201,8 @@ impl ParticleType {
// SpellParticle.
| Self::Effect | Self::InstantEffect | Self::EntityEffect
| Self::Witch | Self::Infested | Self::TrialOmen | Self::RaidOmen
// NoxiousGasParticle.
| Self::NoxiousGas
// EmissiveRisingParticle.
| Self::Soul | Self::SculkSoul
// SculkChargeParticle, SculkChargePopParticle, ShriekParticle,
@@ -28,6 +28,10 @@ pub struct Registries {
/// Game rule name -> integer-valued.
pub game_rules: Vec<(String, bool)>,
pub players: Vec<String>,
/// `ClientSuggestionProvider.customCompletionSuggestions`: the extra chat
/// completions the server sent (ClientboundCustomChatCompletionsPacket),
/// each once.
pub custom_completions: std::collections::BTreeSet<String>,
/// Scoreboard objective names, team names and tracked score holders.
pub objectives: Vec<String>,
pub teams: Vec<String>,
@@ -87,7 +91,55 @@ pub struct RegistryIds {
pub tags: Vec<String>,
}
const EMPTY: &[String] = &[];
/// ClientboundCustomChatCompletionsPacket.Action.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CustomCompletionAction {
Add,
Remove,
Set,
}
impl CustomCompletionAction {
/// `Action.BY_ID`: `ByIdMap.continuous` with `OutOfBoundsStrategy.ZERO`,
/// so an unknown id is `ADD`.
pub fn from_id(id: i32) -> Self {
match id {
1 => Self::Remove,
2 => Self::Set,
_ => Self::Add,
}
}
}
/// `ClientSuggestionProvider.modifyCustomCompletions`: the server adds,
/// removes or replaces the extra chat completions.
pub fn modify_custom_completions(
set: &mut std::collections::BTreeSet<String>,
action: CustomCompletionAction,
entries: &[String],
) {
match action {
CustomCompletionAction::Add => set.extend(entries.iter().cloned()),
CustomCompletionAction::Remove => {
for e in entries {
set.remove(e);
}
}
CustomCompletionAction::Set => {
set.clear();
set.extend(entries.iter().cloned());
}
}
}
impl Registries {
/// `ClientSuggestionProvider.getCustomTabSuggestions`: what chat (not a
/// command) completes, the online players' names with the server's custom
/// completions, each once.
pub fn custom_tab_suggestions(&self) -> std::collections::BTreeSet<&str> {
self.players
.iter()
.chain(&self.custom_completions)
.map(String::as_str)
.collect()
}
/// Fill what the game did not build itself from vanilla's exported
/// registries (`command-registries.json`, written by
/// `VanillaCommandParseOracle registries`): built-in registries such as
@@ -112,6 +112,7 @@ pub fn style_from_json(v: &Value) -> Style {
.and_then(|h| u32::from_str_radix(h, 16).ok())
});
}
s.shadow_color = o.get("shadow_color").and_then(component::shadow_color);
let flag = |k: &str| o.get(k).and_then(Value::as_bool);
s.bold = flag("bold");
s.italic = flag("italic");
@@ -1563,3 +1564,49 @@ mod tests {
);
}
}
/// `DamageSource.getLocalizedDeathMessage`: the cause's item with a custom
/// name gets the `<id>.item` message, with the item's name as a third
/// argument.
pub fn death_message_args(
key: &str,
victim: &Text,
cause: &Text,
item: Option<&Text>,
) -> (String, Vec<Text>) {
match item {
Some(item) => (
format!("{key}.item"),
vec![victim.clone(), cause.clone(), item.clone()],
),
None => (key.to_owned(), vec![victim.clone(), cause.clone()]),
}
}
#[cfg(test)]
mod death_message_tests {
use super::*;
#[test]
fn the_death_message_names_the_causes_item_when_it_has_a_custom_name() {
let victim = Text::literal("Steve");
let cause = Text::literal("Zombie");
// DamageSource.getLocalizedDeathMessage: the item variant, with the
// item's name as the third argument.
let (key, args) = death_message_args(
"death.attack.arrow",
&victim,
&cause,
Some(&Text::literal("My Sword")),
);
assert_eq!(key, "death.attack.arrow.item");
assert_eq!(args.len(), 3);
assert_eq!(args[0].plain(), "Steve");
assert_eq!(args[1].plain(), "Zombie");
assert_eq!(args[2].plain(), "My Sword");
// Without a custom name the message keeps its two arguments.
let (key, args) = death_message_args("death.attack.arrow", &victim, &cause, None);
assert_eq!(key, "death.attack.arrow");
assert_eq!(args.len(), 2);
}
}
+18 -4
View File
@@ -84,6 +84,8 @@ impl InlineObject {
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct Style {
pub color: Option<u32>,
/// Text component `shadow_color` as packed ARGB. Zero suppresses shadows.
pub shadow_color: Option<u32>,
pub bold: Option<bool>,
pub italic: Option<bool>,
pub underlined: Option<bool>,
@@ -94,6 +96,8 @@ pub struct Style {
pub hover: Option<Box<Text>>,
/// `HoverEvent.ShowItem`: the event's `{id, count?, components?}` object.
pub hover_item: Option<Box<Value>>,
/// `HoverEvent.ShowEntity`: the event's `{id, uuid, name?}` object.
pub hover_entity: Option<Box<Value>>,
/// `Style.insertion`: the text a Shift-click puts in the chat box.
pub insertion: Option<String>,
/// The font (`FontDescription.Resource`), a full id like
@@ -116,6 +120,7 @@ impl Style {
/// Fill unset fields from `base` (Style.applyTo).
pub fn inherit(&mut self, base: &Style) {
self.color = self.color.or(base.color);
self.shadow_color = self.shadow_color.or(base.shadow_color);
self.bold = self.bold.or(base.bold);
self.italic = self.italic.or(base.italic);
self.underlined = self.underlined.or(base.underlined);
@@ -124,11 +129,12 @@ impl Style {
if self.click.is_none() {
self.click.clone_from(&base.click);
}
if self.hover.is_none() {
// One HoverEvent: its three kinds are inherited together, so a style
// with its own event never picks up another kind from `base`.
if self.hover.is_none() && self.hover_item.is_none() && self.hover_entity.is_none() {
self.hover.clone_from(&base.hover);
}
if self.hover_item.is_none() {
self.hover_item.clone_from(&base.hover_item);
self.hover_entity.clone_from(&base.hover_entity);
}
if self.insertion.is_none() {
self.insertion.clone_from(&base.insertion);
@@ -520,8 +526,9 @@ impl Text {
}
/// The style fields of a component's JSON.
const STYLE_KEYS: [&str; 10] = [
const STYLE_KEYS: [&str; 11] = [
"color",
"shadow_color",
"bold",
"italic",
"underlined",
@@ -542,6 +549,9 @@ fn style_json(style: &Style) -> Vec<(String, Value)> {
.map_or_else(|| format!("#{c:06X}"), |n| n.1.to_owned());
out.push(("color".to_owned(), name.into()));
}
if let Some(shadow) = style.shadow_color {
out.push(("shadow_color".to_owned(), Value::from(shadow as i32)));
}
for (key, flag) in [
("bold", style.bold),
("italic", style.italic),
@@ -584,6 +594,10 @@ fn style_json(style: &Style) -> Vec<(String, Value)> {
let mut event = item.clone();
event.insert("action".into(), "show_item".into());
out.push(("hover_event".to_owned(), Value::Object(event)));
} else if let Some(Value::Object(entity)) = style.hover_entity.as_deref() {
let mut event = entity.clone();
event.insert("action".into(), "show_entity".into());
out.push(("hover_event".to_owned(), Value::Object(event)));
}
if let Some(insertion) = &style.insertion {
out.push(("insertion".to_owned(), insertion.clone().into()));
@@ -13,6 +13,12 @@ pub enum Button {
}
pub trait InteractionWorld {
/// Minecraft.pick before handleKeybinds: the tick's `hitResult`, which
/// every click of the tick reads, even after one of them changed the
/// block it names (a creative break, then a use that replaces it).
fn pick_hit_result(&mut self);
/// The tick's clicks are done: later picks follow the crosshair again.
fn release_hit_result(&mut self);
fn using_item(&self) -> bool;
fn release_using(&mut self);
fn start_attack(&mut self) -> bool;
@@ -48,6 +54,7 @@ impl InteractionInput {
pub fn tick(&mut self, world: &mut impl InteractionWorld, attack_down: bool, use_down: bool) {
let [attack, use_item, pick] = std::mem::take(&mut self.clicks);
world.pick_hit_result();
let mut instant = false;
if world.using_item() {
if !use_down {
@@ -70,6 +77,7 @@ impl InteractionInput {
world.start_use();
}
world.continue_attack(!instant && attack_down);
world.release_hit_result();
}
}
@@ -86,6 +94,8 @@ mod tests {
events: Vec<&'static str>,
}
impl InteractionWorld for World {
fn pick_hit_result(&mut self) {}
fn release_hit_result(&mut self) {}
fn using_item(&self) -> bool {
self.using
}
@@ -183,4 +193,67 @@ mod tests {
input.tick(&mut world, false, false);
assert_eq!(world.events, ["release", "continue"]);
}
/// A floating block in front of the crosshair, nothing behind it, and a
/// block item in the hand of a creative player.
#[derive(Default)]
struct Column {
block: bool,
hit: Option<Option<()>>,
placed: bool,
}
impl Column {
/// Minecraft.hitResult: the tick's pick, or a fresh one outside it.
fn target(&self) -> Option<()> {
self.hit.unwrap_or(self.block.then_some(()))
}
}
impl InteractionWorld for Column {
fn pick_hit_result(&mut self) {
self.hit = Some(self.target());
}
fn release_hit_result(&mut self) {
self.hit = None;
}
fn using_item(&self) -> bool {
false
}
fn release_using(&mut self) {}
fn start_attack(&mut self) -> bool {
// MultiPlayerGameMode.startDestroyBlock in creative: the
// predicted break leaves air.
if self.target().is_some() {
self.block = false;
}
!self.block
}
fn start_use(&mut self) {
// BlockItem.place: the clicked block, now air, can be replaced.
if self.target().is_some() && !self.block {
self.block = true;
self.placed = true;
}
}
fn pick(&mut self) {}
fn use_delay(&self) -> u32 {
0
}
fn continue_attack(&mut self, _: bool) {}
}
#[test]
fn attack_and_use_in_one_tick_share_the_hit_result() {
// #3006: both buttons at once replace the block the crosshair is on.
let mut input = InteractionInput::default();
let mut world = Column {
block: true,
..Default::default()
};
input.press(Button::Attack);
input.press(Button::Use);
input.tick(&mut world, false, false);
assert!(world.placed, "the use acts on the block the attack broke");
assert!(world.block);
assert!(world.hit.is_none(), "the next pick follows the crosshair");
}
}
+23 -3
View File
@@ -192,16 +192,30 @@ impl Assets {
pub fn reload(&self, root: &Path) -> Result<RenderAssets> {
RenderAssets::load(root, self)
}
/// [`Assets::reload`] for a server, which draws nothing: the item models
/// and the sprites' layers, without the block models or the textures'
/// pixels.
pub fn reload_for_server(&self, root: &Path) -> Result<RenderAssets> {
RenderAssets::load_with(root, self, false)
}
}
impl RenderAssets {
pub fn load(root: &Path, assets: &Assets) -> Result<Self> {
Self::load_with(root, assets, true)
}
fn load_with(root: &Path, assets: &Assets, draws: bool) -> Result<Self> {
let registry = assets.registry;
let mut sprites = crate::sprites::Sprites::with_disk_cache(root);
for name in MATERIALS {
sprites.insert(root, &format!("minecraft:block/{name}"))?;
}
let parsed = crate::model_library::ParsedModels::load(root);
let models = crate::models::prepare_with_models(root, registry, &mut sprites, &parsed)?;
// A server draws no block: its models (about 24 MB baked) stay empty.
let models = if draws {
crate::models::prepare_with_models(root, registry, &mut sprites, &parsed)?
} else {
crate::models::PreparedModels::default()
};
let model_library = parsed.into_item_library();
// Fluids are drawn by the fluid renderer, not block models; breaking
// progress uses the destroy-stage overlays.
@@ -218,7 +232,11 @@ impl RenderAssets {
sprites.insert(root, &format!("minecraft:block/destroy_stage_{stage}"))?;
}
sprites.save_disk_cache();
sprites.finish();
if draws {
sprites.finish();
} else {
sprites.finish_without_pixels();
}
// `finish` grows the buffer by doubling: keep only the bytes in use.
sprites.pixels.shrink_to_fit();
Ok(Self {
@@ -241,6 +259,7 @@ impl RenderAssets {
#[cfg(test)]
mod tests {
use crate::items::ConsumeEffect;
use horizon_world::loot::PackOverlay;
#[test]
fn always_edible_and_consume_effects_loaded() {
@@ -251,7 +270,8 @@ mod tests {
}
let assets = crate::assets::Assets::load(&root).unwrap();
let facts = crate::blocks::BlockFacts::load(&root, assets.registry).unwrap();
let items = crate::items::Items::load(&root, assets.registry, &facts).unwrap();
let items =
crate::items::Items::load(&root, assets.registry, &facts, &PackOverlay::NONE).unwrap();
let apple = items.get("minecraft:golden_apple").expect("golden apple");
assert!(apple.can_always_eat);
+10
View File
@@ -165,6 +165,8 @@ pub struct Audio {
/// How many times each selection was stopped ("record *", "* minecraft:…", `*` for
/// any), with or without an audio device, as `heard`.
pub stopped: std::collections::BTreeMap<String, u32>,
/// The volume sliders' `SoundPreviewHandler`.
preview: crate::sound_preview::SoundPreview,
}
fn decode(path: &Path) -> Option<(Vec<f32>, u32)> {
use symphonia::core::{
@@ -634,6 +636,7 @@ impl Audio {
capture: None,
heard: Default::default(),
stopped: Default::default(),
preview: Default::default(),
}
}
#[cfg(not(feature = "audio"))]
@@ -817,6 +820,13 @@ impl Audio {
false,
);
}
/// `SoundPreviewHandler.preview`: a category volume slider moved to
/// `volume` on the title screen's options.
pub fn preview(&mut self, source: usize, volume: f32) {
let mut preview = std::mem::take(&mut self.preview);
preview.preview(self, source, volume);
self.preview = preview;
}
/// `play` with the seed a sound packet carries.
pub fn play_seeded(
&mut self,
+6 -6
View File
@@ -52,20 +52,20 @@ impl AuthSession {
/// The session file's JSON: {"name", "uuid", "access_token", "user_type": "msa", "xuid"}.
pub fn parse(text: &str) -> Result<Self, String> {
let v: serde_json::Value =
serde_json::from_str(text).map_err(|_| "the session file is not valid JSON")?;
serde_json::from_str(text).map_err(|_| "the session is not valid JSON")?;
let field = |k: &str| v.get(k).and_then(|s| s.as_str());
let name = field("name").ok_or("the session file has no name")?;
let name = field("name").ok_or("the session has no name")?;
if name.is_empty() || name.chars().count() > 16 {
return Err("the session file's name is not a valid player name".into());
return Err("the session's name is not a valid player name".into());
}
let uuid = field("uuid")
.and_then(parse_uuid)
.ok_or("the session file has no valid uuid")?;
.ok_or("the session has no valid uuid")?;
let access_token = field("access_token")
.filter(|t| !t.is_empty())
.ok_or("the session file has no access token")?;
.ok_or("the session has no access token")?;
if field("user_type").is_some_and(|t| t != "msa") {
return Err("the session file is not a Microsoft account session".into());
return Err("the session is not a Microsoft account session".into());
}
Ok(Self {
name: name.to_owned(),
+245 -55
View File
@@ -3,7 +3,12 @@
use crate::Result;
use horizon_core::{noise::SimplexNoise, position::BlockPos, random::LegacyRandom};
use serde_json::Value;
use std::{collections::HashMap, fs, path::Path};
use std::{
collections::{BTreeMap, HashMap},
fs,
path::Path,
sync::Arc,
};
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum GrassModifier {
@@ -102,6 +107,9 @@ pub struct BiomeInfo {
/// The biome's own fog colour attribute; otherwise the dimension's applies.
pub fog: Option<u32>,
pub water_fog: u32,
/// `BiomeGenerationSettings.features`: the placed feature ids of each
/// `GenerationStep.Decoration` step, in order.
pub features: Vec<Vec<String>>,
}
impl BiomeInfo {
/// `Biome.getHeightAdjustedTemperature`: the frozen modifier, then cooler
@@ -130,10 +138,27 @@ impl BiomeInfo {
.then(|| self.temperature_at(BlockPos::new(x, y, z), 63) < 0.15)
}
}
/// The game's biomes, by id. The built-in (vanilla) biomes come first, in
/// file order, and keep their ids whatever a world's data packs do; a pack's
/// new biomes follow them (`with_packs`). Those are the client's own ids:
/// the network registry's are `registry_order`'s.
#[derive(Clone)]
pub struct Biomes {
pub list: Vec<BiomeInfo>,
pub index: HashMap<String, u16>,
info_noise: SimplexNoise,
colormaps: Arc<Colormaps>,
/// The built-in biomes, the first of `list` unless packs replaced them.
builtin: Arc<Vec<BiomeInfo>>,
/// The data packs' biome files (new biomes and replaced built-in ones),
/// for the tables that read more of a biome than `BiomeInfo` keeps.
packs: BTreeMap<String, Arc<Value>>,
}
/// The grass, foliage and dry foliage colormaps.
struct Colormaps {
grass: Vec<u32>,
foliage: Vec<u32>,
dry: Vec<u32>,
}
fn color(v: &Value) -> Option<u32> {
match v {
@@ -166,11 +191,90 @@ fn sample(map: &[u32], temperature: f32, downfall: f32, fallback: u32) -> u32 {
let index = (y << 8 | x) as usize;
map.get(index).copied().unwrap_or(fallback)
}
impl BiomeInfo {
/// A biome file's (`worldgen/biome/<name>.json`) values, the colours it
/// leaves out sampled from the colormaps.
fn from_json(name: String, v: &Value, maps: &Colormaps) -> Self {
let effects = &v["effects"];
let attributes = &v["attributes"];
let temperature = v["temperature"].as_f64().unwrap_or(0.5) as f32;
let downfall = v["downfall"].as_f64().unwrap_or(0.5) as f32;
let modifier = match effects["grass_color_modifier"].as_str() {
Some("dark_forest") => GrassModifier::DarkForest,
Some("swamp") => GrassModifier::Swamp,
_ => GrassModifier::None,
};
let mut spawns: HashMap<String, Vec<SpawnEntry>> = HashMap::new();
let natural = &attributes["minecraft:gameplay/natural_mob_spawns"];
// A modifier object ({argument, modifier: overlay}) or the plain value;
// the overlay over the dimension's empty default is the biome's value.
let natural = if natural["argument"].is_object() {
&natural["argument"]
} else {
natural
};
let categories = &natural["spawns_by_category"];
for (category, entries) in categories.as_object().into_iter().flatten() {
let list = parse_entries(entries);
spawns.insert(category.clone(), list);
}
BiomeInfo {
spawns,
spawn_costs: parse_costs(&natural["spawn_costs"]),
creature_probability:
attributes["minecraft:gameplay/creature_world_gen_spawn_probability"]
.as_f64()
.unwrap_or(0.1) as f32,
increased_fire_burnout: attributes["minecraft:gameplay/increased_fire_burnout"]
.as_bool()
.unwrap_or(false),
temperature,
frozen: v["temperature_modifier"].as_str() == Some("frozen"),
downfall,
precipitation: v["has_precipitation"].as_bool().unwrap_or(true),
grass: color(&effects["grass_color"])
.unwrap_or_else(|| sample(&maps.grass, temperature, downfall, 0xFF00FF)),
modifier,
foliage: color(&effects["foliage_color"])
.unwrap_or_else(|| sample(&maps.foliage, temperature, downfall, 0x48B518)),
dry_foliage: color(&effects["dry_foliage_color"])
.unwrap_or_else(|| sample(&maps.dry, temperature, downfall, 0x5D4930)),
water: color(&effects["water_color"]).unwrap_or(0x3F76E4),
sky: color(&attributes["minecraft:visual/sky_color"]),
fog: color(&attributes["minecraft:visual/fog_color"]),
water_fog: color(&attributes["minecraft:visual/water_fog_color"]).unwrap_or(0x050533),
features: v["features"]
.as_array()
.into_iter()
.flatten()
.map(|step| {
step.as_array()
.into_iter()
.flatten()
.filter_map(Value::as_str)
.map(str::to_owned)
.collect()
})
.collect(),
name,
}
}
}
/// `Identifier.compareTo`: the path first, then the namespace.
pub fn identifier_order(a: &str, b: &str) -> std::cmp::Ordering {
fn split(id: &str) -> (&str, &str) {
let (ns, path) = id.split_once(':').unwrap_or(("minecraft", id));
(path, ns)
}
split(a).cmp(&split(b))
}
impl Biomes {
pub fn load(root: &Path) -> Result<Self> {
let grass = colormap(root, "grass")?;
let foliage = colormap(root, "foliage")?;
let dry = colormap(root, "dry_foliage")?;
let maps = Colormaps {
grass: colormap(root, "grass")?,
foliage: colormap(root, "foliage")?,
dry: colormap(root, "dry_foliage")?,
};
let mut list = Vec::new();
let mut names: Vec<_> = fs::read_dir(root.join("data/minecraft/worldgen/biome"))?
.filter_map(|e| e.ok())
@@ -186,57 +290,7 @@ impl Biomes {
.ok_or("bad biome")?
);
let v: Value = serde_json::from_slice(&fs::read(&path)?)?;
let effects = &v["effects"];
let attributes = &v["attributes"];
let temperature = v["temperature"].as_f64().unwrap_or(0.5) as f32;
let downfall = v["downfall"].as_f64().unwrap_or(0.5) as f32;
let modifier = match effects["grass_color_modifier"].as_str() {
Some("dark_forest") => GrassModifier::DarkForest,
Some("swamp") => GrassModifier::Swamp,
_ => GrassModifier::None,
};
let mut spawns: HashMap<String, Vec<SpawnEntry>> = HashMap::new();
let natural = &attributes["minecraft:gameplay/natural_mob_spawns"];
// A modifier object ({argument, modifier: overlay}) or the plain value;
// the overlay over the dimension's empty default is the biome's value.
let natural = if natural["argument"].is_object() {
&natural["argument"]
} else {
natural
};
let categories = &natural["spawns_by_category"];
for (category, entries) in categories.as_object().into_iter().flatten() {
let list = parse_entries(entries);
spawns.insert(category.clone(), list);
}
list.push(BiomeInfo {
spawns,
spawn_costs: parse_costs(&natural["spawn_costs"]),
creature_probability:
attributes["minecraft:gameplay/creature_world_gen_spawn_probability"]
.as_f64()
.unwrap_or(0.1) as f32,
increased_fire_burnout: attributes["minecraft:gameplay/increased_fire_burnout"]
.as_bool()
.unwrap_or(false),
temperature,
frozen: v["temperature_modifier"].as_str() == Some("frozen"),
downfall,
precipitation: v["has_precipitation"].as_bool().unwrap_or(true),
grass: color(&effects["grass_color"])
.unwrap_or_else(|| sample(&grass, temperature, downfall, 0xFF00FF)),
modifier,
foliage: color(&effects["foliage_color"])
.unwrap_or_else(|| sample(&foliage, temperature, downfall, 0x48B518)),
dry_foliage: color(&effects["dry_foliage_color"])
.unwrap_or_else(|| sample(&dry, temperature, downfall, 0x5D4930)),
water: color(&effects["water_color"]).unwrap_or(0x3F76E4),
sky: color(&attributes["minecraft:visual/sky_color"]),
fog: color(&attributes["minecraft:visual/fog_color"]),
water_fog: color(&attributes["minecraft:visual/water_fog_color"])
.unwrap_or(0x050533),
name,
});
list.push(BiomeInfo::from_json(name, &v, &maps));
}
let index = list
.iter()
@@ -244,11 +298,65 @@ impl Biomes {
.map(|(i, b)| (b.name.clone(), i as u16))
.collect();
Ok(Self {
builtin: Arc::new(list.clone()),
list,
index,
colormaps: Arc::new(maps),
packs: BTreeMap::new(),
info_noise: SimplexNoise::with_skipped_offsets(&mut LegacyRandom::new(2345), true),
})
}
/// The built-in biomes with a world's data packs' biome files (id →
/// JSON) over them, as `RegistryDataLoader` builds the registry: a file
/// for a built-in biome replaces it, keeping its id, and new biomes join
/// after the built-in ones, in registry order. Starts from the built-in
/// table whatever packs `self` has.
pub fn with_packs<'a>(&self, files: impl IntoIterator<Item = (&'a str, &'a Value)>) -> Self {
let mut out = self.builtin_only();
let mut files: Vec<(&str, &Value)> = files.into_iter().collect();
files.sort_by(|a, b| identifier_order(a.0, b.0));
for (name, json) in files {
let info = BiomeInfo::from_json(name.to_owned(), json, &out.colormaps);
match out.index.get(name) {
Some(&id) => out.list[usize::from(id)] = info,
None if out.list.len() < usize::from(u16::MAX) => {
out.index.insert(name.to_owned(), out.list.len() as u16);
out.list.push(info);
}
None => continue,
}
out.packs.insert(name.to_owned(), Arc::new(json.clone()));
}
out
}
/// The built-in biomes alone: this table without what packs gave it.
pub fn builtin_only(&self) -> Self {
let mut out = self.clone();
if self.packs.is_empty() {
return out;
}
out.list = self.builtin.to_vec();
let builtin = out.list.len();
out.index.retain(|_, id| usize::from(*id) < builtin);
out.packs.clear();
out
}
/// The data pack file a world's biome `name` came from, if a pack added
/// or replaced it.
pub fn pack_file(&self, name: &str) -> Option<&Value> {
self.packs.get(name).map(|v| &**v)
}
/// Whether data packs added or replaced any biome.
pub fn has_packs(&self) -> bool {
!self.packs.is_empty()
}
/// The biome names in the network registry's order: `RegistryDataLoader`
/// sorts a registry's files by `Identifier` (path, then namespace).
pub fn registry_order(&self) -> Vec<&str> {
let mut names: Vec<&str> = self.list.iter().map(|b| b.name.as_str()).collect();
names.sort_by(|a, b| identifier_order(a, b));
names
}
pub fn id(&self, name: &str) -> u16 {
self.index
.get(name)
@@ -344,6 +452,88 @@ pub fn blend_rgb(weights: &[(u16, f64)], mut value: impl FnMut(u16) -> [f32; 3])
result.unwrap_or([0.0; 3])
}
#[cfg(test)]
mod pack_tests {
use super::*;
use serde_json::json;
/// A built-in table of `names` (no colormaps: sampled colours fall back).
fn builtin(names: &[&str]) -> Biomes {
let maps = Colormaps {
grass: Vec::new(),
foliage: Vec::new(),
dry: Vec::new(),
};
let list: Vec<BiomeInfo> = names
.iter()
.map(|n| BiomeInfo::from_json((*n).to_owned(), &json!({}), &maps))
.collect();
Biomes {
builtin: Arc::new(list.clone()),
index: list
.iter()
.enumerate()
.map(|(i, b)| (b.name.clone(), i as u16))
.collect(),
list,
info_noise: SimplexNoise::with_skipped_offsets(&mut LegacyRandom::new(2345), true),
colormaps: Arc::new(maps),
packs: BTreeMap::new(),
}
}
#[test]
fn registry_order_is_path_then_namespace() {
use std::cmp::Ordering::*;
assert_eq!(identifier_order("minecraft:a", "minecraft:b"), Less);
assert_eq!(identifier_order("z:a", "a:b"), Less);
assert_eq!(identifier_order("b:same", "a:same"), Greater);
assert_eq!(identifier_order("minecraft:a", "minecraft:a_b"), Less);
assert_eq!(identifier_order("minecraft:a-b", "minecraft:a"), Greater);
}
#[test]
fn packs_replace_in_place_and_add_after_the_builtin_biomes() {
let base = builtin(&["minecraft:meadow", "minecraft:plains", "minecraft:river"]);
let red = json!({"temperature": 2.0, "effects": {"water_color": "#ff0000"}});
let hot = json!({"effects": {"grass_color": 0x123456}});
let files = [
("pack:zeta", &hot),
("minecraft:molten_peaks", &hot),
("minecraft:river", &red),
];
let world = base.with_packs(files);
// The built-in ids stay; the river takes the pack's values.
assert_eq!(world.id("minecraft:plains"), 1);
assert_eq!(world.id("minecraft:river"), 2);
assert_eq!(world.get(2).water, 0xFF0000);
assert_eq!(world.get(2).temperature, 2.0);
// New biomes follow, in registry order.
assert_eq!(world.id("minecraft:molten_peaks"), 3);
assert_eq!(world.id("pack:zeta"), 4);
assert_eq!(world.get(3).grass, 0x123456);
assert!(world.pack_file("minecraft:river").is_some());
assert!(world.pack_file("minecraft:plains").is_none());
// The network registry sorts every name by path, then namespace.
assert_eq!(
world.registry_order(),
[
"minecraft:meadow",
"minecraft:molten_peaks",
"minecraft:plains",
"minecraft:river",
"pack:zeta"
]
);
// Another world starts again from the built-in biomes.
let other = world.with_packs([]);
assert_eq!(other.list.len(), 3);
assert!(!other.contains("minecraft:molten_peaks"));
assert_eq!(other.get(2).water, 0x3F76E4);
assert!(!other.has_packs());
}
}
#[cfg(test)]
mod blend_tests {
use super::*;
@@ -64,6 +64,10 @@ pub struct BlockEntities {
/// Positions whose block entity `take` took and `put` has not brought
/// back.
out: FxHashSet<Pos>,
/// Positions a loaded chunk gave a new block entity over an old one: at
/// the next tick their slot stays only if their block state ticks
/// (`updateBlockEntityTicker`: rebind, or remove without a ticker).
replaced: FxHashSet<Pos>,
/// `Ticking` by block state id; empty until the game builds it.
states: Vec<Ticking>,
}
@@ -239,15 +243,20 @@ impl BlockEntities {
self.added.clear();
self.pending.clear();
self.out.clear();
self.replaced.clear();
self.freed = false;
}
/// A loaded or generated chunk's block entities, in the order the chunk
/// lists them; they tick in its block entity map's order
/// (`registerAllBlockEntitiesAfterLevelLoad`).
/// (`registerAllBlockEntitiesAfterLevelLoad`). One replacing an entity
/// already at its position (`LevelChunk.setBlockEntity`) drops that one;
/// its slot is decided by the block state at the next tick.
pub fn load_chunk(&mut self, entities: Vec<(Pos, BlockEntity)>) {
let order = chunk_map_order(entities.iter().map(|(p, _)| *p));
for (p, e) in entities {
self.map.insert(p, e);
if self.map.insert(p, e).is_some() {
self.replaced.insert(p);
}
}
for p in order {
self.add(p);
@@ -291,6 +300,11 @@ impl BlockEntities {
self.live.insert(pos, slot);
Arc::make_mut(&mut self.tickers).push((pos, slot));
}
for pos in std::mem::take(&mut self.replaced) {
if self.live.contains_key(&pos) && self.ticking(state(pos)) != Ticking::Yes {
self.cancel(&pos);
}
}
if !std::mem::take(&mut self.freed) && self.out.is_empty() {
return Arc::clone(&self.tickers);
}
@@ -390,4 +404,33 @@ mod tests {
let order = chunk_map_order(many.iter().copied().chain(many.iter().copied()));
assert_eq!(order.len(), 100);
}
/// A chunk loaded over a block entity already there: the new one replaces
/// it, and keeps the old slot only while its block state ticks.
#[test]
fn loaded_chunk_replaces_block_entity_by_state() {
let mut b = level();
let mut s = HashMap::new();
let (p, q) = ((0, 0, 0), (1, 0, 0));
for pos in [p, q] {
s.insert(pos, 1);
}
// Two chunks, so the order is the order they load in.
b.load_chunk(vec![(p, hopper())]);
b.load_chunk(vec![(q, hopper())]);
assert_eq!(order(&mut b, &s), [p, q]);
// Replaced where the state ticks: the slot stays in its place.
b.load_chunk(vec![(p, hopper())]);
assert_eq!(order(&mut b, &s), [p, q]);
// Replaced where the state has no ticker: the slot is freed, and the
// new block entity is the one in the map.
s.insert(p, 2);
b.load_chunk(vec![(p, BlockEntity::Chest(vec![None; 27]))]);
assert_eq!(order(&mut b, &s), [q]);
assert!(matches!(b.get(&p), Some(BlockEntity::Chest(items)) if items.len() == 27));
// Ticking again later appends it, as any new ticker does.
s.insert(p, 1);
b.state_changed(p, 2, 1);
assert_eq!(order(&mut b, &s), [q, p]);
}
}
@@ -865,13 +865,23 @@ const VIEW_DISTANCE: f64 = 64.0;
impl BlockEntityRenderer {
pub fn load(root: &Path, registry: &BlockRegistry) -> crate::Result<Self> {
let visibility = crate::models::load_visibility(root, registry)?;
Self::load_with_visibility(root, registry, visibility)
}
/// [`BlockEntityRenderer::load`] over the face visibility the meshes use
/// (`MeshTables::visibility`): a clone shares its shapes and their faces.
pub fn load_with_visibility(
root: &Path,
registry: &BlockRegistry,
visibility: FaceVisibility,
) -> crate::Result<Self> {
let all: Value = serde_json::from_slice(&std::fs::read(root.join("entity-models.json"))?)?;
let models = MODELS
.iter()
.filter_map(|(key, layer)| all.get(*layer).map(|v| (*key, ModelPart::parse(v))))
.collect();
let mut renderer = Self::new(models, registry);
renderer.visibility = Some(Mutex::new(crate::models::load_visibility(root, registry)?));
renderer.visibility = Some(Mutex::new(visibility));
// Sherd items: provides_pottery_pattern -> decorated_pot_pattern asset id.
if let Ok(bytes) = std::fs::read(root.join("items.json")) {
let items: Value = serde_json::from_slice(&bytes)?;
@@ -1104,7 +1114,11 @@ impl BlockEntityRenderer {
pub fn renders(&self, state: u32) -> bool {
!matches!(self.kind(state), Kind::None)
}
/// ChestRenderer and BannerRenderer submit their animated models for crumbling.
/// `submitCrumblingOverlay` of ChestRenderer.submit, BannerRenderer.submit,
/// SkullBlockRenderer.submitSkull, ShulkerBoxRenderer.submit,
/// BellRenderer.submit, LecternRenderer.submit (the book) and
/// CopperGolemStatueBlockRenderer.submit: the model drawn again under the
/// destroy stage.
pub fn render_breaking(
&self,
scene: &Scene,
@@ -1113,7 +1127,16 @@ impl BlockEntityRenderer {
stage: [f32; 2],
out: &mut Vec<Vertex>,
) {
if !matches!(self.kind(state), Kind::Banner { .. } | Kind::Chest { .. }) {
if !matches!(
self.kind(state),
Kind::Banner { .. }
| Kind::Chest { .. }
| Kind::Skull { .. }
| Kind::Shulker { .. }
| Kind::Bell
| Kind::Lectern { .. }
| Kind::CopperGolem { .. }
) {
return;
}
let origin = (DVec3::new(f64::from(pos[0]), f64::from(pos[1]), f64::from(pos[2]))
@@ -2363,6 +2386,7 @@ mod tests {
lines: [line.into(), "two".into(), String::new(), "four".into()],
color: 3,
glowing,
..Default::default()
};
let first_text = crate::signs::SignData {
front: text("one", false),
+67 -22
View File
@@ -7,6 +7,7 @@ use crate::{
items::{ItemStack, Items},
providers::Providers,
};
use horizon_world::loot::PackOverlay;
use serde_json::Value;
use std::{collections::HashSet, fs, path::Path};
@@ -35,6 +36,22 @@ pub fn potion_name_key(item: &str, potion: Option<&str>) -> String {
let suffix = potion.and_then(self::potion).map_or("empty", |p| p.name);
format!("item.minecraft.{prefix}.effect.{suffix}")
}
/// `PotionContents.getAllEffects`: the potion's effects, then the stack's
/// `custom_effects` (id, duration, amplifier). Unknown effect ids are dropped.
pub fn contents_effects(stack: &ItemStack) -> Vec<(&'static str, i32, i32)> {
let potion = stack.potion().and_then(self::potion);
let custom = stack.custom_potion_effects();
potion
.map_or(&[][..], |d| d.effects)
.iter()
.copied()
.chain(
custom
.iter()
.filter_map(|(id, duration, amp)| Some((effect(id)?.id, *duration, *amp))),
)
.collect()
}
/// Roman amplifier suffix (`potion.potency.N`) and duration lines of a potion.
pub fn tooltip(
potion: Option<&str>,
@@ -50,20 +67,30 @@ pub fn tooltip(
Category::Neutral,
)];
}
def.effects
.iter()
effect_lines(def.effects.iter().copied(), scale, translate)
}
/// `PotionContents.addPotionTooltip`'s line per effect: its name, potency and
/// scaled duration, for (effect id, duration, amplifier) entries.
pub fn effect_lines<'a>(
effects: impl IntoIterator<Item = (&'a str, i32, i32)>,
scale: f32,
translate: &dyn Fn(&str) -> Option<String>,
) -> Vec<(String, Category)> {
effects
.into_iter()
.map(|(e, duration, amp)| {
let e = e.trim_start_matches("minecraft:");
let mut line =
translate(&format!("effect.minecraft.{e}")).unwrap_or_else(|| (*e).to_owned());
if *amp > 0 {
translate(&format!("effect.minecraft.{e}")).unwrap_or_else(|| e.to_owned());
if amp > 0 {
line.push(' ');
line.push_str(
&translate(&format!("potion.potency.{amp}"))
.unwrap_or_else(|| crate::enchant::level_name(*amp as u32 + 1)),
.unwrap_or_else(|| crate::enchant::level_name(amp as u32 + 1)),
);
}
let instant = effect(e).is_some_and(|d| d.instant);
let scaled = (*duration as f32 * scale) as i32;
let scaled = (duration as f32 * scale) as i32;
if !instant && scaled > 20 {
line = format!("{line} ({})", format_duration(scaled));
}
@@ -132,20 +159,41 @@ pub struct Brewing {
pub inputs: HashSet<String>,
}
impl Brewing {
pub fn load(root: &Path, items: &Items) -> Self {
let mut files: Vec<_> = fs::read_dir(root.join("data/minecraft/recipe/brewing"))
.into_iter()
.flatten()
.flatten()
.map(|e| e.path())
.collect();
files.sort();
let mut recipes = Vec::new();
for p in files {
let Ok(bytes) = fs::read(&p) else { continue };
let Ok(v) = serde_json::from_slice::<Value>(&bytes) else {
pub fn load(root: &Path, items: &Items, overlay: &PackOverlay) -> Self {
let mut sources: Vec<(String, Value)> =
fs::read_dir(root.join("data/minecraft/recipe/brewing"))
.into_iter()
.flatten()
.flatten()
.filter_map(|e| {
let bytes = fs::read(e.path()).ok()?;
let v = serde_json::from_slice::<Value>(&bytes).ok()?;
Some((
format!(
"minecraft:brewing/{}",
e.file_name().to_string_lossy().strip_suffix(".json")?
),
v,
))
})
.collect();
// The world's packs' brewing recipes over the game's own: the top
// pack's file for each id replaces it (`SimpleJsonResourceReloadListener`).
for (id, files) in overlay.kind("recipe") {
if !id.starts_with("minecraft:brewing/") {
continue;
}
let Ok(v) = serde_json::from_slice::<Value>(PackOverlay::top(files)) else {
continue;
};
match sources.iter_mut().find(|(n, _)| n == id) {
Some(slot) => slot.1 = v,
None => sources.push((id.to_owned(), v)),
}
}
sources.sort_by(|a, b| a.0.cmp(&b.0));
let mut recipes = Vec::new();
for (id, v) in sources {
if v["type"] != "minecraft:brewing" {
continue;
}
@@ -159,10 +207,7 @@ impl Brewing {
output = output.with_potion(potion);
}
recipes.push(BrewingRecipe {
id: format!(
"minecraft:brewing/{}",
p.file_stem().and_then(|s| s.to_str()).unwrap_or("")
),
id,
input: PotionIngredient::parse(&v["input"], items),
reagent: PotionIngredient::parse(&v["reagent"], items),
output,
+121 -10
View File
@@ -21,6 +21,12 @@ const COMMAND_HISTORY_FILE: &str = "command_history.txt";
const MAX_PERSISTED_COMMAND_HISTORY: usize = 50;
/// GuiMessageTag.systemSinglePlayer's indicator colour.
pub const SYSTEM_INDICATOR: u32 = 0xD0D0D0;
/// A player message's signature (MessageSignature), which names it to a
/// server's deletion.
pub type Signature = horizon_protocol::secure_chat::Signature;
/// How long a message shows before a deletion replaces it
/// (`ChatComponent.deleteMessageOrDelay`: `addedTime + 60`).
const DELETION_DELAY: u64 = 60;
/// `ChatVisiblity`: the Chat option's three values.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
@@ -165,6 +171,8 @@ struct Message {
content: Text,
indicator: Option<u32>,
source: ChatSource,
/// `GuiMessage.signature`: a signed player message's, for deletion.
signature: Option<Box<Signature>>,
}
/// A wrapped line (`GuiMessage.Line`).
#[derive(Clone, Debug)]
@@ -205,6 +213,9 @@ pub struct Chat {
pub received: u64,
/// The Chat option's `visibleMessageFilter` (`set_abilities`).
abilities: ChatAbilities,
/// `ChatComponent.messageDeletionQueue`: deletions of messages still
/// too new to replace, with the tick from which they may be.
deletions: Vec<(Box<Signature>, u64)>,
}
impl Chat {
pub fn lines_per_page(&self, focused: bool) -> usize {
@@ -227,6 +238,38 @@ impl Chat {
) {
self.add_message(&atlas.font, content, indicator, source, ticks, focused);
}
/// `add` of a player message with its signature, which a server's
/// deletion names it by (`GuiMessage.signature`).
pub fn add_signed(
&mut self,
atlas: &HudAtlas,
content: Text,
signature: Option<Signature>,
ticks: u64,
focused: bool,
) {
self.add_signed_message(&atlas.font, content, signature, ticks, focused);
}
fn add_signed_message(
&mut self,
font: &crate::font::Font,
content: Text,
signature: Option<Signature>,
ticks: u64,
focused: bool,
) {
self.push_message(
font,
Message {
added: ticks,
content,
indicator: None,
source: ChatSource::Player,
signature: signature.map(Box::new),
},
focused,
);
}
fn add_message(
&mut self,
font: &crate::font::Font,
@@ -236,20 +279,28 @@ impl Chat {
ticks: u64,
focused: bool,
) {
if !self.abilities.shows(source) {
self.push_message(
font,
Message {
added: ticks,
content,
indicator,
source,
signature: None,
},
focused,
);
}
fn push_message(&mut self, font: &crate::font::Font, message: Message, focused: bool) {
if !self.abilities.shows(message.source) {
return;
}
// ChatComponent.logChatMessage: every message shown is in the log.
crate::logging::write_only(log::Level::Info, &format!("[CHAT] {}", content.plain()));
let plain = message.content.plain();
crate::logging::write_only(log::Level::Info, &format!("[CHAT] {plain}"));
if self.log {
println!("[CHAT] {}", content.plain());
println!("[CHAT] {plain}");
}
let message = Message {
added: ticks,
content,
indicator,
source,
};
self.add_lines(font, &message, focused);
self.messages.insert(0, message);
self.messages.truncate(100);
@@ -319,8 +370,66 @@ impl Chat {
pub fn clear(&mut self) {
self.messages.clear();
self.lines.clear();
self.deletions.clear();
self.scroll = 0;
}
/// `ChatComponent.deleteMessage`: the server deleted a message. One
/// shown for 60 ticks becomes the grey "deleted" marker now; a newer
/// one waits until then (`messageDeletionQueue`).
pub fn delete_message(&mut self, atlas: &HudAtlas, signature: &Signature, ticks: u64) {
self.delete_message_with(&atlas.font, signature, ticks);
}
fn delete_message_with(&mut self, font: &crate::font::Font, signature: &Signature, ticks: u64) {
if let Some(delayed) = self.delete_or_delay(font, signature, ticks) {
self.deletions.push((Box::new(*signature), delayed));
}
}
/// `ChatComponent.tick` (`processMessageDeletionQueue`): the delayed
/// deletions whose message has shown long enough.
pub fn tick(&mut self, atlas: &HudAtlas, ticks: u64) {
self.process_deletions(&atlas.font, ticks);
}
fn process_deletions(&mut self, font: &crate::font::Font, ticks: u64) {
let mut deletions = std::mem::take(&mut self.deletions);
deletions.retain(|(signature, after)| {
ticks < *after || self.delete_or_delay(font, signature, ticks).is_some()
});
self.deletions = deletions;
}
/// `ChatComponent.deleteMessageOrDelay`: the newest message with this
/// signature, replaced by `createDeletedMarker` once 60 ticks have
/// passed since it was added; otherwise the tick to retry from.
fn delete_or_delay(
&mut self,
font: &crate::font::Font,
signature: &Signature,
ticks: u64,
) -> Option<u64> {
let message = self
.messages
.iter_mut()
.find(|m| m.signature.as_deref() == Some(signature))?;
let deletable = message.added + DELETION_DELAY;
if ticks < deletable {
return Some(deletable);
}
*message = Message {
added: message.added,
content: Self::deleted_marker(),
indicator: Some(SYSTEM_INDICATOR),
source: ChatSource::Server,
signature: None,
};
// refreshTrimmedMessages.
self.rewrap(font);
None
}
/// `ChatComponent.DELETED_CHAT_MESSAGE`: grey, italic.
fn deleted_marker() -> Text {
Text::translate("chat.deleted_marker", &[])
.with_color(text::GRAY)
.italic()
}
/// `new CommandHistory(gameFolder)`: the commands kept from earlier runs
/// start the chat's history (`ChatComponent`'s constructor).
pub fn load_history(&mut self, game_folder: &std::path::Path) {
@@ -929,7 +1038,9 @@ impl ChatScreen {
} else if !command.chars().all(char::is_whitespace) {
let partial = &command[..cursor_b];
let mut builder = SuggestionsBuilder::new(partial, last_word_index(partial));
builder.suggest_matching(c.registries.players.iter().map(String::as_str));
// ClientSuggestionProvider.getCustomTabSuggestions: the players
// and the server's custom chat completions.
builder.suggest_matching(c.registries.custom_tab_suggestions());
let (range, list) = merge_suggestions(partial, builder.out);
self.awaiting = None;
self.pending = Some((range.0, list));
@@ -244,6 +244,58 @@ fn mod_commands_are_coloured_and_complete_like_vanilla_ones() {
assert_eq!(screen.value(), "/coords");
}
#[test]
fn chat_completes_the_servers_custom_completions_with_the_players() {
// CommandSuggestions.updateCommandInfo completes chat from
// ClientSuggestionProvider.getCustomTabSuggestions: the online players
// and what ClientboundCustomChatCompletionsPacket added.
use crate::command::{CustomCompletionAction as Action, modify_custom_completions};
let font = font();
let m = Measure(&font);
let mut registries = Registries {
players: vec!["Steve".into()],
..Registries::default()
};
let entries = |e: &[&str]| e.iter().map(|s| s.to_string()).collect::<Vec<_>>();
let set = &mut registries.custom_completions;
modify_custom_completions(set, Action::from_id(0), &entries(&["Alex", "#trade"]));
modify_custom_completions(set, Action::Add, &entries(&["Notch", "Steve"]));
modify_custom_completions(set, Action::Remove, &entries(&["Alex"]));
// An id past the last action is ADD (OutOfBoundsStrategy.ZERO).
modify_custom_completions(set, Action::from_id(7), &entries(&["Zuri"]));
assert_eq!(
registries
.custom_tab_suggestions()
.into_iter()
.collect::<Vec<_>>(),
["#trade", "Notch", "Steve", "Zuri"]
);
let completed = |registries: &Registries, line: &str| {
let dispatcher = crate::command::vanilla::game_dispatcher();
let c = Commands {
dispatcher,
registries,
};
let mut screen = ChatScreen::new(&m, &c, "", 0, 640, 360, full());
screen.type_text(&m, &c, line);
// Chat shows no list by itself: Tab shows it, Tab again uses it.
for _ in 0..2 {
screen.key(&m, &c, &[], winit::keyboard::KeyCode::Tab, false, false);
}
screen.value().to_owned()
};
assert_eq!(completed(&registries, "hi no"), "hi Notch");
assert_eq!(completed(&registries, "sell #tr"), "sell #trade");
assert_eq!(completed(&registries, "hi st"), "hi Steve");
assert_eq!(completed(&registries, "hi al"), "hi al");
// SET replaces them all; the players stay.
let set = &mut registries.custom_completions;
modify_custom_completions(set, Action::Set, &entries(&["Alex"]));
assert_eq!(completed(&registries, "hi no"), "hi no");
assert_eq!(completed(&registries, "hi al"), "hi Alex");
assert_eq!(completed(&registries, "hi st"), "hi Steve");
}
#[test]
fn ask_server_nodes_wait_for_the_servers_completions() {
// ClientSuggestionProvider.customSuggestion: an `ask_server` node at the
@@ -467,3 +519,62 @@ fn a_guests_line_follows_the_player_message_permission() {
);
}
}
/// `ChatComponent.deleteMessageOrDelay`: a deleted message shows for 60
/// ticks from when it was added, then becomes the grey italic
/// `chat.deleted_marker` line with the system bar; the other lines stay.
#[test]
fn a_deleted_message_shows_60_ticks_then_becomes_the_marker() {
let font = font();
let mut chat = Chat::default();
let secret = [7; 256];
chat.add_signed_message(
&font,
Text::literal("<Steve> secret"),
Some(secret),
100,
false,
);
chat.add_signed_message(
&font,
Text::literal("<Alex> hi"),
Some([8; 256]),
110,
false,
);
let lines =
|chat: &Chat| -> Vec<String> { chat.lines.iter().map(|l| l.content.plain()).collect() };
let marker = Chat::deleted_marker().plain();
chat.delete_message_with(&font, &secret, 130);
assert_eq!(
lines(&chat),
["<Alex> hi", "<Steve> secret"],
"too new: delayed"
);
chat.process_deletions(&font, 159);
assert_eq!(lines(&chat), ["<Alex> hi", "<Steve> secret"]);
chat.process_deletions(&font, 160);
assert_eq!(lines(&chat), ["<Alex> hi".to_owned(), marker.clone()]);
assert!(chat.deletions.is_empty());
let line = &chat.lines[1];
assert_eq!(line.indicator, Some(SYSTEM_INDICATOR));
assert_eq!(line.added, 100, "the marker keeps the message's time");
assert!(
line.content
.spans
.iter()
.all(|s| s.style.color == Some(text::GRAY) && s.style.is_italic())
);
assert_eq!(
chat.messages[1].content.translation_key(),
Some("chat.deleted_marker")
);
// A message shown 60 ticks already is replaced at once; an unknown or
// already deleted signature changes nothing.
chat.delete_message_with(&font, &[8; 256], 170);
assert_eq!(lines(&chat), [marker.clone(), marker.clone()]);
chat.delete_message_with(&font, &secret, 200);
chat.delete_message_with(&font, &[9; 256], 200);
assert_eq!(lines(&chat), [marker.clone(), marker]);
assert!(chat.deletions.is_empty());
}
+356 -20
View File
@@ -8,10 +8,208 @@ use std::sync::{Arc, OnceLock};
pub mod block_entity;
/// The vanilla Overworld's column, which every dimension's chunks hold for
/// now (`LevelShape::column`).
pub const MIN_Y: i32 = -64;
pub const HEIGHT: i32 = 384;
pub const SECTIONS: usize = (HEIGHT / 16) as usize;
/// A level's build range and skylight, from its dimension type (`min_y`,
/// `height`, `logical_height`, `has_skylight`), as `LevelHeightAccessor` and
/// `SerializableChunkData.write` read them.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct LevelShape {
pub sky_light: bool,
pub min_y: i32,
pub height: i32,
/// `DimensionType.logicalHeight`: how high portals and chorus fruit reach.
pub logical_height: i32,
}
impl LevelShape {
pub const OVERWORLD: Self = Self {
sky_light: true,
min_y: MIN_Y,
height: HEIGHT,
logical_height: HEIGHT,
};
pub const NETHER: Self = Self {
sky_light: false,
min_y: 0,
height: 256,
logical_height: 128,
};
pub const END: Self = Self {
sky_light: true,
min_y: 0,
height: 256,
logical_height: 256,
};
/// A dimension type's shape, checked as its codec checks it.
pub fn new(
min_y: i32,
height: i32,
logical_height: i32,
sky_light: bool,
) -> Result<Self, String> {
ColumnLayout::new(min_y, height)?;
if !(0..=height).contains(&logical_height) {
return Err(format!(
"logical_height {logical_height} is outside 0..={height}"
));
}
Ok(Self {
sky_light,
min_y,
height,
logical_height,
})
}
/// One above the highest block (`getMaxY() + 1`).
pub fn max_y(self) -> i32 {
self.min_y + self.height
}
pub fn min_section(self) -> i32 {
self.min_y >> 4
}
pub fn section_count(self) -> usize {
(self.height >> 4) as usize
}
/// Whether section `y` (a section coordinate) is inside the level.
pub fn has_section(self, y: i32) -> bool {
(self.min_section()..self.min_section() + self.section_count() as i32).contains(&y)
}
/// The sections a chunk of this level holds: the level's, widened to the
/// vanilla Overworld's `-64..320` so that vanilla's Nether and End keep
/// the 24 sections they have always had.
pub fn column(self) -> ColumnLayout {
ColumnLayout::of_level(self.min_y, self.height)
}
}
/// The shapes of a world's three levels, from its dimension types.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct LevelShapes {
pub overworld: LevelShape,
pub nether: LevelShape,
pub end: LevelShape,
}
impl LevelShapes {
pub const VANILLA: Self = Self {
overworld: LevelShape::OVERWORLD,
nether: LevelShape::NETHER,
end: LevelShape::END,
};
/// The shape of the level `id` (`minecraft:overworld`,
/// `minecraft:the_nether`, `minecraft:the_end`); others get the
/// Overworld's.
pub fn get(&self, id: &str) -> LevelShape {
match id {
"minecraft:the_nether" => self.nether,
"minecraft:the_end" => self.end,
_ => self.overworld,
}
}
pub fn get_mut(&mut self, id: &str) -> &mut LevelShape {
match id {
"minecraft:the_nether" => &mut self.nether,
"minecraft:the_end" => &mut self.end,
_ => &mut self.overworld,
}
}
}
impl Default for LevelShapes {
fn default() -> Self {
Self::VANILLA
}
}
/// The span of block Y a chunk holds: from `min_y`, `sections` sections up
/// (`LevelShape::column`).
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct ColumnLayout {
min_y: i32,
sections: usize,
}
impl ColumnLayout {
pub const VANILLA: Self = Self {
min_y: MIN_Y,
sections: SECTIONS,
};
/// The column of a level from `min_y`, `height` high
/// (`LevelShape::column`).
pub fn of_level(min_y: i32, height: i32) -> Self {
let low = min_y.min(MIN_Y);
let high = (min_y + height).max(MIN_Y + HEIGHT);
Self {
min_y: low,
sections: ((high - low) / 16) as usize,
}
}
/// `DimensionType.MIN_Y`, `MAX_Y`: 12 bits of `BlockPos` Y, less 32.
pub const LOWEST_Y: i32 = -2032;
pub const HIGHEST_Y: i32 = 2031;
/// A dimension type's `min_y` and `height`, as its codec accepts them:
/// multiples of 16, at least 16 high, within `LOWEST_Y..=HIGHEST_Y`.
pub fn new(min_y: i32, height: i32) -> Result<Self, String> {
if min_y % 16 != 0 || height % 16 != 0 {
return Err(format!(
"min_y {min_y} and height {height} must be multiples of 16"
));
}
if height < 16 {
return Err(format!("height {height} is below 16"));
}
if min_y < Self::LOWEST_Y
|| i64::from(min_y) + i64::from(height) > i64::from(Self::HIGHEST_Y) + 1
{
return Err(format!(
"min_y {min_y} with height {height} leaves {}..={}",
Self::LOWEST_Y,
Self::HIGHEST_Y
));
}
Ok(Self {
min_y,
sections: (height / 16) as usize,
})
}
pub fn min_y(self) -> i32 {
self.min_y
}
/// One above the highest block.
pub fn max_y(self) -> i32 {
self.min_y + self.height()
}
pub fn height(self) -> i32 {
self.sections as i32 * 16
}
pub fn sections(self) -> usize {
self.sections
}
/// The index of the section holding block `y`, if the column holds it.
pub fn section_index(self, y: i32) -> Option<usize> {
usize::try_from((y - self.min_y) >> 4)
.ok()
.filter(|&s| s < self.sections)
}
/// The minimum block Y of section `index`.
pub fn section_y(self, index: usize) -> i32 {
self.min_y + index as i32 * 16
}
}
/// `true` for each section of `layout`: what callers that keep no
/// per-section record (of fluids, say) pass as "every section may have it".
pub fn every_section(layout: ColumnLayout) -> &'static [bool] {
static ALL: [bool; crate::section_mask::SectionMask::CAPACITY] =
[true; crate::section_mask::SectionMask::CAPACITY];
&ALL[..layout.sections()]
}
impl Default for ColumnLayout {
fn default() -> Self {
Self::VANILLA
}
}
/// Biomes are 4x4x4 containers over the biome table (67 entries: a 7-bit
/// global palette).
pub const BIOME_STRATEGY: Strategy = Strategy::biomes(7);
@@ -45,6 +243,47 @@ pub fn free_columns<T: Send + 'static>(columns: T, count: usize) {
pub fn set_block_states(states: usize) {
let bits = horizon_core::paletted::ceil_log2(states).max(16);
BLOCK_BITS.store(bits, std::sync::atomic::Ordering::Relaxed);
forget_shared();
}
/// One allocation per kind of uniform section (a single block, a single
/// biome and one light value), shared by every column that has it, keyed by
/// (block, biome, light). A tall column is mostly such sections: air with
/// full sky light above the terrain. Edits copy them (`Arc::make_mut`).
type SharedSections = std::collections::HashMap<(u32, u32, u8), Arc<Section>>;
static SHARED: std::sync::Mutex<Option<SharedSections>> = std::sync::Mutex::new(None);
/// Replaces the uniform sections of `sections` with the shared ones.
pub fn share_uniform(sections: &mut [Arc<Section>]) {
let key = |s: &Section| -> Option<(u32, u32, u8)> {
let Light::Uniform(light) = s.light else {
return None;
};
if s.blocks.bits() != 0 || s.biomes.bits() != 0 {
return None;
}
Some((s.blocks.uniform()?, s.biomes.uniform()?, light))
};
let Ok(mut shared) = SHARED.lock() else {
return;
};
let shared = shared.get_or_insert_with(Default::default);
for section in sections {
let Some(k) = key(section) else {
continue;
};
let one = shared.entry(k).or_insert_with(|| section.clone());
if !Arc::ptr_eq(one, section) {
*section = one.clone();
}
}
}
/// Forgets the shared sections, when the palette changes.
fn forget_shared() {
if let Ok(mut shared) = SHARED.lock() {
*shared = None;
}
}
/// Packed light per block: sky light in the high nibble, block light in the low one.
#[derive(Clone)]
@@ -138,9 +377,11 @@ impl Section {
pub struct Chunk {
pub x: i32,
pub z: i32,
/// The minimum block Y of `sections[0]` (the layout's when it was made).
min_y: i32,
pub sections: Vec<Arc<Section>>,
/// `Heightmap.Types.WORLD_SURFACE` per column (`z << 4 | x`): one above
/// the highest non-air block, or `MIN_Y`. Built on the first read; a
/// the highest non-air block, or the column's minimum Y. Built on the first read; a
/// `set` that can move a column's surface drops it.
surface: OnceLock<Box<[i16; 256]>>,
/// `Heightmap.Types.MOTION_BLOCKING` per column, kept like `surface`.
@@ -169,13 +410,19 @@ pub struct Chunk {
pub structure_starts: Vec<Arc<horizon_world::worldgen::structure::start::StructureStart>>,
}
impl Chunk {
/// An all-air chunk in the current `layout`.
pub fn empty(x: i32, z: i32) -> Self {
Self::with_layout(x, z, ColumnLayout::VANILLA)
}
pub fn with_layout(x: i32, z: i32, layout: ColumnLayout) -> Self {
let mut one = [Arc::new(Section::default())];
share_uniform(&mut one);
let [empty] = one;
Self {
x,
z,
sections: (0..SECTIONS)
.map(|_| Arc::new(Section::default()))
.collect(),
min_y: layout.min_y(),
sections: (0..layout.sections()).map(|_| empty.clone()).collect(),
surface: OnceLock::new(),
motion_blocking: OnceLock::new(),
lit: false,
@@ -190,13 +437,36 @@ impl Chunk {
entities: Vec::new(),
}
}
/// The minimum block Y of the column.
#[inline]
pub fn min_y(&self) -> i32 {
self.min_y
}
/// The column the chunk holds.
pub fn layout(&self) -> ColumnLayout {
ColumnLayout {
min_y: self.min_y,
sections: self.sections.len(),
}
}
/// One above the column's highest block.
#[inline]
pub fn max_y(&self) -> i32 {
self.min_y + self.sections.len() as i32 * 16
}
/// The index of the section holding block `y`, if the column holds it.
#[inline]
pub fn section_index(&self, y: i32) -> Option<usize> {
usize::try_from((y - self.min_y) >> 4)
.ok()
.filter(|&s| s < self.sections.len())
}
#[inline]
pub fn get(&self, x: i32, y: i32, z: i32) -> u32 {
let s = (y - MIN_Y) >> 4;
if !(0..SECTIONS as i32).contains(&s) {
return 0;
match self.section_index(y) {
Some(s) => self.sections[s].get(index(x, y, z)),
None => 0,
}
self.sections[s as usize].get(index(x, y, z))
}
#[inline]
pub fn block(&self, x: i32, y: i32, z: i32) -> BlockStateId {
@@ -211,16 +481,15 @@ impl Chunk {
.rev()
.filter(|(_, section)| !section.is_uniform(skip))
.find_map(|(s, _)| {
let base = MIN_Y + s as i32 * 16;
let base = self.min_y + s as i32 * 16;
(base..base + 16).rev().find(|&y| matches(y))
})
}
pub fn set(&mut self, x: i32, y: i32, z: i32, v: u32) -> u32 {
let s = (y - MIN_Y) >> 4;
if !(0..SECTIONS as i32).contains(&s) {
let Some(s) = self.section_index(y) else {
return v;
}
let previous = Arc::make_mut(&mut self.sections[s as usize]).set(index(x, y, z), v);
};
let previous = Arc::make_mut(&mut self.sections[s]).set(index(x, y, z), v);
// `Heightmap.update`: a write two or more below a map's height can't
// move it. Any other change rebuilds that map on the next read.
if previous != v {
@@ -236,7 +505,8 @@ impl Chunk {
previous
}
/// `getHeight(Heightmap.Types.WORLD_SURFACE, x, z)` (`x`, `z` within the
/// chunk): one above the highest block that isn't `air`, or `MIN_Y`.
/// chunk): one above the highest block that isn't `air`, or the column's
/// minimum Y.
/// Sections must change only through `set` once this has been read.
pub fn world_surface(&self, x: i32, z: i32, air: impl Fn(u32) -> bool) -> i32 {
let surface = self.surface.get_or_init(|| self.prime(|v| !air(v)));
@@ -244,7 +514,8 @@ impl Chunk {
}
/// `getHeight(Heightmap.Types.MOTION_BLOCKING, x, z)` (`x`, `z` within
/// the chunk): one above the highest state where `blocks` (a motion
/// blocking block or a fluid), or `MIN_Y`. Kept as `world_surface` is.
/// blocking block or a fluid), or the column's minimum Y. Kept as
/// `world_surface` is.
pub fn motion_blocking(&self, x: i32, z: i32, blocks: impl Fn(u32) -> bool) -> i32 {
let heights = self.motion_blocking.get_or_init(|| self.prime(blocks));
i32::from(heights[column(x, z)])
@@ -252,7 +523,7 @@ impl Chunk {
/// `Heightmap.primeHeightmaps`: each section from the top, skipping
/// those of one state that doesn't count, until every column is found.
fn prime(&self, counts: impl Fn(u32) -> bool) -> Box<[i16; 256]> {
let mut surface = Box::new([MIN_Y as i16; 256]);
let mut surface = Box::new([self.min_y as i16; 256]);
let mut found = [false; 256];
let mut left = 256;
let mut values = [0u32; 4096];
@@ -264,7 +535,7 @@ impl Chunk {
continue;
}
section.unpack(&mut values);
let base = MIN_Y + s as i32 * 16;
let base = self.min_y + s as i32 * 16;
for i in 0..256 {
if found[i] {
continue;
@@ -280,11 +551,11 @@ impl Chunk {
}
#[inline]
pub fn light(&self, x: i32, y: i32, z: i32) -> u8 {
let s = (y - MIN_Y) >> 4;
let s = (y - self.min_y) >> 4;
if s < 0 {
return 0;
}
if s >= SECTIONS as i32 {
if s >= self.sections.len() as i32 {
return 0xF0;
}
self.sections[s as usize].light(index(x, y, z))
@@ -297,7 +568,7 @@ impl Chunk {
/// the quart y clamped to the column).
#[inline]
pub fn biome(&self, x: i32, y: i32, z: i32) -> u16 {
let qy = ((y - MIN_Y) >> 2).clamp(0, HEIGHT / 4 - 1);
let qy = ((y - self.min_y) >> 2).clamp(0, self.sections.len() as i32 * 4 - 1);
self.sections[(qy >> 2) as usize]
.biomes
.get(((qy & 3) << 4 | ((z & 15) >> 2) << 2 | (x & 15) >> 2) as usize) as u16
@@ -504,4 +775,69 @@ mod tests {
}
}
}
#[test]
fn shapes_follow_the_dimension_type_codec() {
assert_eq!(ColumnLayout::new(-64, 384), Ok(ColumnLayout::VANILLA));
assert_eq!(ColumnLayout::default(), ColumnLayout::VANILLA);
// To The Max's Overworld: the highest top vanilla allows.
let tall = ColumnLayout::new(-64, 2096).unwrap();
assert_eq!((tall.sections(), tall.max_y()), (131, 2032));
assert!(ColumnLayout::new(-2032, 4064).is_ok());
for (min_y, height) in [(-64, 2112), (-2048, 64), (-60, 384), (0, 250), (0, 0)] {
assert!(
ColumnLayout::new(min_y, height).is_err(),
"{min_y} {height}"
);
}
assert_eq!(tall.section_index(-65), None);
assert_eq!(tall.section_index(-64), Some(0));
assert_eq!(tall.section_index(2031), Some(130));
assert_eq!(tall.section_index(2032), None);
assert_eq!(tall.section_y(130), 2016);
assert_eq!(
LevelShape::new(-64, 384, 384, true),
Ok(LevelShape::OVERWORLD)
);
assert_eq!(LevelShape::new(0, 256, 128, false), Ok(LevelShape::NETHER));
assert!(LevelShape::new(0, 256, 257, true).is_err());
assert!(LevelShape::new(-60, 384, 384, true).is_err());
}
#[test]
fn vanilla_levels_keep_the_overworld_column() {
for shape in [LevelShape::OVERWORLD, LevelShape::NETHER, LevelShape::END] {
assert_eq!(shape.column(), ColumnLayout::VANILLA, "{shape:?}");
}
let tall = LevelShape::new(-64, 2096, 2096, true).unwrap();
assert_eq!(tall.column(), ColumnLayout::new(-64, 2096).unwrap());
let deep = LevelShape::new(-512, 256, 256, false).unwrap();
assert_eq!(deep.column(), ColumnLayout::new(-512, 832).unwrap());
assert!(LevelShape::NETHER.has_section(15) && !LevelShape::NETHER.has_section(16));
assert!(!LevelShape::NETHER.has_section(-1));
}
#[test]
fn a_tall_column_stores_its_whole_height() {
let layout = ColumnLayout::new(-64, 2096).unwrap();
let mut chunk = Chunk::with_layout(0, 0, layout);
assert_eq!(
(chunk.min_y(), chunk.max_y(), chunk.sections.len()),
(-64, 2032, 131)
);
let stone = 1;
assert_eq!(chunk.set(5, 2031, 6, stone), 0);
assert_eq!(chunk.set(5, 2032, 6, stone), stone, "above the column");
assert_eq!(chunk.get(5, 2031, 6), stone);
assert_eq!(chunk.get(5, 2032, 6), 0);
assert_eq!(chunk.world_surface(5, 6, |v| v == 0), 2032);
assert_eq!(chunk.world_surface(0, 0, |v| v == 0), -64);
assert_eq!(chunk.highest(0, |y| y < 1000), None);
chunk.set(5, 999, 6, stone);
assert_eq!(chunk.highest(0, |y| y < 1000), Some(999));
assert_eq!(chunk.light(0, 2100, 0), 0xF0);
assert_eq!(chunk.light(0, -65, 0), 0);
chunk.set_biome_cell(0, 130 * 4 + 3, 0, 9);
assert_eq!(chunk.biome(0, 5000, 0), 9);
}
}
@@ -80,6 +80,24 @@ pub enum BlockEntity {
Shelf(Box<Shelf>),
/// `ChiseledBookShelfBlockEntity`: a `Container` of six one-book slots.
ChiseledBookshelf(Box<ChiseledBookshelf>),
/// `PotentSulfurBlockEntity` (`game/potent_sulfur.rs`).
PotentSulfur(PotentSulfur),
}
/// `PotentSulfurBlockEntity`: the seconds left to the geyser's next change of
/// state (`waitingCountdown`, saved as `countdown`) and the game time of its
/// last eruption block event, which the client's plume counts from.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct PotentSulfur {
pub waiting_countdown: i32,
pub eruption_tick: i64,
}
impl Default for PotentSulfur {
fn default() -> Self {
Self {
waiting_countdown: -1,
eruption_tick: -1,
}
}
}
/// `BrushableBlockEntity`: the loot table is resolved on the first brush.
#[derive(Clone, Debug, Default)]
@@ -228,6 +246,8 @@ pub struct SignText {
/// `DyeColor` id.
pub color: u8,
pub glowing: bool,
/// The `click_event` in each line's component style, as saved.
pub click: [Option<Tag>; 4],
}
/// `SignBlockEntity` / `HangingSignBlockEntity` data.
#[derive(Clone, Debug, Default, PartialEq, Eq)]
@@ -236,6 +256,8 @@ pub struct SignData {
pub front: SignText,
pub back: SignText,
pub waxed: bool,
/// `allow_op_features`: the sign's click events may run commands.
pub allow_op_features: bool,
}
/// `VibrationInfo`.
#[derive(Clone, Copy, Debug, PartialEq)]
@@ -82,6 +82,9 @@ impl crate::light::LightWorld for ChunkMap {
fn set_section_light(&mut self, cx: i32, s: usize, cz: i32, light: crate::chunk::Light) {
self.columns.set_section_light(cx, s, cz, light);
}
fn layout(&self) -> crate::chunk::ColumnLayout {
self.columns.layout()
}
}
#[cfg(test)]
@@ -305,7 +305,7 @@ impl<'w> BlockCollisionWorld for SceneCollisions<'w, '_> {
/// From the section's palette, without reading its blocks; a palette
/// of the whole registry reads every cell.
fn may_reach_out(&mut self, chunk: Self::Chunk, section_y: i32) -> io::Result<bool> {
let blocks = usize::try_from(section_y - (crate::chunk::MIN_Y >> 4))
let blocks = usize::try_from(section_y - (chunk.min_y() >> 4))
.ok()
.and_then(|s| chunk.sections.get(s))
.map(|section| &section.blocks);
@@ -3,7 +3,7 @@
//! from the data-driven `context_int_provider`/`context_float_provider` files.
pub use crate::chunk::block_entity::{
Banner, Beacon, BlockEntity, Brushable, Campfire, ChiseledBookshelf, Crafter, CreakingHeart,
EndGateway, Furnace, FurnaceKind, Jukebox, Lectern, Shelf, Skull, SkullSkin,
EndGateway, Furnace, FurnaceKind, Jukebox, Lectern, PotentSulfur, Shelf, Skull, SkullSkin,
};
use crate::items::ItemStack;
use std::collections::HashMap;
@@ -306,6 +306,9 @@ impl BlockEntity {
if name == "minecraft:chiseled_bookshelf" {
return Some(Self::ChiseledBookshelf(Box::default()));
}
if name == "minecraft:potent_sulfur" {
return Some(Self::PotentSulfur(PotentSulfur::default()));
}
let size = match name {
"minecraft:chest" | "minecraft:trapped_chest" | "minecraft:barrel" => 27,
n if n.ends_with("copper_chest") => 27,
@@ -349,6 +352,7 @@ impl BlockEntity {
Self::Campfire(_) => "minecraft:campfire",
Self::ChiseledBookshelf(_) => "minecraft:chiseled_bookshelf",
Self::Shelf(_) => "minecraft:shelf",
Self::PotentSulfur(_) => "minecraft:potent_sulfur",
}
}
pub fn contents(&self) -> Vec<ItemStack> {
@@ -367,6 +371,7 @@ impl BlockEntity {
| Self::CommandBlock(_)
| Self::EndGateway(_)
| Self::Skull(_)
| Self::PotentSulfur(_)
| Self::DaylightDetector
| Self::Brushable(_) => Vec::new(),
Self::Lectern(l) => l.book.iter().cloned().collect(),
@@ -391,6 +396,7 @@ impl BlockEntity {
| Self::Banner(_)
| Self::EndGateway(_)
| Self::Skull(_)
| Self::PotentSulfur(_)
| Self::DaylightDetector
| Self::Brushable(_) => &[],
Self::Crafter(c) => &c.items,
@@ -419,6 +425,7 @@ impl BlockEntity {
| Self::Banner(_)
| Self::EndGateway(_)
| Self::Skull(_)
| Self::PotentSulfur(_)
| Self::DaylightDetector
| Self::Brushable(_) => &mut [],
Self::Crafter(c) => &mut c.items,
+47 -14
View File
@@ -296,8 +296,9 @@ fn memory() -> String {
}
}
/// The report's details: Horizon's and the machine's, then what the game set as it ran.
pub fn system_details() -> Vec<(String, String)> {
/// The report's details: Horizon's and the machine's, then what the game set as it ran. A dedicated
/// server renders nothing: it leaves out the render settings it read from options.txt.
pub fn system_details(side: &str) -> Vec<(String, String)> {
let mut out = vec![
("Horizon Version".to_owned(), version()),
(
@@ -308,18 +309,30 @@ pub fn system_details() -> Vec<(String, String)> {
("CPU".to_owned(), cpu()),
("Memory".to_owned(), memory()),
];
out.extend(details().into_iter().map(|(k, v)| (k.to_owned(), v)));
out.extend(
details()
.into_iter()
.filter(|(k, _)| side != "server" || *k != "Render Settings")
.map(|(k, v)| (k.to_owned(), v)),
);
out
}
fn thread_name() -> String {
/// The thread's name as vanilla's reports say it: the main thread is the client's "Render thread"
/// and the dedicated server's "Server thread".
fn thread_name(side: &str) -> String {
let current = std::thread::current();
match current.name() {
Some("main") | None if side == "server" => "Server thread".into(),
Some("main") | None => "Render thread".into(),
Some(name) => name.into(),
}
}
/// What starts the stderr line naming a saved report, the path follows: the Launch API's
/// promise to launchers (docs/api/launch.md), so it never changes within a line of that API.
pub const SAVED_LINE: &str = "Horizon: crash report saved to ";
/// Writes the report and tells where it is; the log gets the error too.
fn deliver(home: &Path, report: Report) -> Option<PathBuf> {
if REPORTED.swap(true, Ordering::SeqCst) {
@@ -343,7 +356,7 @@ fn deliver(home: &Path, report: Report) -> Option<PathBuf> {
crate::telemetry::keep_crash(home, &report);
match report.save(home) {
Ok(path) => {
eprintln!("Horizon: crash report saved to {}", path.display());
eprintln!("{SAVED_LINE}{}", path.display());
Some(path)
}
Err(e) => {
@@ -365,9 +378,9 @@ pub fn report_watchdog(home: &Path, side: &'static str, message: String) -> Opti
description: "Watching Server".into(),
error: format!("{message} (Watching Server)"),
stack: String::new(),
thread: thread_name(),
thread: thread_name(side),
side,
details: system_details(),
details: system_details(side),
log: crate::logging::recent_lines(),
},
)
@@ -476,9 +489,9 @@ pub fn panic_report(info: &std::panic::PanicHookInfo, side: &'static str) -> Rep
&std::backtrace::Backtrace::force_capture().to_string(),
true,
),
thread: thread_name(),
thread: thread_name(side),
side,
details: system_details(),
details: system_details(side),
log: crate::logging::recent_lines(),
}
}
@@ -499,7 +512,7 @@ pub fn install(home: PathBuf, side: &'static str) {
} else {
log::error!(
"Caught previously unhandled exception in thread {}: {}",
thread_name(),
thread_name(side),
panic_message(info)
);
}
@@ -548,9 +561,9 @@ pub fn report_error(
description: DebugCrash::MESSAGE.into(),
error: DebugCrash::MESSAGE.into(),
stack: debug.stack.clone(),
thread: thread_name(),
thread: thread_name(side),
side,
details: system_details(),
details: system_details(side),
log: crate::logging::recent_lines(),
},
);
@@ -568,9 +581,9 @@ pub fn report_error(
description: "Fatal error".into(),
error: message,
stack: String::new(),
thread: thread_name(),
thread: thread_name(side),
side,
details: system_details(),
details: system_details(side),
log: crate::logging::recent_lines(),
},
)
@@ -668,6 +681,26 @@ mod tests {
));
}
#[test]
fn a_dedicated_servers_report_names_its_server_thread_and_no_render_settings() {
let unnamed = |side: &'static str| {
std::thread::spawn(move || thread_name(side))
.join()
.unwrap()
};
assert_eq!(unnamed("server"), "Server thread");
assert_eq!(unnamed("client"), "Render thread");
set_detail("Render Settings", "render distance 12");
let has = |side| {
system_details(side)
.iter()
.any(|(k, _)| k == "Render Settings")
};
assert!(has("client"));
assert!(!has("server"));
clear_detail("Render Settings");
}
#[test]
fn stacks_start_at_the_panicking_frame() {
let bt = format!(
+102 -15
View File
@@ -423,9 +423,31 @@ pub struct DataStore {
pub predicates: BTreeMap<String, serde_json::Value>,
/// `item_modifier` files, for `/item modify`.
pub item_modifiers: BTreeMap<String, serde_json::Value>,
/// The content tables' raw files from the packs after the built-in one:
/// `recipe/`, `loot_table/`, `advancement/` and `tags/…/` files, by
/// `<kind-dir>/<ns>:<path>`, each id's files in pack order. The tables
/// merge them over what they read from the resource root.
pub files: BTreeMap<String, Vec<Vec<u8>>>,
/// Functions that failed to parse (id, message), for logging.
pub errors: Vec<(String, String)>,
}
/// `<kind-dir>/<ns>:<path>` for a pack file the content tables read:
/// `recipe/`, `loot_table/`, `advancement/` or `tags/<sub>/`, where the id
/// keeps the sub path so a nested tag kind stays addressable.
fn content_id(file: &str) -> Option<String> {
let rest = file.strip_prefix("data/")?;
let (ns, rest) = rest.split_once('/')?;
let (kind, rest) = rest.split_once('/')?;
let kind = match kind {
"recipe" | "loot_table" | "advancement" => kind,
"tags" => {
let (sub, name) = rest.rsplit_once('/')?;
return Some(format!("tags/{sub}/{ns}:{}", name.strip_suffix(".json")?));
}
_ => return None,
};
Some(format!("{kind}/{ns}:{}", rest.strip_suffix(".json")?))
}
/// `ns:path` for a file `data/<ns>/<kind>/<path>.<ext>`.
fn resource_id(file: &str, kind: &str, ext: &str) -> Option<String> {
let rest = file.strip_prefix("data/")?;
@@ -440,7 +462,22 @@ impl DataStore {
pub fn load(packs: &[&DataPack]) -> Self {
let mut s = Self::default();
for pack in packs {
for f in pack.list_kinds(&["function", "item_modifier", "predicate", "tags/function"]) {
// `tags` walks the whole tags tree, so a `tags/function` file is
// listed by both kinds: handle every file once.
let mut seen = std::collections::BTreeSet::new();
let builtin = pack.id == "vanilla";
for f in pack.list_kinds(&[
"advancement",
"function",
"item_modifier",
"loot_table",
"predicate",
"recipe",
"tags",
]) {
if !seen.insert(f.clone()) {
continue;
}
if let Some(id) = resource_id(&f, "function", ".mcfunction")
&& let Some(bytes) = pack.read(&f)
{
@@ -470,6 +507,14 @@ impl DataStore {
&& let Ok(v) = serde_json::from_slice(&bytes)
{
s.item_modifiers.insert(id, v);
} else if !builtin
&& let Some(id) = content_id(&f)
&& let Some(bytes) = pack.read(&f)
{
// The built-in pack's content files are the resource
// root's own, which the tables read from disk; only the
// world's packs come through here.
s.files.entry(id).or_default().push(bytes);
}
}
}
@@ -479,11 +524,21 @@ impl DataStore {
/// included, each function once).
pub fn tag_functions(&self, id: &str) -> Vec<String> {
let mut out = Vec::new();
self.expand(id, &mut out, 0);
let mut seen_fns = std::collections::HashSet::new();
let mut seen_tags = std::collections::HashSet::new();
self.expand(id, &mut out, &mut seen_fns, &mut seen_tags);
out
}
fn expand(&self, id: &str, out: &mut Vec<String>, depth: usize) {
if depth > 16 {
/// Depth-first walk keeping first-seen order. Each tag is expanded at most
/// once, so reference cycles end and nesting depth is not capped.
fn expand<'a>(
&'a self,
id: &'a str,
out: &mut Vec<String>,
seen_fns: &mut std::collections::HashSet<&'a str>,
seen_tags: &mut std::collections::HashSet<&'a str>,
) {
if !seen_tags.insert(id) {
return;
}
let Some(entries) = self.function_tags.get(id) else {
@@ -491,9 +546,9 @@ impl DataStore {
};
for (e, required) in entries {
match e.strip_prefix('#') {
Some(inner) => self.expand(inner, out, depth + 1),
Some(inner) => self.expand(inner, out, seen_fns, seen_tags),
None => {
if (self.functions.contains_key(e) || *required) && !out.contains(e) {
if (self.functions.contains_key(e) || *required) && seen_fns.insert(e) {
out.push(e.clone());
}
}
@@ -581,11 +636,6 @@ pub fn worldgen_overrides(
let read = || String::from_utf8(pack.read(&file)?).ok();
match out.add_file(&pack.id, &file, read) {
PackFile::Read | PackFile::Other => {}
PackFile::DimensionType { id, min_y, height } => warnings.push(format!(
"{}: dimension type {id} (min_y {min_y}, height {height}) is not used: \
the dimension keeps its vanilla build height",
pack.id
)),
PackFile::NotRead(kind) => {
*not_read.entry(format!("{}: {kind}", pack.id)).or_default() += 1
}
@@ -658,10 +708,13 @@ mod tests {
);
let tag_packs: Vec<&str> = o.tags("biome_tags").map(|(_, p, _)| p).collect();
assert_eq!(tag_packs, ["file/b", "file/a"]);
assert_eq!(warnings.len(), 3, "{warnings:?}");
assert!(warnings[0].contains("height 2096"));
assert!(warnings[1].contains("minecraft:new_peaks"));
assert!(warnings[2].contains("worldgen/world_preset"));
assert_eq!(warnings.len(), 2, "{warnings:?}");
assert!(warnings[0].contains("minecraft:new_peaks"));
assert!(warnings[1].contains("worldgen/world_preset"));
assert_eq!(
o.level_height("minecraft:overworld").map(|h| h.height),
Some(2096)
);
let _ = std::fs::remove_dir_all(&dir);
}
use horizon_world::nbt::parse_snbt;
@@ -767,6 +820,40 @@ mod tests {
let _ = std::fs::remove_dir_all(&dir);
}
#[test]
fn tag_resolution_dedupes_fast_ends_cycles_and_nests_deeply() {
let mut store = DataStore::default();
let big: Vec<(String, bool)> = (0..50_000)
.map(|i| (format!("t:f{}", i % 25_000), true))
.collect();
store.function_tags.insert("t:big".into(), big);
let start = std::time::Instant::now();
let got = store.tag_functions("t:big");
assert_eq!(got.len(), 25_000);
assert_eq!(got[0], "t:f0");
assert!(start.elapsed() < std::time::Duration::from_secs(5));
// A cycle terminates and keeps first-seen order.
store.function_tags.insert(
"t:a".into(),
vec![("#t:b".into(), true), ("t:x".into(), true)],
);
store.function_tags.insert(
"t:b".into(),
vec![("#t:a".into(), true), ("t:y".into(), true)],
);
assert_eq!(store.tag_functions("t:a"), ["t:y", "t:x"]);
// Nesting deeper than the old cap of 16 still resolves.
for i in 0..40 {
store
.function_tags
.insert(format!("d:{i}"), vec![(format!("#d:{}", i + 1), true)]);
}
store
.function_tags
.insert("d:40".into(), vec![("t:deep".into(), true)]);
assert_eq!(store.tag_functions("d:0"), ["t:deep"]);
}
#[test]
fn folder_packs_list_the_needed_kinds_in_walk_order() {
let dir = std::env::temp_dir().join(format!("hz-datapack-kinds-{}", std::process::id()));
+29 -10
View File
@@ -148,6 +148,15 @@ pub fn instant(id: &str, amp: i32, scale: f64) -> Option<EffectAction> {
_ => None,
}
}
/// `MobEffectInstance.withScaledDuration`: max(floor(d * scale), 1), leaving
/// an infinite (-1) or zero duration alone.
pub fn scaled_duration(duration: i32, scale: f32) -> i32 {
if duration == -1 || duration == 0 {
duration
} else {
((duration as f32 * scale).floor() as i32).max(1)
}
}
/// What an omen's `applyEffectTick` decided.
#[derive(Clone, Debug, PartialEq)]
pub enum OmenTick {
@@ -308,19 +317,29 @@ impl PlayerEffects {
pub fn potion_effects(
potion: Option<&str>,
scale: f32,
) -> (Vec<EffectInstance>, Vec<EffectAction>) {
let effects = potion
.and_then(potions::potion)
.map_or(&[][..], |d| d.effects);
Self::contents_effects(effects, scale)
}
/// `PotionContents.forEachEffect`'s effects, as `potion_effects`.
pub fn contents_effects(
effects: &[(&'static str, i32, i32)],
scale: f32,
) -> (Vec<EffectInstance>, Vec<EffectAction>) {
let mut lasting = Vec::new();
let mut now = Vec::new();
if let Some(def) = potion.and_then(potions::potion) {
for (id, duration, amp) in def.effects {
let id = potions::effect(id).map_or("speed", |e| e.id);
if potions::effect(id).is_some_and(|e| e.instant) {
now.extend(instant(id, *amp, 1.0));
} else {
// withScaledDuration: max(floor(d * scale), 1).
let d = ((*duration as f32) * scale).floor() as i32;
lasting.push(EffectInstance::new(id, d.max(1), *amp));
}
for (id, duration, amp) in effects {
let id = potions::effect(id).map_or("speed", |e| e.id);
if potions::effect(id).is_some_and(|e| e.instant) {
now.extend(instant(id, *amp, 1.0));
} else {
lasting.push(EffectInstance::new(
id,
scaled_duration(*duration, scale),
*amp,
));
}
}
(lasting, now)
+16 -4
View File
@@ -53,10 +53,13 @@ struct Out {
@location(9) light_color: vec4<f32>,
@location(10) @interpolate(flat) weather_rect: vec4<f32>,
// The `GLINT_TEXTURING` sample for overlay 7 (item foil), or the model UV
// `ARMOR_ENTITY_GLINT_TEXTURING` scrolls for overlay 13 (armour).
// `ARMOR_ENTITY_GLINT_TEXTURING` scrolls for overlay 36 (armour).
@location(11) glint_uv: vec2<f32>,
// 1 drops the quad's back-facing pixels (Vertex::normal w = 1), like a culling render type.
@location(12) @interpolate(flat) cull: u32,
// HDR tier of a light-giving particle (mesher::hdr_tier), from the overlay's
// high bits (particles.rs): fs_hdr_mark marks the frame with it.
@location(13) @interpolate(flat) tier: u32,
}
// Shipped light.glsl; normals are already transformed and RGBA8_SNORM packed.
fn entity_light(normal: vec3<f32>, nether: bool) -> f32 {
@@ -126,8 +129,9 @@ fn entity_vertex(position: vec3<f32>, uv: vec2<f32>,
@vertex fn vs_entity(@location(0) position: vec3<f32>, @location(1) uv: vec2<f32>,
@location(2) overlay: u32, @location(3) color: vec4<f32>, @location(4) light: vec4<u32>,
@location(5) normal: vec4<f32>, @location(6) glint_uv: vec2<f32>) -> Out {
var out = entity_vertex(position, uv, overlay, color, light, normal);
var out = entity_vertex(position, uv, overlay & 0xffffu, color, light, normal);
out.glint_uv = glint_uv;
out.tier = overlay >> 16u;
return out;
}
// Retained bolt-local geometry, translated using the same f64 camera
@@ -250,8 +254,8 @@ fn crumbling_uv(uv: vec2<f32>, packed_origin: vec2<f32>, sprite_size: vec2<f32>,
// Enchantment glint: item.fsh's GLINT path, sampled from
// enchanted_glint_item at the `GLINT_TEXTURING` UV.
color = glint_over(color, textureSample(glint_tex, glint_sampler, in.glint_uv));
} else if in.overlay == 13u {
// Enchanted armour: enchanted_glint_armor at the scrolling model UV.
} else if in.overlay == 36u {
// Enchanted armour (mobs::render::ARMOR_GLINT): enchanted_glint_armor at the scrolling model UV.
color = glint_over(
color,
textureSample(glint_armor_tex, glint_sampler, armor_glint_uv(in.glint_uv)),
@@ -279,6 +283,14 @@ fn crumbling_uv(uv: vec2<f32>, packed_origin: vec2<f32>, sprite_size: vec2<f32>,
return vec4(in.color.rgb, 1.0);
}
// HDR output: a light-giving particle's pixels marked in the frame's alpha the
// way terrain.wgsl marks a light source's, drawn again after the entities with
// only alpha written, so its colour stays as blended.
@fragment fn fs_hdr_mark(in: Out) -> @location(0) vec4<f32> {
if in.tier == 0u || textureSample(atlas, atlas_sampler, in.uv).a < 0.1 { discard; }
return vec4(0.0, 0.0, 0.0, 0.7 * f32(4u - min(in.tier, 4u)) / 4.0);
}
fn celestial_color(in: Out) -> vec4<f32> {
return textureSample(atlas, atlas_sampler, in.uv) * in.color * in.light_color;
}
@@ -389,3 +389,36 @@ pub fn apply_weather(sky: &mut Sky, rain: f32, thunder: f32) {
);
}
}
pub fn sky_darken(environment: &Environment, day_time: i64, rain: f32, thunder: f32) -> i32 {
let mut sky = environment.sample(day_time, None, None);
apply_weather(&mut sky, rain, thunder);
// Level.updateSkyBrightness: darkening from the sky light level.
(15.0 - 15.0 * sky.sky_light_level).round() as i32
}
#[cfg(test)]
mod tests {
use super::*;
fn overworld() -> Option<Environment> {
let root = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("../../.local/horizon-client/26.3");
root.join("data/minecraft/timeline/day.json")
.exists()
.then(|| Environment::load(&root).unwrap())
}
#[test]
fn dark_outside_follows_time_and_weather_levels() {
let Some(env) = overworld() else {
return;
};
let dark = |time, rain, thunder| sky_darken(&env, time, rain, thunder) >= 4;
assert!(!dark(6000, 0.0, 0.0), "clear noon");
assert!(!dark(6000, 1.0, 0.0), "rainy noon");
assert!(dark(6000, 1.0, 1.0), "thunderstorm at noon");
assert!(dark(18000, 0.0, 0.0), "clear midnight");
assert!(!dark(1000, 0.0, 0.0), "clear morning");
}
}
+8 -4
View File
@@ -311,10 +311,14 @@ pub fn setup_fog(tables: &FogTables, state: &FogState, input: &FogInputs) -> Fog
fog.cloud_end = fog.environmental_end;
}
FogType::PowderSnow => {
fog.environmental_start = 0.0;
fog.environmental_end = 2.0;
fog.sky_end = 2.0;
fog.cloud_end = 2.0;
// PowderedSnowFogEnvironment.setupFog.
(fog.environmental_start, fog.environmental_end) = if input.spectator {
(-8.0, rd * 0.5)
} else {
(0.0, 2.0)
};
fog.sky_end = fog.environmental_end;
fog.cloud_end = fog.environmental_end;
}
_ if input.blindness.is_some() => {
let (duration, infinite) = input.blindness.unwrap_or((0, true));
+364 -129
View File
@@ -7,6 +7,7 @@ use crate::{
graphics::GraphicsApi,
hud::{HudBatch, HudRenderer},
mesher::{SectionMesh, Sides, TerrainVertex, Vertex},
section_mask::SectionMask,
sprites::SpriteAnimation,
};
use glam::{DVec3, Mat4, Vec3, Vec4};
@@ -105,8 +106,6 @@ mod view;
mod wgsl_prefix;
mod world_post;
/// A column whose every section has its mesh (`Renderer::lod_detail_columns`).
const COMPLETE_COLUMN: u32 = (1 << (crate::chunk::HEIGHT / 16)) - 1;
/// A section's instance: its camera-relative origin and, in `w`, the step of
/// its fixed-point UVs (`terrain.wgsl`'s `terrain_uv`).
/// The world pass again after occlusion culling's test: it loads both
@@ -428,6 +427,7 @@ pub struct Renderer {
crosshair_group: wgpu::BindGroup,
crosshair_globals: wgpu::Buffer,
entity_pipeline: wgpu::RenderPipeline,
hdr_mark_pipeline: wgpu::RenderPipeline,
weather: weather::Weather,
crumbling_pipeline: wgpu::RenderPipeline,
shadow_blob_pipeline: wgpu::RenderPipeline,
@@ -516,7 +516,7 @@ pub struct Renderer {
lod_retiring: crate::fast_hash::FxHashSet<SectionKey>,
/// Finished tile meshes `upload_lods` has yet to upload.
lod_pending: Option<lod::Pending>,
detail_columns: crate::fast_hash::FxHashMap<(i32, i32), u32>,
detail_columns: crate::fast_hash::FxHashMap<(i32, i32), SectionMask>,
/// Bumped whenever a column becomes or stops being complete.
detail_revision: u64,
arena: arena::Arena,
@@ -555,6 +555,9 @@ pub struct Renderer {
block_entity_revision: u64,
/// VisGraph face connectivity per meshed section (cave culling).
occlusion: occlusion::Occlusion,
/// The column `occlusion`, `sections` and `detail_columns` count in: the
/// level's (`clear_sections`).
layout: crate::chunk::ColumnLayout,
/// Resolution scale, FXAA and TAA (Horizon settings).
world_post: world_post::Post,
/// HDR output (Horizon setting): `Some` while the swapchain is HDR.
@@ -587,6 +590,10 @@ pub struct Renderer {
readback: readback::Readback,
pub info: wgpu::AdapterInfo,
pub suspended: bool,
/// Consecutive frames whose surface acquisition failed validation. The
/// first gets the swapchain a fresh configuration; later ones reattach
/// the window, as a lost surface does.
acquire_validation_failures: u32,
pub drawn_sections: usize,
/// Last frame's section draws (face ranges and translucent sections),
/// and the draw calls the backend issued for them.
@@ -789,9 +796,14 @@ fn mip_chain(
/// pass is also what passes each draw's first instance to shaders reading
/// `instance_index`, and DirectX 12 is the fallback, where working matters
/// more than CPU time.
/// `allow_nonconformant` offers the adapters wgpu hides for reporting no Vulkan
/// conformance version: Mesa's hasvk, which drives Ivy Bridge and Haswell,
/// reports 0.0.0.0 while it works. `open_device` asks for them only on a second
/// try at a backend that had no adapter at all.
fn instance_descriptor(
backends: wgpu::Backends,
window: Option<&Arc<Window>>,
allow_nonconformant: bool,
) -> wgpu::InstanceDescriptor {
let mut descriptor = wgpu::InstanceDescriptor::new_without_display_handle();
if let Some(window) = window {
@@ -804,7 +816,13 @@ fn instance_descriptor(
.flags
.remove(wgpu::InstanceFlags::VALIDATION_INDIRECT_CALL);
}
descriptor.with_env()
let mut descriptor = descriptor.with_env();
if allow_nonconformant {
descriptor
.flags
.insert(wgpu::InstanceFlags::ALLOW_UNDERLYING_NONCOMPLIANT_ADAPTER);
}
descriptor
}
/// The window's display connection, so the OpenGL backend creates its EGL
/// display from the X11 or Wayland connection the window lives on. Without
@@ -943,96 +961,147 @@ async fn open_device(
if attempt > 0 {
log::warn!("Horizon renderer: trying {name} ({})", failures.join("; "));
}
let instance = wgpu::Instance::new(instance_descriptor(backends, Some(window)));
let surface = if offscreen {
None
} else {
match instance.create_surface(window.clone()) {
Ok(surface) => Some(surface),
Err(e) => {
failures.push(format!("{name} surface: {e}"));
continue;
}
}
};
let adapter = match instance
.request_adapter(&wgpu::RequestAdapterOptions {
power_preference: wgpu::PowerPreference::HighPerformance,
compatible_surface: surface.as_ref(),
force_fallback_adapter: false,
..Default::default()
})
.await
{
Ok(adapter) => adapter,
Err(e) => {
failures.push(format!("{name}: {e}"));
continue;
}
};
describe_adapter(&adapter);
let info = adapter.get_info();
let limits = adapter.limits();
if let Err(e) = check_layers(&limits, layers) {
failures.push(format!("{name}: {e}"));
continue;
}
// Mappable primary buffers: section pages that no longer fit in
// video memory go to system memory. Shader packs' 16-bit normalized buffers (render
// targets with the adapter's own format features) and R11F_G11F_B10F: a float
// stand-in neither clamps nor drops NaN.
let features = timing::GpuTimer::features(&adapter)
| cull::Cull::features(&adapter)
| (adapter.features()
& (wgpu::Features::INDIRECT_FIRST_INSTANCE
| wgpu::Features::MAPPABLE_PRIMARY_BUFFERS
| wgpu::Features::TEXTURE_FORMAT_16BIT_NORM
| wgpu::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES
| wgpu::Features::RG11B10UFLOAT_RENDERABLE));
let driver = format!("{} {}", info.driver, info.driver_info);
startup_step(format_args!(
"requesting the device (driver {}) with features [{features}] and the adapter's \
limits (buffers up to {} bytes, storage bindings up to {} bytes, {} texture layers)",
match driver.trim() {
"" => "unnamed",
driver => driver,
},
limits.max_buffer_size,
limits.max_storage_buffer_binding_size,
limits.max_texture_array_layers,
));
let desc = wgpu::DeviceDescriptor {
label: Some("Horizon device"),
required_features: features,
required_limits: limits,
..Default::default()
};
#[cfg(not(target_os = "macos"))]
let opened = match info.backend {
wgpu::Backend::Vulkan => horizon_hdr::open_vulkan_device(&adapter, &desc),
_ => None,
};
#[cfg(target_os = "macos")]
let opened = None;
let opened = match opened {
Some(opened) => opened,
None => adapter.request_device(&desc).await,
};
match opened {
Ok((device, queue)) => {
return Ok(Opened {
instance,
surface,
adapter,
device,
queue,
});
}
Err(e) => failures.push(format!("{name} device: {e}")),
match open_with_retry(backends, window, offscreen, layers).await {
Ok(opened) => return Ok(opened),
Err(e) => failures.push(e),
}
}
Err(format!("{NO_GPU_DRIVER} ({})", failures.join("; ")).into())
}
/// Why a backend gave no device: no adapter at all, which a second try with the
/// adapters wgpu hides can still find, or a failure after an adapter.
enum NoDevice {
NoAdapter(String),
Failed(String),
}
/// Opens a device on one backend, and on a backend whose adapters wgpu all hid
/// for reporting no Vulkan conformance version tries it again with them shown:
/// Mesa's hasvk drives Ivy Bridge and Haswell, works, and reports 0.0.0.0, so
/// without this the player is told they have no graphics driver while Vulkan
/// runs (a `gl not compatible with provided surface` fallback, or nothing, is
/// all they get). Returns why the backend gave no device.
async fn open_with_retry(
backends: wgpu::Backends,
window: &Arc<Window>,
offscreen: bool,
layers: u32,
) -> std::result::Result<Opened, String> {
match open_backend(backends, window, offscreen, false, layers).await {
Err(NoDevice::NoAdapter(hidden)) => {
log::warn!(
"Horizon renderer: {} has no conformant adapter ({hidden}); asking again for the \
ones wgpu hides as non-conformant",
backends_name(backends)
);
match open_backend(backends, window, offscreen, true, layers).await {
Ok(opened) => {
log::warn!(
"Horizon renderer: using {} although its driver reports no Vulkan \
conformance version",
opened.adapter.get_info().name
);
Ok(opened)
}
Err(NoDevice::NoAdapter(e)) | Err(NoDevice::Failed(e)) => Err(e),
}
}
Err(NoDevice::Failed(e)) => Err(e),
Ok(opened) => Ok(opened),
}
}
/// Opens a device on `backends` alone: its surface, adapter and device, or what
/// stopped it. `allow_nonconformant` is `open_with_retry`'s second try.
async fn open_backend(
backends: wgpu::Backends,
window: &Arc<Window>,
offscreen: bool,
allow_nonconformant: bool,
layers: u32,
) -> std::result::Result<Opened, NoDevice> {
let name = backends_name(backends);
let instance = wgpu::Instance::new(instance_descriptor(
backends,
Some(window),
allow_nonconformant,
));
let surface = if offscreen {
None
} else {
match instance.create_surface(window.clone()) {
Ok(surface) => Some(surface),
Err(e) => return Err(NoDevice::Failed(format!("{name} surface: {e}"))),
}
};
let adapter = match instance
.request_adapter(&wgpu::RequestAdapterOptions {
power_preference: wgpu::PowerPreference::HighPerformance,
compatible_surface: surface.as_ref(),
force_fallback_adapter: false,
..Default::default()
})
.await
{
Ok(adapter) => adapter,
Err(e) => return Err(NoDevice::NoAdapter(format!("{name}: {e}"))),
};
describe_adapter(&adapter);
let info = adapter.get_info();
let limits = adapter.limits();
if let Err(e) = check_layers(&limits, layers) {
return Err(NoDevice::Failed(format!("{name}: {e}")));
}
// Mappable primary buffers: section pages that no longer fit in
// video memory go to system memory. Shader packs' 16-bit normalized buffers (render
// targets with the adapter's own format features) and R11F_G11F_B10F: a float
// stand-in neither clamps nor drops NaN.
let features = timing::GpuTimer::features(&adapter)
| cull::Cull::features(&adapter)
| (adapter.features()
& (wgpu::Features::INDIRECT_FIRST_INSTANCE
| wgpu::Features::MAPPABLE_PRIMARY_BUFFERS
| wgpu::Features::TEXTURE_FORMAT_16BIT_NORM
| wgpu::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES
| wgpu::Features::RG11B10UFLOAT_RENDERABLE));
let driver = format!("{} {}", info.driver, info.driver_info);
startup_step(format_args!(
"requesting the device (driver {}) with features [{features}] and the adapter's \
limits (buffers up to {} bytes, storage bindings up to {} bytes, {} texture layers)",
match driver.trim() {
"" => "unnamed",
driver => driver,
},
limits.max_buffer_size,
limits.max_storage_buffer_binding_size,
limits.max_texture_array_layers,
));
let desc = wgpu::DeviceDescriptor {
label: Some("Horizon device"),
required_features: features,
required_limits: limits,
..Default::default()
};
#[cfg(not(target_os = "macos"))]
let opened = match info.backend {
wgpu::Backend::Vulkan => horizon_hdr::open_vulkan_device(&adapter, &desc),
_ => None,
};
#[cfg(target_os = "macos")]
let opened = None;
let opened = match opened {
Some(opened) => opened,
None => adapter.request_device(&desc).await,
};
match opened {
Ok((device, queue)) => Ok(Opened {
instance,
surface,
adapter,
device,
queue,
}),
Err(e) => Err(NoDevice::Failed(format!("{name} device: {e}"))),
}
}
/// What to tell a player whose system offers no usable graphics adapter.
/// Vulkan is loaded at run time (the game links no graphics library), so a
/// missing driver shows here rather than as a missing-DLL dialog.
@@ -2127,6 +2196,18 @@ impl Renderer {
"fs_energy_swirl",
wgpu::ColorWrites::ALL,
);
// HDR output's mark on light-giving particles (entity.wgsl fs_hdr_mark).
let hdr_mark_pipeline = entity_pipeline_with(
"HDR particle mark",
None,
false,
wgpu::CompareFunction::GreaterEqual,
Default::default(),
wgpu::BlendState::REPLACE,
false,
"fs_hdr_mark",
wgpu::ColorWrites::ALPHA,
);
// Attribute 7: 6 is the entity vertex buffer's glint UV.
let lightning_attributes = wgpu::vertex_attr_array![7=>Float32x3];
let lightning_vertex = [
@@ -2515,10 +2596,19 @@ impl Renderer {
step_mode: wgpu::VertexStepMode::Vertex,
attributes: &TERRAIN_ATTRIBUTES,
})];
let info = adapter.get_info();
let min_sections = if flat::is_broken_intel_vulkan(&info)
|| std::env::var("HORIZON_FLAT_DRAWS").as_deref() == Ok("1")
{
0
} else {
flat::MIN_SECTIONS
};
flat::Flat::new(
&device,
&bindings,
arena.page_vertices(),
min_sections,
|layout, label, fragment, blend| {
pipeline_in(
layout,
@@ -2640,6 +2730,7 @@ impl Renderer {
crosshair_group,
crosshair_globals,
entity_pipeline,
hdr_mark_pipeline,
weather,
crumbling_pipeline,
shadow_blob_pipeline,
@@ -2730,6 +2821,7 @@ impl Renderer {
block_entities: Default::default(),
block_entity_revision: next_block_entity_revision(),
occlusion: occlusion::Occlusion::new(crate::chunk::MIN_Y, crate::chunk::HEIGHT / 16),
layout: crate::chunk::ColumnLayout::VANILLA,
world_post,
hdr: None,
hdr_output,
@@ -2747,6 +2839,7 @@ impl Renderer {
readback: readback::Readback::default(),
info,
suspended: !drawable_size(size.width, size.height, max_side),
acquire_validation_failures: 0,
drawn_sections: 0,
section_draws: 0,
section_draw_calls: 0,
@@ -3166,7 +3259,8 @@ impl Renderer {
pub fn block_entity_revision(&self) -> u64 {
self.block_entity_revision
}
pub fn clear_sections(&mut self) {
/// Drops every section, for a level whose chunks hold `layout`.
pub fn clear_sections(&mut self, layout: crate::chunk::ColumnLayout) {
self.block_entities.clear();
self.block_entity_revision = next_block_entity_revision();
self.sections.clear();
@@ -3182,12 +3276,23 @@ impl Renderer {
}
self.sorted_indices.clear();
self.translucency_cursor = 0;
self.occlusion.clear();
if layout == self.layout {
self.occlusion.clear();
} else {
self.layout = layout;
self.occlusion = occlusion::Occlusion::new(layout.min_y(), layout.sections() as i32);
self.sections.set_min_y(layout.min_y());
}
}
/// A column whose every section has its mesh (`lod_detail_columns`).
fn complete_column(&self) -> SectionMask {
SectionMask::below(self.layout.sections())
}
pub fn lod_detail_columns(&self) -> impl Iterator<Item = (i32, i32)> + '_ {
let complete = self.complete_column();
self.detail_columns
.iter()
.filter_map(move |(&column, &mask)| (mask == COMPLETE_COLUMN).then_some(column))
.filter_map(move |(&column, &mask)| (mask == complete).then_some(column))
}
/// Changes whenever `lod_detail_columns` does.
pub fn lod_detail_revision(&self) -> u64 {
@@ -3196,16 +3301,22 @@ impl Renderer {
/// Whether the section at `key` has its mesh, for `lod_detail_columns`.
fn set_detail(&mut self, key: SectionKey, meshed: bool) {
let column = (key.0, key.2);
let mask = self.detail_columns.get(&column).copied().unwrap_or(0);
let next = if meshed {
mask | 1 << key.1
let mask = self
.detail_columns
.get(&column)
.copied()
.unwrap_or_default();
let mut next = mask;
if meshed {
next.insert(key.1 as usize);
} else {
mask & !(1 << key.1)
};
if (mask == COMPLETE_COLUMN) != (next == COMPLETE_COLUMN) {
next.remove(key.1 as usize);
}
let complete = self.complete_column();
if (mask == complete) != (next == complete) {
self.detail_revision += 1;
}
if next == 0 {
if next.is_empty() {
self.detail_columns.remove(&column);
} else {
self.detail_columns.insert(column, next);
@@ -3218,12 +3329,12 @@ impl Renderer {
let mut released = Vec::new();
let mut block_entities = false;
for (x, z) in columns {
if self.detail_columns.remove(&(x, z)) == Some(COMPLETE_COLUMN) {
if self.detail_columns.remove(&(x, z)) == Some(self.complete_column()) {
self.detail_revision += 1;
}
self.occlusion.remove_column(x, z);
let retiring = !self.lod_cutout.is_empty() && self.lod_cutout.contains(&(x, z));
for sy in 0..crate::chunk::SECTIONS as i32 {
for sy in 0..self.layout.sections() as i32 {
let key = (x, sy, z);
block_entities |= self.block_entities.remove(&key).is_some();
if retiring {
@@ -3730,9 +3841,32 @@ impl Renderer {
return Ok(false);
}
Some(wgpu::CurrentSurfaceTexture::Validation) => {
return Err("surface acquisition failed validation".into());
// Acquire caught a validation error: the swapchain cannot be
// used as configured (wgpu reports a configuration raced with
// a submission this way). Give it a fresh configuration like
// an Outdated one, and once that has not helped, reattach the
// window like a Lost one — a fullscreen loading screen then
// skips frames instead of failing every one of them.
if self.acquire_validation_failures == 0 {
if let Some(surface) = &self.surface {
Self::configure(
&self.device,
surface,
&self.surface_config(),
self.hdr.as_ref(),
);
}
} else {
self.recreate_surface()?;
}
self.acquire_validation_failures =
self.acquire_validation_failures.saturating_add(1);
return Ok(false);
}
};
if surface_frame.is_some() {
self.acquire_validation_failures = 0;
}
let size = [self.config.width, self.config.height];
let target_texture = match (&surface_frame, &mut self.hdr) {
(Some(_), Some(hdr)) => hdr.frame(&self.device, size),
@@ -3913,7 +4047,7 @@ impl Renderer {
planes: frustum(cull_proj),
};
let camera = frame.camera;
let camera_section = camera_section(camera);
let camera_section = camera_section(camera, self.layout.min_y());
// Solid quads facing away from the eye are left out: the bob moves
// the eye off `camera`, so it is found from the projection.
let eye = projection_center(cull_proj).filter(|_| self.sides_on);
@@ -4127,7 +4261,7 @@ impl Renderer {
let scheduled = (i + count - self.translucency_cursor) % count < budget;
let origin = [
v.key.0 * 16,
crate::chunk::MIN_Y + v.key.1 * 16,
self.layout.min_y() + v.key.1 * 16,
v.key.2 * 16,
];
if (!s.sort.is_sorted() || nearby || scheduled)
@@ -4230,7 +4364,7 @@ impl Renderer {
{
let origin = [
v.key.0 * 16,
crate::chunk::MIN_Y + v.key.1 * 16,
self.layout.min_y() + v.key.1 * 16,
v.key.2 * 16,
];
if let Some(indices) =
@@ -4926,6 +5060,10 @@ impl Renderer {
pass.set_bind_group(0, &self.entity_group, &[]);
pass.set_vertex_buffer(0, self.entity_buffer.slice(..));
pass.draw_indexed(0..entity_quads * 6, 0, 0..1);
if self.hdr.is_some() {
pass.set_pipeline(&self.hdr_mark_pipeline);
pass.draw_indexed(0..entity_quads * 6, 0, 0..1);
}
pass.set_bind_group(0, &self.group, &[]);
}
if text_quads > 0 {
@@ -5402,6 +5540,16 @@ impl Renderer {
if let (Some(hdr), Some(f)) = (&self.hdr, &surface_frame) {
hdr.present(&self.queue, &mut encoder, &f.texture, !frame.title);
}
// With HDR on, a full-frame screenshot gets an HDR10 copy beside it.
let hdr_readback = readback
.as_ref()
.filter(|(request, _)| request.size.is_none())
.zip(self.hdr.as_ref())
.and_then(|(_, hdr)| {
let texture = hdr.capture(&self.device, &self.queue, &mut encoder, !frame.title)?;
let size = [self.config.width, self.config.height];
Some(copy_frame(&self.device, &mut encoder, &texture, size))
});
let commands = crate::spans::time("encode", || encoder.finish());
let first_frame = self.first_frame == FirstFrame::Submit;
if first_frame {
@@ -5420,6 +5568,16 @@ impl Renderer {
timer.submitted(&self.queue);
}
if let Some((request, buffer)) = readback {
if let Some(hdr_buffer) = hdr_readback {
let hdr_path = hdr_screenshot_path(&request.path);
match self.write_hdr_screenshot(&hdr_path, &hdr_buffer) {
Ok(()) => log::info!("Saved HDR screenshot to {}", hdr_path.display()),
Err(e) => log::warn!(
"Horizon renderer: HDR screenshot {}: {e}",
hdr_path.display()
),
}
}
self.screenshot_result = Some(
self.write_screenshot(&request, &buffer)
.map_err(|e| e.to_string()),
@@ -5528,11 +5686,8 @@ impl Renderer {
None
}
}
fn write_screenshot(
&self,
request: &ScreenshotRequest,
buffer: &wgpu::Buffer,
) -> Result<[u32; 2]> {
/// The pixels `copy_frame` read back into `buffer`, 4 bytes each, row after row.
fn read_frame(&self, buffer: &wgpu::Buffer) -> Result<Vec<[u8; 4]>> {
let (sender, receiver) = std::sync::mpsc::channel();
buffer.map_async(wgpu::MapMode::Read, .., move |r| {
let _ = sender.send(r);
@@ -5545,28 +5700,34 @@ impl Renderer {
.map_err(|e| e.to_string())?
.map_err(|e| e.to_string())?;
let (width, height, row) = (
self.config.width,
self.config.height,
self.config.width as usize,
self.config.height as usize,
padded_row(self.config.width) as usize,
);
let mut pixels = Vec::with_capacity(width * height);
{
let data = buffer.get_mapped_range(..).map_err(|e| e.to_string())?;
for y in 0..height {
pixels.extend_from_slice(data[y * row..y * row + width * 4].as_chunks::<4>().0);
}
}
buffer.unmap();
Ok(pixels)
}
fn write_screenshot(
&self,
request: &ScreenshotRequest,
buffer: &wgpu::Buffer,
) -> Result<[u32; 2]> {
let bgra = matches!(
self.config.format.remove_srgb_suffix(),
wgpu::TextureFormat::Bgra8Unorm
);
let mut pixels = Vec::with_capacity((width * height * 4) as usize);
{
let data = buffer.get_mapped_range(..).map_err(|e| e.to_string())?;
for y in 0..height as usize {
for px in data[y * row..y * row + width as usize * 4]
.as_chunks::<4>()
.0
{
let (r, b) = if bgra { (px[2], px[0]) } else { (px[0], px[2]) };
pixels.extend_from_slice(&[r, px[1], b, 255]);
}
}
let mut pixels = Vec::with_capacity((self.config.width * self.config.height * 4) as usize);
for px in self.read_frame(buffer)? {
let (r, b) = if bgra { (px[2], px[0]) } else { (px[0], px[2]) };
pixels.extend_from_slice(&[r, px[1], b, 255]);
}
buffer.unmap();
// NativeImage.resizeSubRectTo on takeAutoScreenshot's grab: the icon
// is the frame's centre square averaged down to its size.
let (width, height, pixels) = match request.size {
@@ -5587,6 +5748,50 @@ impl Renderer {
encoder.write_header()?.write_image_data(&pixels)?;
Ok([width, height])
}
/// The HDR10 copy (`Hdr::capture`) as a 16-bit PNG tagged BT.2020 with PQ (cICP, PNG's
/// third edition), with the peak and paper white as its content light levels (cLLI).
fn write_hdr_screenshot(&self, path: &std::path::Path, buffer: &wgpu::Buffer) -> Result<()> {
let Some(hdr) = &self.hdr else {
return Ok(());
};
let pixels = hdr10_to_rgb16(&self.read_frame(buffer)?);
let mut encoder = png::Encoder::new(
std::io::BufWriter::new(std::fs::File::create(path)?),
self.config.width,
self.config.height,
);
encoder.set_color(png::ColorType::Rgb);
encoder.set_depth(png::BitDepth::Sixteen);
let mut writer = encoder.write_header()?;
// BT.2020 primaries, PQ, RGB, full range.
writer.write_chunk(png::chunk::cICP, &[9, 16, 0, 1])?;
let nits = |n: f32| ((n * 10_000.0) as u32).to_be_bytes();
let peak = hdr.peak.max(hdr.paper_white);
writer.write_chunk(
png::chunk::cLLI,
&[nits(peak), nits(hdr.paper_white.min(peak))].concat(),
)?;
writer.write_image_data(&pixels)?;
Ok(())
}
}
/// `screenshots/2026-10-28_12.00.00.png` -> `screenshots/2026-10-28_12.00.00-hdr.png`.
fn hdr_screenshot_path(path: &std::path::Path) -> PathBuf {
let stem = path.file_stem().unwrap_or_default().to_string_lossy();
path.with_file_name(format!("{stem}-hdr.png"))
}
/// `Rgb10a2Unorm` pixels as 16-bit RGB, big-endian as PNG stores it: each 10-bit value
/// with its top bits repeated below, so 0 stays 0 and 1023 becomes 65535.
fn hdr10_to_rgb16(pixels: &[[u8; 4]]) -> Vec<u8> {
let mut out = Vec::with_capacity(pixels.len() * 6);
for &px in pixels {
let v = u32::from_le_bytes(px);
for shift in [0, 10, 20] {
let c = (v >> shift & 0x3ff) as u16;
out.extend_from_slice(&(c << 6 | c >> 4).to_be_bytes());
}
}
out
}
/// Centre-crop the frame to a square and average it down to `size`.
pub(crate) fn square_downscale(pixels: &[u8], width: u32, height: u32, size: [u32; 2]) -> Vec<u8> {
@@ -5660,10 +5865,10 @@ impl Frustum {
/// are GREATER_THAN_OR_EQUAL), which keeps far faces a hair apart, like
/// fire_side's 0.01 pixel in front of its block, from z-fighting.
/// The section the camera is in.
fn camera_section(camera: DVec3) -> SectionKey {
fn camera_section(camera: DVec3, min_y: i32) -> SectionKey {
(
(camera.x.floor() as i32) >> 4,
(camera.y.floor() as i32 - crate::chunk::MIN_Y) >> 4,
(camera.y.floor() as i32 - min_y) >> 4,
(camera.z.floor() as i32) >> 4,
)
}
@@ -5841,6 +6046,23 @@ mod tests {
assert_eq!(order(api, "macos"), [Backends::default()]);
}
}
/// The second try at a backend shows the adapters wgpu hides for reporting
/// no Vulkan conformance version (Mesa's hasvk, which drives Ivy Bridge and
/// Haswell, reports 0.0.0.0 and works).
#[test]
fn the_second_try_at_a_backend_shows_nonconformant_adapters() {
let shown = |allow| {
super::instance_descriptor(wgpu::Backends::VULKAN, None, allow)
.flags
.contains(wgpu::InstanceFlags::ALLOW_UNDERLYING_NONCOMPLIANT_ADAPTER)
};
assert!(shown(true));
// The first try keeps wgpu's own filtering, unless `with_env` turns the
// flag on from the environment (WGPU_ALLOW_UNDERLYING_NONCOMPLIANT_ADAPTER).
if std::env::var_os("WGPU_ALLOW_UNDERLYING_NONCOMPLIANT_ADAPTER").is_none() {
assert!(!shown(false));
}
}
/// Every WGSL shader file translates to HLSL as wgpu's DirectX 12 backend
/// writes it for FXC (shader model 5.1), entry point by entry point.
#[test]
@@ -5940,6 +6162,17 @@ mod tests {
assert_eq!(blend.alpha.dst_factor, wgpu::BlendFactor::Zero);
}
#[test]
fn hdr_screenshots_keep_every_10_bit_step() {
// Rgb10a2Unorm: red in the low 10 bits, then green, then blue.
let px = |r: u32, g: u32, b: u32| (r | g << 10 | b << 20 | 3 << 30).to_le_bytes();
let out = super::hdr10_to_rgb16(&[px(0, 1023, 512)]);
assert_eq!(out, [0, 0, 0xff, 0xff, 0x80, 0x20]);
assert_eq!(
super::hdr_screenshot_path(std::path::Path::new("screenshots/2026-10-28_12.00.00.png")),
std::path::Path::new("screenshots/2026-10-28_12.00.00-hdr.png")
);
}
#[test]
fn shader_globals_match_the_rust_layout() {
// terrain.wgsl and entity.wgsl bind the same buffer: same fields, same order.
let fields = |source: &str| -> Vec<String> {
@@ -5985,7 +6218,7 @@ mod tests {
#[test]
fn indirect_draws_are_validated_only_in_debug_builds_and_on_directx_12() {
let validated = |backends| {
super::instance_descriptor(backends, None)
super::instance_descriptor(backends, None, false)
.flags
.contains(wgpu::InstanceFlags::VALIDATION_INDIRECT_CALL)
};
@@ -6201,6 +6434,8 @@ static DISPLAY_LOG: std::sync::Mutex<DisplayLog> = std::sync::Mutex::new(Display
pending: None,
});
const DISPLAY_LOG_QUIET: std::time::Duration = std::time::Duration::from_secs(1);
// Only Wayland's HDR reports call it so far.
#[cfg(target_os = "linux")]
fn log_display(line: String) {
let now = std::time::Instant::now();
let mut log = DISPLAY_LOG
@@ -147,7 +147,7 @@ impl SpriteAnimator {
group,
});
}
let Some(pipeline) = pipeline else {
let Some((pipeline, layout)) = pipeline else {
let groups = keys
.iter()
.zip(&counts)
@@ -193,7 +193,6 @@ impl SpriteAnimator {
usage: wgpu::BufferUsages::STORAGE | wgpu::BufferUsages::COPY_DST,
mapped_at_creation: false,
});
let layout = pipeline.get_bind_group_layout(0);
let groups = keys
.iter()
.zip(&counts)
@@ -364,11 +363,15 @@ impl SpriteAnimator {
}
}
/// `animate.wgsl`'s pipeline, unless the device fails to make it: an OpenGL
/// driver can list compute shaders among its extensions while wgpu writes
/// the GLSL version of its core version, which has none (Mesa's
/// `MESA_GL_VERSION_OVERRIDE`, older drivers).
fn pipeline(device: &wgpu::Device) -> Option<wgpu::ComputePipeline> {
/// `animate.wgsl`'s pipeline and the bind group layout of its group 0,
/// unless the device fails to make the pipeline: an OpenGL driver can list
/// compute shaders among its extensions while wgpu writes the GLSL version
/// of its core version, which has none (Mesa's `MESA_GL_VERSION_OVERRIDE`,
/// older drivers). A device lost between the scopes' pushes answers pipeline
/// creation with a silent placeholder and reports its invalidity only when
/// the layout is asked for — inside the scopes that error is caught, outside
/// them it is uncaptured and panics (#3866).
fn pipeline(device: &wgpu::Device) -> Option<(wgpu::ComputePipeline, wgpu::BindGroupLayout)> {
let validation = device.push_error_scope(wgpu::ErrorFilter::Validation);
let internal = device.push_error_scope(wgpu::ErrorFilter::Internal);
let module = device.create_shader_module(wgpu::ShaderModuleDescriptor {
@@ -383,9 +386,10 @@ fn pipeline(device: &wgpu::Device) -> Option<wgpu::ComputePipeline> {
compilation_options: Default::default(),
cache: None,
});
let layout = pipeline.get_bind_group_layout(0);
let internal = pollster::block_on(internal.pop());
match internal.or(pollster::block_on(validation.pop())) {
None => Some(pipeline),
None => Some((pipeline, layout)),
Some(e) => {
log::warn!("Horizon renderer: animated sprites drawn on the CPU ({e})");
None
+17 -7
View File
@@ -115,7 +115,7 @@ pub struct Flat {
/// (9,300 draws) the CPU saves 1.3 ms. The bar was 4,096 draws when they
/// were 2.2 to 2.5 per section; a section's draw count now depends on the
/// sides it shows the eye (`mesher::Sides`), so it counts sections.
const MIN_SECTIONS: usize = 1600;
pub const MIN_SECTIONS: usize = 1600;
/// Whether flat draws apply: the backend emulates multi-draw, and vertex
/// shaders can read storage buffers large enough for an index page.
@@ -126,7 +126,20 @@ pub fn wanted(adapter: &wgpu::Adapter, device: &wgpu::Device) -> bool {
Ok("1") => return supported(adapter, device),
_ => {}
}
adapter.get_info().backend == wgpu::Backend::Metal && supported(adapter, device)
let info = adapter.get_info();
(info.backend == wgpu::Backend::Metal || is_broken_intel_vulkan(&info))
&& supported(adapter, device)
}
/// Intel Gen11 (Ice Lake) ANV Vulkan driver has broken `first_instance` for instance-step
/// vertex attributes (#3529), causing terrain sections to be drawn with another section's origin
/// and flicker.
pub fn is_broken_intel_vulkan(info: &wgpu::AdapterInfo) -> bool {
info.backend == wgpu::Backend::Vulkan
&& info.vendor == 0x8086
&& (info.name.contains("ICL")
|| info.name.contains("Ice Lake")
|| (info.device >= 0x8a50 && info.device <= 0x8a71))
}
fn supported(adapter: &wgpu::Adapter, device: &wgpu::Device) -> bool {
@@ -254,6 +267,7 @@ impl Flat {
device: &wgpu::Device,
terrain_layout: &wgpu::BindGroupLayout,
page_vertices: u64,
min_sections: usize,
pipeline: impl Fn(
&wgpu::PipelineLayout,
&str,
@@ -357,11 +371,7 @@ impl Flat {
phase1_calls: 0,
solid_calls: 0,
shadow_calls: [0; 2],
min_sections: if std::env::var("HORIZON_FLAT_DRAWS").as_deref() == Ok("1") {
0
} else {
MIN_SECTIONS
},
min_sections,
range_align: (u64::from(device.limits().min_storage_buffer_offset_alignment) / 16)
.max(1),
}
+176 -43
View File
@@ -60,6 +60,38 @@ struct Targets {
group: wgpu::BindGroup,
}
/// How one tier of light sources (`mesher::hdr_tier`) shines: `share` of the headroom for
/// its brightest pixels, lifted from brightness `start` (none) to `full` (all of it).
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct Tier {
pub share: f32,
pub start: f32,
pub full: f32,
}
/// Low, incandescent, bright and very bright.
pub const TIERS: [Tier; 4] = [
Tier {
share: 0.2,
start: 0.08,
full: 0.09,
},
Tier {
share: 0.5,
start: 0.14,
full: 0.38,
},
Tier {
share: 0.6,
start: 0.14,
full: 0.38,
},
Tier {
share: 1.0,
start: 0.14,
full: 0.38,
},
];
pub struct Hdr {
layout: wgpu::BindGroupLayout,
pipeline: wgpu::RenderPipeline,
@@ -70,17 +102,22 @@ pub struct Hdr {
/// output keeps the hand at the world's brightness.
hand_mark: wgpu::RenderPipeline,
params: wgpu::Buffer,
/// The same pass drawing HDR10 for a screenshot (`capture`), with its own parameters,
/// so it can differ from the swapchain's in one frame.
capture_pipeline: wgpu::RenderPipeline,
capture_params: wgpu::Buffer,
pub output: Output,
/// The frame's format: what every other pipeline draws in.
format: wgpu::TextureFormat,
targets: Option<Targets>,
/// `HORIZON_HDR_DEBUG=1`: paint expanded pixels magenta.
/// `HORIZON_HDR_DEBUG=1`: grey what isn't expanded, tint what is magenta.
debug: bool,
/// Paper white and peak brightness, in nits.
pub paper_white: f32,
pub peak: f32,
/// The display's black level, in nits: shadows are lifted onto it (`hdr.wgsl`).
pub black: f32,
pub tiers: [Tier; 4],
/// The HUD and menus' brightness, as a share of paper white (0.25..=1).
pub ui: f32,
}
@@ -123,31 +160,33 @@ impl Hdr {
bind_group_layouts: &[Some(&layout)],
..Default::default()
});
let pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
label: Some("Horizon HDR"),
layout: Some(&pipeline_layout),
vertex: wgpu::VertexState {
module: &shader,
entry_point: Some("vs_hdr"),
compilation_options: Default::default(),
buffers: &[],
},
primitive: Default::default(),
depth_stencil: None,
multisample: Default::default(),
fragment: Some(wgpu::FragmentState {
module: &shader,
entry_point: Some("fs_hdr"),
compilation_options: Default::default(),
targets: &[Some(wgpu::ColorTargetState {
format: output.format(),
blend: None,
write_mask: wgpu::ColorWrites::ALL,
})],
}),
multiview_mask: None,
cache: None,
});
let pipeline_for = |format| {
device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
label: Some("Horizon HDR"),
layout: Some(&pipeline_layout),
vertex: wgpu::VertexState {
module: &shader,
entry_point: Some("vs_hdr"),
compilation_options: Default::default(),
buffers: &[],
},
primitive: Default::default(),
depth_stencil: None,
multisample: Default::default(),
fragment: Some(wgpu::FragmentState {
module: &shader,
entry_point: Some("fs_hdr"),
compilation_options: Default::default(),
targets: &[Some(wgpu::ColorTargetState {
format,
blend: None,
write_mask: wgpu::ColorWrites::ALL,
})],
}),
multiview_mask: None,
cache: None,
})
};
let alpha_pass = |label, blend| {
device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
label: Some(label),
@@ -190,18 +229,22 @@ impl Hdr {
alpha: scale_alpha,
}),
);
let params = device.create_buffer(&wgpu::BufferDescriptor {
label: Some("Horizon HDR parameters"),
size: 32,
usage: wgpu::BufferUsages::UNIFORM | wgpu::BufferUsages::COPY_DST,
mapped_at_creation: false,
});
let params = || {
device.create_buffer(&wgpu::BufferDescriptor {
label: Some("Horizon HDR parameters"),
size: 80,
usage: wgpu::BufferUsages::UNIFORM | wgpu::BufferUsages::COPY_DST,
mapped_at_creation: false,
})
};
Self {
layout,
pipeline,
pipeline: pipeline_for(output.format()),
clear_alpha,
hand_mark,
params,
params: params(),
capture_pipeline: pipeline_for(Output::Pq.format()),
capture_params: params(),
output,
format,
targets: None,
@@ -209,6 +252,7 @@ impl Hdr {
paper_white: 200.0,
peak: 1000.0,
black: 0.0,
tiers: TIERS,
ui: 1.0,
}
}
@@ -341,18 +385,89 @@ impl Hdr {
let Some(t) = &self.targets else {
return;
};
queue.write_buffer(
&self.params,
0,
bytemuck::cast_slice(&self.params(world, self.output == Output::Pq)),
);
Self::draw(encoder, &self.pipeline, &t.group, target);
}
/// The frame `present` writes, as HDR10 (BT.2020, PQ, 10 bits a channel) whatever
/// the swapchain is, in a texture of its own for a screenshot (`Rgb10a2Unorm`).
pub fn capture(
&self,
device: &wgpu::Device,
queue: &wgpu::Queue,
encoder: &mut wgpu::CommandEncoder,
world: bool,
) -> Option<wgpu::Texture> {
let t = self.targets.as_ref()?;
let texture = device.create_texture(&wgpu::TextureDescriptor {
label: Some("Horizon HDR screenshot"),
size: t.frame.size(),
mip_level_count: 1,
sample_count: 1,
dimension: wgpu::TextureDimension::D2,
format: Output::Pq.format(),
usage: wgpu::TextureUsages::RENDER_ATTACHMENT | wgpu::TextureUsages::COPY_SRC,
view_formats: &[],
});
let view = |t: &wgpu::Texture| t.create_view(&Default::default());
let group = device.create_bind_group(&wgpu::BindGroupDescriptor {
label: Some("Horizon HDR screenshot bindings"),
layout: &self.layout,
entries: &[
wgpu::BindGroupEntry {
binding: 0,
resource: wgpu::BindingResource::TextureView(&view(&t.frame)),
},
wgpu::BindGroupEntry {
binding: 1,
resource: wgpu::BindingResource::TextureView(&view(&t.world)),
},
wgpu::BindGroupEntry {
binding: 2,
resource: self.capture_params.as_entire_binding(),
},
],
});
queue.write_buffer(
&self.capture_params,
0,
bytemuck::cast_slice(&self.params(world, true)),
);
Self::draw(encoder, &self.capture_pipeline, &group, &texture);
Some(texture)
}
/// hdr.wgsl's `Params`.
fn params(&self, world: bool, pq: bool) -> [f32; 20] {
let paper = self.paper_white.max(1.0);
let params = [
let mut params = [0.0; 20];
params[..5].copy_from_slice(&[
paper / 80.0,
(self.peak / paper).max(1.0),
f32::from(u8::from(world)),
f32::from(u8::from(self.debug)),
f32::from(u8::from(self.output == Output::Pq)),
self.black.clamp(0.0, paper),
self.ui.clamp(0.25, 1.0),
0.0,
];
queue.write_buffer(&self.params, 0, bytemuck::cast_slice(&params));
f32::from(u8::from(pq)),
]);
params[5] = self.black.clamp(0.0, paper);
params[6] = self.ui.clamp(0.25, 1.0);
for (i, t) in self.tiers.iter().enumerate() {
params[8 + i] = t.share;
params[12 + i] = t.start;
params[16 + i] = t.full;
}
params
}
fn draw(
encoder: &mut wgpu::CommandEncoder,
pipeline: &wgpu::RenderPipeline,
group: &wgpu::BindGroup,
target: &wgpu::Texture,
) {
let view = target.create_view(&Default::default());
let attachments = [Some(wgpu::RenderPassColorAttachment {
view: &view,
@@ -368,8 +483,8 @@ impl Hdr {
color_attachments: &attachments,
..Default::default()
});
pass.set_pipeline(&self.pipeline);
pass.set_bind_group(0, &t.group, &[]);
pass.set_pipeline(pipeline);
pass.set_bind_group(0, group, &[]);
pass.draw(0..3, 0..1);
}
}
@@ -379,6 +494,24 @@ mod tests {
use super::{Output, pick};
use wgpu::{SurfaceColorSpaces as S, TextureFormat as F};
#[test]
fn hdr_shaders_validate() {
let entity = crate::overlay::wgsl_constants() + include_str!("../entity.wgsl");
for source in [
include_str!("../hdr.wgsl"),
include_str!("../terrain.wgsl"),
&entity,
] {
let module = naga::front::wgsl::parse_str(source).unwrap();
naga::valid::Validator::new(
naga::valid::ValidationFlags::all(),
naga::valid::Capabilities::all(),
)
.validate(&module)
.unwrap();
}
}
fn caps(offered: &[(F, S)]) -> wgpu::SurfaceCapabilities {
wgpu::SurfaceCapabilities {
format_capabilities: offered
@@ -27,6 +27,8 @@ impl Column {
/// Values of type `T` per section key, in a dense list with stable keys and
/// slots that move only when a section is removed.
pub struct Resident<T> {
/// The minimum Y of section index 0 (the level's column).
min_y: i32,
items: Vec<(SectionKey, T)>,
slots: FxHashMap<SectionKey, u32>,
columns: Vec<Column>,
@@ -36,6 +38,7 @@ pub struct Resident<T> {
impl<T> Default for Resident<T> {
fn default() -> Self {
Self {
min_y: crate::chunk::MIN_Y,
items: Vec::new(),
slots: FxHashMap::default(),
columns: Vec::new(),
@@ -61,6 +64,10 @@ impl<T> Resident<T> {
pub fn get_mut(&mut self, slot: u32) -> &mut T {
&mut self.items[slot as usize].1
}
/// Sections from now on count from `min_y` (a level of another column).
pub fn set_min_y(&mut self, min_y: i32) {
self.min_y = min_y;
}
pub fn clear(&mut self) {
self.items.clear();
self.slots.clear();
@@ -144,10 +151,10 @@ pub struct Visible {
}
/// The camera-relative origin of the section at `key`.
fn origin(key: SectionKey, camera: DVec3) -> DVec3 {
fn origin(key: SectionKey, min_y: i32, camera: DVec3) -> DVec3 {
DVec3::new(
f64::from(key.0 * 16),
f64::from(crate::chunk::MIN_Y + key.1 * 16),
f64::from(min_y + key.1 * 16),
f64::from(key.2 * 16),
) - camera
}
@@ -169,18 +176,19 @@ fn in_view(key: SectionKey, camera: DVec3, radius: i32, frustum: &Frustum) -> Op
if !in_view_distance(camera_column(camera), radius, key.0, key.2) {
return None;
}
in_frustum(key, camera, frustum, false)
in_frustum(key, crate::chunk::MIN_Y, camera, frustum, false)
}
/// `in_view` without the distance test; `inside`: the section's column is
/// entirely inside the frustum, so the section is too.
fn in_frustum(
key: SectionKey,
min_y: i32,
camera: DVec3,
frustum: &Frustum,
inside: bool,
) -> Option<(f64, Vec3)> {
let origin = origin(key, camera);
let origin = origin(key, min_y, camera);
let min = origin.as_vec3();
if !inside && !frustum.intersects(min, min + Vec3::splat(16.0)) {
return None;
@@ -216,8 +224,8 @@ impl<T> Resident<T> {
if !near && !beyond(column.x, column.z) {
continue;
}
let min = origin((column.x, column.low, column.z), camera).as_vec3();
let top = origin((column.x, column.high, column.z), camera).as_vec3();
let min = origin((column.x, column.low, column.z), self.min_y, camera).as_vec3();
let top = origin((column.x, column.high, column.z), self.min_y, camera).as_vec3();
let max = top + Vec3::splat(16.0);
let inside = frustum.contains(min, max);
if !inside && !frustum.intersects(min, max) {
@@ -228,7 +236,7 @@ impl<T> Resident<T> {
if near && !reachable(key) {
continue;
}
if let Some((d, o)) = in_frustum(key, camera, frustum, inside) {
if let Some((d, o)) = in_frustum(key, self.min_y, camera, frustum, inside) {
out.push(Visible {
distance: d.to_bits(),
key,
@@ -286,7 +294,7 @@ mod tests {
if near {
in_view(k, camera, radius, &frustum).filter(|_| reachable(k))
} else if beyond(k.0, k.2) {
in_frustum(k, camera, &frustum, false)
in_frustum(k, crate::chunk::MIN_Y, camera, &frustum, false)
} else {
None
}
@@ -329,8 +337,8 @@ mod tests {
.columns
.iter()
.filter(|c| {
let min = origin((c.x, c.low, c.z), camera).as_vec3();
let top = origin((c.x, c.high, c.z), camera).as_vec3();
let min = origin((c.x, c.low, c.z), crate::chunk::MIN_Y, camera).as_vec3();
let top = origin((c.x, c.high, c.z), crate::chunk::MIN_Y, camera).as_vec3();
frustum.contains(min, top + Vec3::splat(16.0))
})
.count();
+108 -5
View File
@@ -10,19 +10,36 @@ const CHUNK: u64 = 1 << 20;
pub struct Uploads {
belt: wgpu::util::StagingBelt,
chunk: u64,
}
impl Uploads {
pub fn new(device: &wgpu::Device) -> Self {
Self::with_chunk(device, CHUNK)
}
/// A belt whose staging buffers hold `chunk` bytes (larger writes get
/// a buffer of their own).
/// A belt whose staging buffers hold `chunk` bytes (a larger write gets
/// a buffer of its own, rounded up to a power of two).
pub fn with_chunk(device: &wgpu::Device, chunk: u64) -> Self {
Self {
belt: wgpu::util::StagingBelt::new(device.clone(), chunk),
chunk,
}
}
/// A mapped staging slice of at least `size` bytes. The belt gives a
/// write larger than its chunk a buffer of exactly that size, keeps it for
/// good and only reuses it for writes that fit: an upload that grows a
/// little every frame (the entity batch while mobs appear) took a new
/// buffer each frame until the game ran out of memory (#2826). Rounded up
/// to a power of two, the large buffers it keeps are reused, one per
/// doubling.
fn allocate(&mut self, size: NonZeroU64, alignment: NonZeroU64) -> wgpu::BufferSlice<'_> {
let size = if size.get() > self.chunk {
size.checked_next_power_of_two().unwrap_or(size)
} else {
size
};
self.belt.allocate(size, alignment)
}
/// Copy tightly packed RGBA8 `pixels` (`width` by `height`) into one mip
/// level of one array layer, padding rows to the copy alignment.
pub fn texture(
@@ -41,7 +58,7 @@ impl Uploads {
};
let alignment = NonZeroU64::new(u64::from(wgpu::COPY_BYTES_PER_ROW_ALIGNMENT))
.expect("non-zero alignment");
let slice = self.belt.allocate(size, alignment);
let slice = self.allocate(size, alignment);
{
let mut view = slice
.get_mapped_range_mut()
@@ -80,8 +97,20 @@ impl Uploads {
let Some(size) = NonZeroU64::new(bytes.len() as u64) else {
return;
};
self.belt
.write_buffer(encoder, target, offset, size)
// The belt's own `write_buffer` checks, kept now that a large write's
// slice is rounded up past them.
assert!(
offset.is_multiple_of(wgpu::COPY_BUFFER_ALIGNMENT)
&& size.get().is_multiple_of(wgpu::COPY_BUFFER_ALIGNMENT),
"buffer upload at {offset} of {size} bytes must be 4-byte aligned"
);
let alignment = NonZeroU64::new(wgpu::COPY_BUFFER_ALIGNMENT).expect("non-zero alignment");
let slice = self.allocate(size, alignment).slice(..size.get());
encoder.copy_buffer_to_buffer(slice.buffer(), slice.offset(), target, offset, size.get());
slice
.get_mapped_range_mut()
.expect("staging belt slices are mapped")
.slice(..)
.copy_from_slice(bytes);
}
/// Close this frame's staging buffers: they come back for reuse once the
@@ -217,6 +246,80 @@ mod tests {
}
}
/// Staging buffers the belt holds, once every submitted frame is done
/// with them. The belt only reports its buffers through `Debug`.
fn kept_buffers(device: &wgpu::Device, uploads: &mut Uploads) -> usize {
device.poll(wgpu::PollType::wait_indefinitely()).unwrap();
// Finishing an empty frame takes back every recalled buffer.
uploads.finish(&device.create_command_encoder(&Default::default()));
let belt = format!("{:?}", uploads.belt);
let count = |field: &str| -> usize {
let at = belt.find(&format!("{field}: ")).expect(&belt) + field.len() + 2;
let digits = belt[at..].split(|c: char| !c.is_ascii_digit()).next();
digits.and_then(|d| d.parse().ok()).expect(&belt)
};
count("active_chunks") + count("closed_chunks") + count("free_chunks")
}
/// #2826: a write larger than the chunk that grows a little every frame
/// (the entity batch while mobs appear) got a new exact-size buffer each
/// frame, all of them kept, until the game ran out of memory.
#[test]
fn growing_large_writes_reuse_the_belt_buffers() {
let Some((device, queue)) = device() else {
eprintln!("no GPU adapter: skipped");
return;
};
const CHUNK: u64 = 1 << 16;
const TARGET: usize = 4 * CHUNK as usize;
let target = device.create_buffer(&wgpu::BufferDescriptor {
label: None,
size: TARGET as u64,
usage: wgpu::BufferUsages::COPY_DST | wgpu::BufferUsages::COPY_SRC,
mapped_at_creation: false,
});
let readback = device.create_buffer(&wgpu::BufferDescriptor {
label: None,
size: TARGET as u64,
usage: wgpu::BufferUsages::MAP_READ | wgpu::BufferUsages::COPY_DST,
mapped_at_creation: false,
});
let mut uploads = Uploads::with_chunk(&device, CHUNK);
let mut expected = vec![0u8; TARGET];
let frames = 64;
for frame in 0..frames {
let mut encoder = device.create_command_encoder(&Default::default());
// One small write, then the large one, 1.5 to 3.5 chunks long.
uploads.buffer(&mut encoder, &target, TARGET as u64 - 4, &[9; 4]);
expected[TARGET - 4..].fill(9);
let len = (3 * CHUNK as usize / 2 + frame * 2048).next_multiple_of(4);
let bytes: Vec<u8> = (0..len).map(|i| (i + frame) as u8).collect();
uploads.buffer(&mut encoder, &target, 0, &bytes);
expected[..len].copy_from_slice(&bytes);
encoder.copy_buffer_to_buffer(&target, 0, &readback, 0, TARGET as u64);
uploads.finish(&encoder);
queue.submit([encoder.finish()]);
readback
.slice(..)
.map_async(wgpu::MapMode::Read, |r| r.unwrap());
device.poll(wgpu::PollType::wait_indefinitely()).unwrap();
// Only the written bytes land: the rest of the target is untouched.
assert!(
*readback.slice(..).get_mapped_range().unwrap() == expected[..],
"frame {frame}"
);
readback.unmap();
}
// A chunk for the small writes and a buffer per doubling of the large
// one (2 and 4 chunks), maybe one more where a small write took the
// start of a buffer the large one needed whole: not one per frame.
let kept = kept_buffers(&device, &mut uploads);
assert!(
kept <= 4,
"the belt kept {kept} buffers over {frames} frames"
);
}
#[test]
fn belt_buffer_writes_land_in_order_at_their_offsets() {
let Some((device, queue)) = device() else {
@@ -131,8 +131,20 @@ impl Style {
value: f32,
hover: bool,
active: bool,
dragging: bool,
) {
ui::slider(batch, atlas, x, y, w, label, value, hover && active, active);
ui::slider(
batch,
atlas,
x,
y,
w,
label,
value,
hover && active,
active,
dragging && active,
);
}
/// The cost tag and the description beside a control, wrapped to two lines.
pub fn description(
@@ -855,6 +855,7 @@ impl GraphicsUi {
value,
hover || self.dragging == Some(item),
live,
self.dragging == Some(item),
),
None => STYLE.button(
batch,
+31 -17
View File
@@ -12,7 +12,7 @@ struct Params {
peak: f32,
// 1 when this frame drew a world.
world: f32,
// 1 paints expanded pixels magenta (HORIZON_HDR_DEBUG=1).
// 1 greys what isn't expanded and tints what is (HORIZON_HDR_DEBUG=1).
debug: f32,
// 1 for an HDR10 swapchain, 0 for scRGB.
pq: f32,
@@ -20,19 +20,23 @@ struct Params {
black: f32,
// The HUD and menus' brightness as a share of paper white.
ui: f32,
// Per tier, low to very bright (hdr.rs `Tier`): the share of the headroom
// the brightest pixels get, and the brightness where the lift starts and
// where it is full.
share: vec4<f32>,
start: vec4<f32>,
full: vec4<f32>,
};
@group(0) @binding(2) var<uniform> params: Params;
// Light sources are lifted evenly rather than by a highlight curve: vanilla's
// textures were drawn for SDR, so a curve on their brightest pixels blows out
// near-white spots (glowstone) and leaves the rest (lava, a jack o'lantern's
// face) nearly as it was. Pixels brighter than LIFT_FULL get STRENGTH of the
// headroom, dimmer ones less down to none at LIFT_START (lava's crust, a
// lantern's metal), and no channel goes past the peak. Brightness is the mean
// of luminance and the brightest channel, so saturated light counts as bright.
const LIFT_START: f32 = 0.18;
const LIFT_FULL: f32 = 0.42;
const STRENGTH: f32 = 0.7;
// face) nearly as it was. Each tier's pixels brighter than its `full` get its
// `share` of the headroom, dimmer ones less down to none at its `start`
// (lava's crust, a lantern's metal), and no channel goes past the peak.
// Brightness is the mean of luminance and the brightest channel, so saturated
// light counts as bright.
// Whether `c` still shows the world pixel `w`: the same, or darkened evenly
// across its channels, as the vignette and other screen-wide tints darken it.
@@ -99,24 +103,34 @@ fn lift_black(e: vec3<f32>) -> vec3<f32> {
// Gamma 2.2, as SDR displays and the compositors' SDR paths decode it.
var light = pow(max(c, vec3(0.0)), vec3(2.2));
let w = textureLoad(world, at, 0);
// The world's alpha is 0 on light-emitting blocks, the sun and the moon
// (terrain.wgsl, the celestial pipeline): only those shine, and only where
// nothing was drawn over them since: grey text over the white sun still looks
// like the sun darkened, but it raised the frame's alpha.
// The world's alpha is below 0.75 on light sources, the sun and the moon
// (terrain.wgsl, the celestial pipeline): only those shine, by the tier it
// holds, the lower the brighter, and only where nothing was drawn over them
// since: grey text over the white sun still looks like the sun darkened, but
// it raised the frame's alpha.
var lifted = false;
if params.world > 0.5 && params.peak > 1.0 && w.a < 0.75 && !covered
&& shows_world(c, w.rgb) {
// Brightness of the world pixel, before the vignette darkens the frame
// toward its edges: a light source shines the same anywhere on screen.
let wl = pow(max(w.rgb, vec3(0.0)), vec3(2.2));
let y = 0.5 * (dot(wl, vec3(0.2126, 0.7152, 0.0722)) + max(wl.r, max(wl.g, wl.b)));
let lift = smoothstep(LIFT_START, LIFT_FULL, y);
let tier = u32(clamp(round(4.0 - 4.0 * w.a / 0.7), 1.0, 4.0)) - 1u;
let lift = smoothstep(params.start[tier], params.full[tier], y);
if lift > 0.0 {
let top = max(light.r, max(light.g, light.b));
let gain = min(1.0 + (params.peak - 1.0) * STRENGTH * lift, params.peak / max(top, 1e-4));
let gain = min(1.0 + (params.peak - 1.0) * params.share[tier] * lift, params.peak / max(top, 1e-4));
light *= max(gain, 1.0);
if params.debug > 0.5 {
light = mix(light, vec3(gain, 0.0, gain), 0.6);
}
lifted = true;
}
}
// HORIZON_HDR_DEBUG=1: what isn't lifted turns grey, what is keeps its
// colour with a magenta tint, so a lift shows on any colour.
if params.debug > 0.5 && params.world > 0.5 {
if lifted {
light *= vec3(1.0, 0.6, 1.0);
} else {
light = vec3(dot(light, vec3(0.2126, 0.7152, 0.0722)));
}
}
// The HUD and menus at their own brightness, by how much they cover.
+186 -50
View File
@@ -92,9 +92,9 @@ 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/<sha1>`), 64x64 each.
/// 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.
/// Vanilla registers a texture per skin. Here the slots are shared
/// (`skins::SkinSlots`): skins drawn in the last frame keep theirs, and a
/// skin past them shows the default skin until a slot frees up.
pub const SKIN_SLOTS: usize = 128;
/// Reused by the visible rows of the classic world selector.
pub const WORLD_ICON_SLOTS: usize = 32;
@@ -168,6 +168,31 @@ fn strip_frame(pixels: &[u8], stride: u32, x: u32, y: u32, w: u32, h: u32) -> Ve
}
out
}
/// The `animation` section of a texture's `.mcmeta`.
fn animation_of(mcmeta: Option<&str>) -> Option<AnimationMetadata> {
let meta: serde_json::Value = serde_json::from_str(mcmeta?).ok()?;
AnimationMetadata::from_json(&meta.get("animation")?.to_string()).ok()
}
/// An animated strip's first frame: the region the mcmeta's frame size picks
/// (`AnimationMetadataSection.frameSize`), which is the top-left square unless
/// it names other dimensions or the frames run along a row.
fn first_frame(
(w, h, pixels): (u32, u32, Vec<u8>),
animation: Option<&AnimationMetadata>,
) -> (u32, u32, Vec<u8>) {
let [fw, fh] = animation.map_or([w.min(h) as i32; 2], |meta| {
meta.frame_size(w as i32, h as i32)
});
match (u32::try_from(fw), u32::try_from(fh)) {
(Ok(fw), Ok(fh))
if fw > 0 && fh > 0 && w % fw == 0 && h % fh == 0 && (fw, fh) != (w, h) =>
{
let side = fw.max(fh);
(side, side, strip_frame(&pixels, w, 0, 0, fw, fh))
}
_ => (w, h, pixels),
}
}
/// `image` inside a one-texel border copied from its opposite edges, the
/// texels repeat addressing reads past each edge.
fn wrap_border((name, w, h, data): &PackedImage) -> PackedImage {
@@ -184,8 +209,9 @@ fn wrap_border((name, w, h, data): &PackedImage) -> PackedImage {
}
/// Sprites the atlas definitions (`atlases/*.json`) add beyond the texture
/// files already packed: generated ones (`paletted_permutations` such as the
/// armour trim sprites, `unstitch` regions) and files listed under another id.
fn atlas_sprites(root: &Path, packed: &[PackedImage]) -> Vec<PackedImage> {
/// armour trim sprites, `unstitch` regions) and files listed under another id,
/// such as other namespaces' item textures; and the animated ones' names.
fn atlas_sprites(root: &Path, packed: &[PackedImage]) -> (Vec<PackedImage>, Vec<String>) {
use crate::atlas_sources::{self, SpriteOrigin};
let have: std::collections::HashSet<&str> = packed.iter().map(|i| i.0.as_str()).collect();
let textures = atlas_sources::list_textures(root);
@@ -229,29 +255,45 @@ fn atlas_sprites(root: &Path, packed: &[PackedImage]) -> Vec<PackedImage> {
};
let first = |(name, origins): &(String, Vec<(usize, SpriteOrigin)>)| {
origins.iter().find_map(|(order, origin)| {
let mut animated = false;
let image = match origin {
SpriteOrigin::File(texture) => {
let path = texture.strip_prefix("minecraft:").unwrap_or(texture);
load(texture, "textures").map(|(w, h, p)| {
// Animated strips keep their first frame, like the packed files.
if h > w && (path.starts_with("block/") || path.starts_with("item/")) {
(w, w, p[..(w * w * 4) as usize].to_vec())
// Its path under `textures/` in any namespace (a server
// pack's `lobby:item/...` as well as vanilla's).
let path = texture.split_once(':').map_or(texture.as_str(), |(_, p)| p);
let file = atlas_sources::texture_path(root, texture, "textures");
decode(&file).ok().map(|image| {
// Animated strips keep their first frame and animate,
// like the packed files.
if path.starts_with("block/") || path.starts_with("item/") {
let mcmeta = fs::read_to_string(file.with_extension("png.mcmeta")).ok();
let animation = animation_of(mcmeta.as_deref());
animated = animation.is_some();
first_frame(image, animation.as_ref())
} else {
(w, h, p)
image
}
})
}
generated => atlas_sources::generate(generated, &load),
};
image.map(|(w, h, pixels)| (*order, (name.clone(), w, h, pixels)))
image.map(|(w, h, pixels)| (*order, (name.clone(), w, h, pixels), animated))
})
};
let mut out: Vec<_> = crate::par::par_map(&names, first)
.into_iter()
.flatten()
.collect();
out.sort_unstable_by_key(|(order, _)| *order);
out.into_iter().map(|(_, image)| image).collect()
out.sort_unstable_by_key(|(order, ..)| *order);
let animated = out
.iter()
.filter(|(.., animated)| *animated)
.map(|(_, image, _)| image.0.clone())
.collect();
(
out.into_iter().map(|(_, image, _)| image).collect(),
animated,
)
}
impl HudAtlas {
/// Keep a ready profile skin when another source only has its default.
@@ -425,37 +467,15 @@ impl HudAtlas {
.with_extension("")
.to_string_lossy()
.replace('\\', "/");
let (mut w, mut h, pixels) = decode(path).ok()?;
let image = decode(path).ok()?;
let mcmeta = fs::read_to_string(path.with_extension("png.mcmeta")).ok();
let animation = mcmeta
.as_deref()
.and_then(|json| serde_json::from_str::<serde_json::Value>(json).ok())
.and_then(|meta| {
meta.get("animation")
.and_then(|section| AnimationMetadata::from_json(&section.to_string()).ok())
});
// An animated strip keeps its first frame: the region the mcmeta's
// frame size picks (`AnimationMetadataSection.frameSize`), which is
// the top-left square unless it names other dimensions or the
// frames run along a row.
let animation = animation_of(mcmeta.as_deref());
// An animated strip keeps its first frame.
let frames = name.starts_with("block/") || name.starts_with("item/");
let pixels = if frames {
let stride = w;
let [fw, fh] = animation.as_ref().map_or([w.min(h) as i32; 2], |meta| {
meta.frame_size(w as i32, h as i32)
});
match (u32::try_from(fw), u32::try_from(fh)) {
(Ok(fw), Ok(fh))
if fw > 0 && fh > 0 && w % fw == 0 && h % fh == 0 && (fw, fh) != (w, h) =>
{
let side = fw.max(fh);
(w, h) = (side, side);
strip_frame(&pixels, stride, 0, 0, fw, fh)
}
_ => pixels,
}
let (w, h, pixels) = if frames {
first_frame(image, animation.as_ref())
} else {
pixels
image
};
// The default texture's size, when a pack's differs from it.
let gui_size = default_textures
@@ -507,7 +527,9 @@ impl HudAtlas {
images.push(image);
}
if full {
images.extend(atlas_sprites(root, &images));
let (more, more_animated) = atlas_sprites(root, &images);
images.extend(more);
animated.extend(more_animated);
}
// The title screen's "JAVA EDITION" banner reads "RUST EDITION".
if let Some(edition) = images
@@ -579,7 +601,15 @@ impl HudAtlas {
let Some(rect) = sprites.get(&name).copied() else {
continue;
};
let layer = loaded.insert(root, &format!("minecraft:{name}"))?;
// Another namespace's sprite is named with it (`lobby:item/...`).
let id = if name.contains(':') {
name.clone()
} else {
format!("minecraft:{name}")
};
let Ok(layer) = loaded.insert(root, &id) else {
continue;
};
let Some(animation) = loaded.animations.iter().find(|a| a.layer == layer).cloned()
else {
continue;
@@ -1108,6 +1138,7 @@ impl HudBatch {
cursor,
g,
c,
style.shadow_color,
bold,
style.is_italic(),
style.underlined == Some(true),
@@ -1120,8 +1151,12 @@ impl HudBatch {
}
self.patches.extend(font.take_patches());
let white = font.white();
let passes: &[bool] = if shadow { &[true, false] } else { &[false] };
// ARGB.scaleRGB(color, 0.25): the shadow's colour.
let has_shadow = shadow
|| glyphs
.iter()
.any(|glyph| glyph.3.is_some_and(|color| color != 0));
let passes: &[bool] = if has_shadow { &[true, false] } else { &[false] };
// ARGB.scaleRGB(color, 0.25): the default shadow colour.
let shade = |c: u32| {
let b = c.to_le_bytes();
rgba(
@@ -1132,20 +1167,42 @@ impl HudBatch {
)
};
for &is_shadow in passes {
for (gx, g, c, bold, italic, underline, strike, first, advance, object) in &glyphs {
for (
gx,
g,
c,
custom_shadow,
bold,
italic,
underline,
strike,
first,
advance,
object,
) in &glyphs
{
if let Some(object) = object {
if !is_shadow {
self.draw_inline_object(atlas, object, *gx, y, alpha);
}
continue;
}
// In the world a glyph whose shadow is 0 has none (hasShadow).
let has_shadow = shadow && !(world && shade(*c) == 0);
let shadow_color = if let Some(argb) = custom_shadow {
let text_alpha = (c >> 24) as u8 as u16;
let shadow_alpha = (argb >> 24) as u8 as u16;
let alpha = (shadow_alpha * text_alpha / 255) as u8;
rgba((argb >> 16) as u8, (argb >> 8) as u8, *argb as u8, alpha)
} else {
shade(*c)
};
let has_shadow = (custom_shadow.is_some_and(|argb| argb != 0)
|| custom_shadow.is_none() && shadow)
&& !(world && shadow_color == 0);
if is_shadow && !has_shadow {
continue;
}
let (dx, col) = if is_shadow {
(g.offset, shade(*c))
(g.offset, shadow_color)
} else {
(0.0, *c)
};
@@ -1863,6 +1920,39 @@ mod tests {
assert_eq!(rect.texels((atlas.width, atlas.height)), (16, 16));
assert_eq!(texel_at(&atlas, rect, 0, 0), [0, 255, 0, 255]);
}
#[test]
fn another_namespaces_animated_item_texture_packs_its_first_frame_and_animates() {
let root =
std::env::temp_dir().join(format!("horizon-atlas-ns-anim-{}", std::process::id()));
let atlases = root.join("assets/minecraft/atlases");
let item = root.join("assets/lobby/textures/item/npc");
fs::create_dir_all(&atlases).unwrap();
fs::create_dir_all(&item).unwrap();
fs::write(
atlases.join("items.json"),
r#"{"sources": [{"type": "directory", "source": "item", "prefix": "item/"}]}"#,
)
.unwrap();
// A server pack's NPC skin: two 16x16 frames, green then red.
write_strip(
&item.join("skin.png"),
16,
32,
&[[0, 255, 0, 255], [255, 0, 0, 255]],
Some(r#"{"animation": {"frametime": 3}}"#),
);
let atlas = HudAtlas::build(&root).unwrap();
let rect = atlas.sprites["lobby:item/npc/skin"];
// One frame, not the whole strip, which a model's UVs would span.
assert_eq!(rect.texels((atlas.width, atlas.height)), (16, 16));
assert_eq!(texel_at(&atlas, rect, 0, 15), [0, 255, 0, 255]);
let (_, animation) = atlas
.sprite_animations
.iter()
.find(|(r, _)| r.u0 == rect.u0 && r.v0 == rect.v0)
.expect("the namespaced sprite animates");
assert_eq!(animation.frame_count(), 2);
}
/// `count` images of `w x h`; layout reads only their sizes.
fn sized(count: usize, w: u32, h: u32) -> Vec<PackedImage> {
(0..count)
@@ -2025,6 +2115,52 @@ mod tests {
assert!(missing.rect.is_none() && missing.right == 5.0);
}
#[test]
fn component_shadow_color_overrides_text_call_shadow() {
let root = two_glyph_font("component-shadow");
let atlas = HudAtlas::build(&root).unwrap();
let mut batch = HudBatch::new([320, 240]);
let text = crate::text::Text::styled(
"a",
crate::text::Style {
shadow_color: Some(0x8040_2010),
..Default::default()
},
);
batch.text_styled(&atlas, &text, 10.0, 10.0, u32::MAX, false);
assert_eq!(batch.vertices.len(), 12);
assert_eq!(batch.vertices[0].color, rgba(0x40, 0x20, 0x10, 0x80));
batch.vertices.clear();
batch.text_styled_world(&atlas, &text, 10.0, 10.0, u32::MAX, false);
assert_eq!(batch.vertices.len(), 12);
assert_eq!(batch.vertices[0].depth, 0.0);
assert_eq!(batch.vertices[6].depth, 0.03);
batch.vertices.clear();
let no_shadow = crate::text::Text::styled(
"a",
crate::text::Style {
shadow_color: Some(0),
..Default::default()
},
);
batch.text_styled(&atlas, &no_shadow, 10.0, 10.0, u32::MAX, true);
assert_eq!(batch.vertices.len(), 6);
batch.vertices.clear();
let gradient = crate::component::to_text(
&serde_json::json!({
"text": "",
"extra": [
{"text": "a", "color": "#ff0000"},
{"text": "b", "color": "#0000ff"}
]
}),
&mut |_| crate::text::Text::empty(),
);
batch.text_styled(&atlas, &gradient, 10.0, 10.0, u32::MAX, false);
assert_eq!(batch.vertices[0].color, rgba(255, 0, 0, 255));
assert_eq!(batch.vertices[6].color, rgba(0, 0, 255, 255));
}
#[test]
fn player_object_draws_an_inline_head() {
let root = two_glyph_font("inline-head");
+3
View File
@@ -59,16 +59,19 @@ pub mod packs;
pub mod par;
pub mod particles;
pub mod poi_sections;
pub mod potent_sulfur;
pub mod providers;
pub mod screen_draw;
pub mod screen_effects;
pub mod sculk;
pub mod section_mask;
pub mod settings;
pub mod shader_pack_list;
pub mod signs;
pub mod skins;
pub mod sound_engine;
pub mod sound_events;
pub mod sound_preview;
pub mod spans;
pub mod split_layout;
mod sprite_cache;
+245 -29
View File
@@ -17,7 +17,7 @@
use crate::fast_hash::FxHashMap;
use crate::{
blocks::BlockFacts,
chunk::{Chunk, HEIGHT, Light, MIN_Y, SECTIONS, Section, index},
chunk::{Chunk, ColumnLayout, Light, Section, index},
};
use horizon_core::geometry::{Direction, ShapeOp, VoxelShape};
use horizon_world::registry::{BlockRegistry, BlockStateId};
@@ -273,7 +273,7 @@ pub fn light_chunk(
tables: &LightTables,
sky_light: bool,
) -> Vec<Light> {
region[1][1].expect("centre chunk");
let sections = region[1][1].expect("centre chunk").sections.len();
// Highest occupied section in the region bounds the work.
let mut top_section = 0;
for chunk in region.iter().flatten().flatten() {
@@ -286,7 +286,7 @@ pub fn light_chunk(
}
// One extra section above the highest occupied one: block light rises
// up to 14 blocks into it (sky light there is always 15).
let h = ((top_section + 1) * 16).min(HEIGHT as usize);
let h = ((top_section + 1) * 16).min(sections * 16);
let at = |x: usize, y: usize, z: usize| (y * W + z) * W + x;
// Packed cells (`type << 4 | dampening`), not state ids: the flood fill
// then never touches the large `LightTables::cells` table.
@@ -422,14 +422,21 @@ pub fn light_chunk(
};
spread(&mut sky, &mut sky_queue);
spread(&mut block, &mut queue);
pack_lighting(h, &sky, &block, sky_light)
pack_lighting(sections, h, &sky, &block, sky_light)
}
/// Extract just the centre column's light; never copy worker snapshot sections.
fn pack_lighting(h: usize, sky: &[u8], block: &[u8], sky_light: bool) -> Vec<Light> {
/// Extract just the centre column's light (`sections` of it); never copy
/// worker snapshot sections.
fn pack_lighting(
sections: usize,
h: usize,
sky: &[u8],
block: &[u8],
sky_light: bool,
) -> Vec<Light> {
let at = |x: usize, y: usize, z: usize| (y * W + z) * W + x;
let open = if sky_light { 0xF0 } else { 0x00 };
(0..SECTIONS)
(0..sections)
.map(|si| {
if si * 16 >= h {
return Light::Uniform(open);
@@ -460,13 +467,21 @@ fn pack_lighting(h: usize, sky: &[u8], block: &[u8], sky_light: bool) -> Vec<Lig
/// edits and immutable snapshots retained by other workers.
pub fn apply_lighting(chunk: &mut Chunk, lights: Vec<Light>) {
for (section, light) in chunk.sections.iter_mut().zip(lights) {
// A shared section already lit so stays as it is.
if let (Light::Uniform(a), Light::Uniform(b)) = (&section.light, &light)
&& a == b
{
continue;
}
Arc::make_mut(section).light = light;
}
crate::chunk::share_uniform(&mut chunk.sections);
}
/// `apply_lighting` for a chunk lit before: writes only the sections whose
/// light changed and adds the cells that changed to `changed`.
pub fn apply_relighting(chunk: &mut Chunk, lights: Vec<Light>, changed: &mut LightChanges) {
changed.keyed(chunk.layout());
for (sy, (section, light)) in chunk.sections.iter_mut().zip(lights).enumerate() {
let old = &section.light;
if let (Light::Uniform(a), Light::Uniform(b)) = (old, &light)
@@ -506,7 +521,8 @@ pub fn light_from_layers<L: AsRef<[u8]>>(
mut above: [u8; 256],
sky_light: bool,
) {
for (si, (sky, block)) in layers.iter().enumerate().take(SECTIONS).rev() {
let sections = chunk.sections.len();
for (si, (sky, block)) in layers.iter().enumerate().take(sections).rev() {
let sky = sky.as_ref().filter(|_| sky_light);
let section = Arc::make_mut(&mut chunk.sections[si]);
if sky.is_none() && block.is_none() && above.iter().all(|&v| v == above[0]) {
@@ -526,6 +542,7 @@ pub fn light_from_layers<L: AsRef<[u8]>>(
section.light = Light::Full(data);
section.compact();
}
crate::chunk::share_uniform(&mut chunk.sections);
chunk.lit = true;
chunk.light_loaded = true;
}
@@ -539,7 +556,8 @@ pub fn update_light_layers<L: AsRef<[u8]>>(
sky_light: bool,
) -> Vec<usize> {
let mut changed = Vec::new();
for (si, (sky, block)) in layers.iter().enumerate().take(SECTIONS) {
let sections = chunk.sections.len();
for (si, (sky, block)) in layers.iter().enumerate().take(sections) {
let sky = sky.as_ref().filter(|_| sky_light);
if sky.is_none() && block.is_none() {
continue;
@@ -569,8 +587,15 @@ pub trait LightWorld {
fn section(&self, cx: i32, s: usize, cz: i32) -> Option<&Arc<Section>>;
/// Replace the light of a section `section` returned.
fn set_section_light(&mut self, cx: i32, s: usize, cz: i32, light: Light);
/// The column the world's chunks hold (its level's).
fn layout(&self) -> ColumnLayout;
}
impl<S: std::hash::BuildHasher> LightWorld for HashMap<(i32, i32), Arc<Chunk>, S> {
fn layout(&self) -> ColumnLayout {
self.values()
.next()
.map_or(ColumnLayout::VANILLA, |c| c.layout())
}
fn section(&self, cx: i32, s: usize, cz: i32) -> Option<&Arc<Section>> {
self.get(&(cx, cz))
.filter(|c| c.lit)
@@ -587,6 +612,7 @@ impl<S: std::hash::BuildHasher> LightWorld for HashMap<(i32, i32), Arc<Chunk>, S
/// gets written is copied out on the first write and stored back by `finish`.
struct Region<'w> {
world: &'w mut dyn LightWorld,
layout: ColumnLayout,
slots: Vec<Slot>,
/// Section key (cx, s, cz) to slot, `NONE` where the chunk isn't lit.
index: FxHashMap<Pos, u32>,
@@ -602,6 +628,7 @@ const NONE: u32 = u32::MAX;
impl<'w> Region<'w> {
fn new(world: &'w mut dyn LightWorld) -> Self {
Self {
layout: world.layout(),
world,
slots: Vec::new(),
index: FxHashMap::default(),
@@ -610,10 +637,8 @@ impl<'w> Region<'w> {
}
#[inline]
fn slot(&mut self, x: i32, y: i32, z: i32) -> Option<usize> {
if !(MIN_Y..MIN_Y + HEIGHT).contains(&y) {
return None;
}
let key = (x >> 4, (y - MIN_Y) >> 4, z >> 4);
let s = self.layout.section_index(y)?;
let key = (x >> 4, s as i32, z >> 4);
if self.last.0 != key {
self.last = (key, self.load(key));
}
@@ -641,6 +666,12 @@ impl<'w> Region<'w> {
let slot = self.slot(x, y, z)?;
Some(self.slots[slot].section.get(index(x, y, z)))
}
/// The one state of the section holding `y`, when it has a single one.
fn uniform_state(&mut self, x: i32, y: i32, z: i32) -> Option<u32> {
let slot = self.slot(x, y, z)?;
let section = &self.slots[slot].section;
(section.blocks.bits() == 0).then(|| section.get(0))
}
/// Packed light (sky << 4 | block), None outside loaded, lit chunks.
fn light(&mut self, x: i32, y: i32, z: i32) -> Option<u8> {
let slot = self.slot(x, y, z)?;
@@ -702,12 +733,20 @@ type Pos = (i32, i32, i32);
#[derive(Clone, Debug, Default, PartialEq)]
pub struct LightChanges {
sections: FxHashMap<Pos, u32>,
/// The column the section indexes count in.
layout: ColumnLayout,
}
impl LightChanges {
/// Changes in chunks of `layout`: what the relighter or a light job adds
/// after this (they all come from one level).
fn keyed(&mut self, layout: ColumnLayout) {
debug_assert!(self.sections.is_empty() || self.layout == layout);
self.layout = layout;
}
/// A cell whose stored light changed.
#[inline]
pub fn push(&mut self, (x, y, z): Pos) {
let key = (x >> 4, (y - MIN_Y) >> 4, z >> 4);
let key = (x >> 4, (y - self.layout.min_y()) >> 4, z >> 4);
*self.sections.entry(key).or_default() |= 1 << Self::class(x, y, z);
}
/// Cells of section `key` (x, section index, z) in the given classes.
@@ -732,7 +771,7 @@ impl LightChanges {
self.sections.keys().copied()
}
/// Every section (x, section index, z) whose cells lie within one block
/// of a changed cell, section indexes outside `0..SECTIONS` left out (a
/// of a changed cell, section indexes outside the column left out (a
/// section next to several changed ones comes once for each).
pub fn dirty_sections(&self, mut out: impl FnMut(Pos)) {
// Per class, the bit set of neighbour offsets (dx, dy, dz in -1..=1,
@@ -759,6 +798,7 @@ impl LightChanges {
}
reach
};
let sections = self.layout.sections() as i32;
for (&(x, sy, z), &classes) in &self.sections {
let mut offsets = 0;
let mut rest = classes;
@@ -770,7 +810,7 @@ impl LightChanges {
let o = offsets.trailing_zeros() as i32;
offsets &= offsets - 1;
let s = sy + o / 3 % 3 - 1;
if (0..SECTIONS as i32).contains(&s) {
if (0..sections).contains(&s) {
out((x + o % 3 - 1, s, z + o / 9 - 1));
}
}
@@ -794,11 +834,21 @@ fn set_level(world: &mut Region, sky: bool, p: Pos, value: u8) {
/// `ChunkSkyLightSources`: the Y of the upper block of the highest occluded
/// edge in the column (every block at or above it is a sky source).
fn lowest_sky_source(world: &mut Region, tables: &LightTables, x: i32, z: i32) -> i32 {
let mut y = MIN_Y + HEIGHT - 1;
let (min_y, max_y) = (world.layout.min_y(), world.layout.max_y());
let mut y = max_y - 1;
let Some(mut top) = world.state(x, y, z) else {
return MIN_Y;
return min_y;
};
while y > MIN_Y {
while y > min_y {
// A section of one state that lets light through itself (the air of
// a tall column) holds no source edge: go to its bottom block.
if let Some(state) = world.uniform_state(x, y - 1, z)
&& state == top
&& !tables.edge_occluded(top as usize, top as usize)
{
y = ((y - 1 - min_y) & !15) + min_y;
continue;
}
let Some(bottom) = world.state(x, y - 1, z) else {
break;
};
@@ -808,7 +858,7 @@ fn lowest_sky_source(world: &mut Region, tables: &LightTables, x: i32, z: i32) -
top = bottom;
y -= 1;
}
MIN_Y
min_y
}
/// Vanilla's `checkBlock` + `runLightUpdates` for changed positions on
/// resident, lit chunks: clear the light that may have come through or from
@@ -825,9 +875,27 @@ pub fn relight(
changed: &mut LightChanges,
) {
let mut region = Region::new(world);
changed.keyed(region.layout);
relight_region(&mut region, tables, sky_light, positions, force, changed);
region.finish();
}
/// The columns `changed` touched that border a loaded column not lit yet
/// (`unlit`). `relight` reads and writes only lit columns, so an edit's
/// darkening can take away light such a neighbour sends in and never put it
/// back, and nothing relights the column when that neighbour's own light
/// lands: an air block at 0 beside one at 6 (#2786). Vanilla's light engine
/// keeps one light storage for every chunk, so its edits and its chunk
/// lighting see each other. These columns need a full light job, which
/// lights them from the blocks of their whole 3x3, that neighbour's included.
pub fn beside_unlit(changed: &LightChanges, unlit: impl Fn(i32, i32) -> bool) -> Vec<(i32, i32)> {
let mut columns: Vec<(i32, i32)> = changed.sections().map(|(x, _, z)| (x, z)).collect();
columns.sort_unstable();
columns.dedup();
columns.retain(|&(x, z)| {
(-1..=1).any(|dz| (-1..=1).any(|dx| (dx, dz) != (0, 0) && unlit(x + dx, z + dz)))
});
columns
}
fn relight_region(
world: &mut Region,
tables: &LightTables,
@@ -840,6 +908,7 @@ fn relight_region(
relight_layer(world, tables, false, positions.to_vec(), force, changed)
});
if sky_light {
let (min_y, max_y) = (world.layout.min_y(), world.layout.max_y());
let mut seeds = positions.to_vec();
let mut columns: FxHashMap<(i32, i32), i32> = FxHashMap::default();
crate::spans::time("lt_columns", || {
@@ -851,13 +920,13 @@ fn relight_region(
columns.insert((x, z), source);
// Cells whose source status changed: non-15 at or above the new
// lowest source, and old 15s (sources) below it.
for y in source..MIN_Y + HEIGHT {
for y in source..max_y {
if level(world, true, (x, y, z)).is_some_and(|l| l != 15) {
seeds.push((x, y, z));
}
}
let mut y = source - 1;
while y >= MIN_Y && level(world, true, (x, y, z)) == Some(15) {
while y >= min_y && level(world, true, (x, y, z)) == Some(15) {
seeds.push((x, y, z));
y -= 1;
}
@@ -977,6 +1046,7 @@ fn relight_layer(
#[cfg(test)]
mod tests {
use super::*;
use crate::chunk::{HEIGHT, MIN_Y, SECTIONS};
const AIR: u32 = 0;
const STONE: u32 = 1;
@@ -1004,11 +1074,18 @@ mod tests {
)
}
fn world(edit: impl Fn(&mut Chunk)) -> HashMap<(i32, i32), Arc<Chunk>> {
world_of(crate::chunk::ColumnLayout::VANILLA, edit)
}
/// Lit chunks around (0, 0) of `layout`, stone up to y 0.
fn world_of(
layout: crate::chunk::ColumnLayout,
edit: impl Fn(&mut Chunk),
) -> HashMap<(i32, i32), Arc<Chunk>> {
let mut chunks = HashMap::new();
for z in -1..=1 {
for x in -1..=1 {
let mut c = Chunk::empty(x, z);
for y in MIN_Y..0 {
let mut c = Chunk::with_layout(x, z, layout);
for y in layout.min_y()..0 {
for i in 0..256 {
c.set(i & 15, y, i >> 4, STONE);
}
@@ -1072,6 +1149,70 @@ mod tests {
// Without the shape test the room would be lit (slabs have no dampening).
assert_eq!(sky(&w, 8, 2, 8), 0, "the full bottom face stops sky light");
}
/// #2786: (1, 0) is loaded but its own light job hasn't landed; (0, 0)
/// was lit from the 3x3's blocks, its torch's light and the far torch's
/// in (1, 0) both. Taking its torch away darkens everything the torch
/// lit, the far torch's light at the border too, and `relight` cannot
/// bring that back from a column it doesn't read. Columns like that are
/// lit again whole; without it the border stays at 0 for good once
/// (1, 0)'s light lands beside it.
#[test]
fn an_edit_beside_a_column_not_lit_yet_lights_the_column_again() {
let tables = tables();
let mut w: HashMap<(i32, i32), Arc<Chunk>> = HashMap::new();
for z in -1..=1 {
for x in -1..=1 {
let mut c = Chunk::empty(x, z);
for y in MIN_Y..0 {
for i in 0..256 {
c.set(i & 15, y, i >> 4, STONE);
}
}
if (x, z) == (0, 0) {
c.set(14, 0, 8, TORCH);
} else if (x, z) == (1, 0) {
c.set(6, 0, 8, TORCH);
}
w.insert((x, z), Arc::new(c));
}
}
let light = |w: &HashMap<(i32, i32), Arc<Chunk>>, (x, z): (i32, i32)| {
let region: [[Option<&Chunk>; 3]; 3] = std::array::from_fn(|dz| {
std::array::from_fn(|dx| {
w.get(&(x + dx as i32 - 1, z + dz as i32 - 1)).map(|c| &**c)
})
});
light_chunk(&region, &tables, true)
};
let keys: Vec<_> = w.keys().copied().collect();
for key in &keys {
let lights = light(&w, *key);
let c = Arc::make_mut(w.get_mut(key).unwrap());
apply_lighting(c, lights);
c.lit = *key != (1, 0);
}
// The far torch at x 22 gives 7 at x 15; (0, 0)'s own torch gives 13.
assert_eq!(block(&w, 15, 0, 8), 13);
Arc::make_mut(w.get_mut(&(0, 0)).unwrap()).set(14, 0, 8, AIR);
let mut changed = LightChanges::default();
relight(&mut w, &tables, true, &[(14, 0, 8)], false, &mut changed);
let again = beside_unlit(&changed, |x, z| w.get(&(x, z)).is_some_and(|c| !c.lit));
for &key in &again {
let lights = light(&w, key);
let c = Arc::make_mut(w.get_mut(&key).unwrap());
apply_relighting(c, lights, &mut LightChanges::default());
}
// (1, 0)'s own job lands.
let lights = light(&w, (1, 0));
let c = Arc::make_mut(w.get_mut(&(1, 0)).unwrap());
apply_lighting(c, lights);
c.lit = true;
assert_eq!(block(&w, 16, 0, 8), 8);
assert_eq!(block(&w, 15, 0, 8), 7, "air beside 8 across the border");
assert_eq!(block(&w, 14, 0, 8), 6);
assert!(again.contains(&(0, 0)), "{again:?}");
}
#[test]
fn relight_keeps_unchanged_and_unlit_sections() {
let mut w = world(|_| {});
@@ -1218,6 +1359,74 @@ mod tests {
}
}
#[test]
fn a_tall_column_is_lit_to_its_top() {
let layout = crate::chunk::ColumnLayout::new(-64, 2096).unwrap();
let mut chunk = Chunk::with_layout(0, 0, layout);
for i in 0..256 {
chunk.set(i & 15, 1600, i >> 4, STONE);
}
chunk.set(8, 1500, 8, TORCH);
let region = [[None; 3], [None, Some(&chunk), None], [None; 3]];
let lights = light_chunk(&region, &tables(), true);
assert_eq!(lights.len(), 131);
apply_lighting(&mut chunk, lights);
assert_eq!(chunk.light(8, 1500, 8) & 15, 14);
assert_eq!(chunk.light(8, 1501, 8) & 15, 13);
assert_eq!(chunk.light(8, 1601, 8) >> 4, 15);
assert_eq!(chunk.light(8, 1599, 8) >> 4, 0, "under the roof");
assert_eq!(chunk.light(8, 2031, 8), 0xF0);
// The empty sections above are one shared allocation.
let top = chunk.sections.len() - 1;
assert!(Arc::ptr_eq(&chunk.sections[top], &chunk.sections[top - 10]));
let other = Chunk::with_layout(1, 0, layout);
apply_lighting(&mut other.clone(), vec![Light::Uniform(0xF0); 131]);
let mut lit = other.clone();
apply_lighting(&mut lit, vec![Light::Uniform(0xF0); 131]);
assert!(Arc::ptr_eq(&chunk.sections[top], &lit.sections[top]));
}
#[test]
fn a_tall_column_relights_as_its_full_light_and_keys_its_sections() {
let layout = crate::chunk::ColumnLayout::new(-64, 2096).unwrap();
let mut w = world_of(layout, |c| {
for i in 0..256 {
c.set(i & 15, 1900, i >> 4, STONE);
}
});
let edits = [
((8, 1800, 8), TORCH),
((8, 1900, 8), AIR),
((3, 2020, 3), TORCH),
];
let mut changed = LightChanges::default();
for ((x, y, z), state) in edits {
Arc::make_mut(w.get_mut(&(0, 0)).unwrap()).set(x, y, z, state);
relight(&mut w, &tables(), true, &[(x, y, z)], false, &mut changed);
}
let region: [[Option<&Chunk>; 3]; 3] = std::array::from_fn(|dz| {
std::array::from_fn(|dx| w.get(&(dx as i32 - 1, dz as i32 - 1)).map(|c| &**c))
});
let full = light_chunk(&region, &tables(), true);
assert_eq!(full.len(), 131);
for (si, s) in full.iter().enumerate() {
for i in 0..4096 {
assert_eq!(
s.get(i),
w[&(0, 0)].sections[si].light(i),
"section {si} index {i}"
);
}
}
// y 2020 is section 130 of the tall column, the top one.
assert!(
changed
.sections()
.any(|(x, sy, z)| (x, sy, z) == (0, 130, 0))
);
let mut dirty = Vec::new();
changed.dirty_sections(|s| dirty.push(s.1));
assert!(dirty.iter().all(|&sy| (0..131).contains(&sy)), "{dirty:?}");
}
#[test]
fn incremental_relight_matches_full_relight() {
let mut w = world(|c| {
c.set(8, 0, 8, TORCH);
@@ -1448,9 +1657,10 @@ mod tests {
.iter()
.all(|v| matches!(v, Light::Uniform(n) if *n == if sky { 0xF0 } else { 0 }))
);
let section = Arc::as_ptr(&chunk.sections[0]);
apply_lighting(&mut chunk, lights);
assert_eq!(section, Arc::as_ptr(&chunk.sections[0]));
// Uniform sections are one shared allocation (`share_uniform`).
let first = &chunk.sections[0];
assert!(chunk.sections.iter().all(|s| Arc::ptr_eq(s, first)));
}
}
@@ -1521,7 +1731,7 @@ mod tests {
let mut old = fixture.clone();
let mut new = fixture.clone();
baseline_apply(&mut old, baseline_pack(&fixture, h, &sky, &block));
apply_lighting(&mut new, pack_lighting(h, &sky, &block, true));
apply_lighting(&mut new, pack_lighting(SECTIONS, h, &sky, &block, true));
for (a, b) in old.sections.iter().zip(&new.sections) {
for i in 0..4096 {
assert_eq!(a.light(i), b.light(i));
@@ -1538,14 +1748,20 @@ mod tests {
let mut current = fixture.clone();
let held = shared.then(|| current.clone());
// Warm up and detach for the uniquely-owned scenario.
apply_lighting(&mut current, pack_lighting(h, &sky, &block, true));
apply_lighting(&mut current, pack_lighting(SECTIONS, h, &sky, &block, true));
let started = Instant::now();
for _ in 0..500 {
let retained = shared.then(|| current.clone());
if optimized {
apply_lighting(
black_box(&mut current),
pack_lighting(h, black_box(&sky), black_box(&block), true),
pack_lighting(
SECTIONS,
h,
black_box(&sky),
black_box(&block),
true,
),
);
} else {
baseline_apply(
+262 -12
View File
@@ -161,8 +161,40 @@ impl Column {
self.spans.push(span);
}
}
/// `kinds`: `state_kinds`, per block state.
fn from_chunk(chunk: &Chunk, kinds: &[u8], x: i32, z: i32) -> Self {
/// Open water and its floor lit as open sky, as the seed's far columns
/// are: a chunk's own light fades a level per block of water, so the
/// chunks a player passed drew a darker band through the seed's sea.
/// The water is one span again.
fn light_open_water(&mut self, kinds: &[u8]) {
// Water; lava glows.
let water = |span: &Span| {
let kind = kinds.get(span.state.0 as usize).copied().unwrap_or(0);
kind & FLUID != 0 && kind >> 4 == 0
};
if !self.spans.last().is_some_and(water) {
return;
}
let floor = self
.spans
.iter()
.rposition(|span| !water(span))
.unwrap_or(0);
for (i, mut span) in std::mem::take(&mut self.spans).into_iter().enumerate() {
if i >= floor {
span.light |= 0xf0;
}
self.push(span);
}
}
/// `kinds`: `state_kinds`, per block state; `water`: `water_source(kinds)`,
/// what blocks holding water (kelp, seagrass, waterlogged ones) are drawn as.
fn from_chunk(
chunk: &Chunk,
kinds: &[u8],
water: Option<BlockStateId>,
x: i32,
z: i32,
) -> Self {
let kind = |state: BlockStateId| kinds.get(state.0 as usize).copied().unwrap_or(0);
let face_light = |y: i32| {
let mut sky = 0;
@@ -187,7 +219,7 @@ impl Column {
};
let mut column = Self::default();
for (sy, section) in chunk.sections.iter().enumerate() {
let min = MIN_Y + sy as i32 * 16;
let min = chunk.min_y() + sy as i32 * 16;
let uniform = section.blocks.bits() == 0
&& section.biomes.bits() == 0
&& matches!(section.light, crate::chunk::Light::Uniform(_));
@@ -197,11 +229,17 @@ impl Column {
let step = if uniform { 16 } else { 1 };
for offset in (0..16).step_by(step) {
let y = min + offset;
let state = BlockStateId(chunk.get(x, y, z));
let kind = kind(state);
let mut state = BlockStateId(chunk.get(x, y, z));
let mut kind = kind(state);
if kind & KEPT == 0 {
continue;
}
if kind & WATERY != 0
&& let Some(water) = water
{
state = water;
kind = kinds[water.0 as usize];
}
let light = face_light(y);
column.push(Span {
min: y as i16,
@@ -212,6 +250,7 @@ impl Column {
});
}
}
column.light_open_water(kinds);
let mut water = None;
for span in column.spans.iter().rev() {
if kind(span.state) & FLUID != 0 {
@@ -230,7 +269,7 @@ impl Column {
&& let Some((height, state)) = water
{
column.surface = Some(Surface {
height: MIN_Y,
height: chunk.min_y(),
state: BlockStateId(
kinds.iter().position(|&kind| kind & AIR != 0).unwrap_or(0) as u32
),
@@ -243,15 +282,28 @@ impl Column {
}
/// A chunk's 256 columns (`Column::from_chunk`), on the far-terrain worker.
fn summarize(chunk: &Chunk, kinds: &[u8]) -> Arc<[Column; 256]> {
let water = water_source(kinds);
Arc::new(std::array::from_fn(|i| {
Column::from_chunk(chunk, kinds, (i & 15) as i32, (i >> 4) as i32)
Column::from_chunk(chunk, kinds, water, (i & 15) as i32, (i >> 4) as i32)
}))
}
/// `state_kinds` bits: kept in columns, a fluid, the air state; the light
/// emission is in the high nibble.
/// The water source state: the first plain kept fluid without light
/// (`minecraft:water` comes before lava, and its level 0 first).
fn water_source(kinds: &[u8]) -> Option<BlockStateId> {
kinds
.iter()
.position(|&kind| kind == KEPT | FLUID)
.map(|i| BlockStateId(i as u32))
}
/// `state_kinds` bits: kept in columns, a fluid, the air state, a block
/// holding water; the light emission is in the high nibble.
const KEPT: u8 = 1;
const FLUID: u8 = 2;
const AIR: u8 = 4;
/// A block holding water that draws as none (kelp, seagrass, bubble columns,
/// waterlogged blocks that aren't kept): far terrain draws water there, or
/// kelp reaching the surface leaves holes in the sea.
const WATERY: u8 = 8;
/// What `Column::from_chunk` needs of each block state, read from the facts
/// once: matching their names for every block made observing a chunk slow.
fn state_kinds(facts: &BlockFacts) -> Vec<u8> {
@@ -270,14 +322,29 @@ fn state_kinds(facts: &BlockFacts) -> Vec<u8> {
|| f.full_collision
|| f.name.ends_with("_leaves")
|| chorus
|| fluid);
(u8::from(kept) * KEPT)
| (u8::from(fluid) * FLUID)
|| fluid
|| nearly_full(&f.name));
let watery = !kept && !facts.is_air(state) && f.fluid == crate::blocks::Fluid::Water;
(u8::from(kept || watery) * KEPT)
| (u8::from(fluid || watery) * FLUID)
| (u8::from(watery) * WATERY)
| (u8::from(state == facts.air) * AIR)
| (f.emission.min(15) << 4)
})
.collect()
}
/// Blocks that fill their cell but neither draw solid nor collide as a full
/// block: far terrain draws them as blocks, or patches of powder snow leave
/// holes in mountains (and paths and fields dips).
fn nearly_full(name: &str) -> bool {
matches!(
name,
"minecraft:powder_snow"
| "minecraft:dirt_path"
| "minecraft:farmland"
| "minecraft:honey_block"
) || name.ends_with("_stairs")
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct TileKey {
pub x: i32,
@@ -1059,6 +1126,16 @@ impl Lod {
})
.copied()
.collect();
// Retiring fine columns are empty stand-ins, excluded from `active`
// while their normal meshes still cover the gap. Request their detail
// explicitly: neither the active-tile requests nor sampling an already
// ready stand-in can fill it, so its GPU sections would never retire.
keys.extend(retiring_detail(
&self.plan,
&self.retiring,
&self.saved,
&self.detail_masks,
));
keys.sort_unstable_by_key(|key| (key.distance(camera), *key));
let mut chunks = FxHashSet::default();
for key in keys {
@@ -1563,11 +1640,84 @@ impl Drop for Lod {
}
}
}
/// Fine retiring stand-ins need actual column detail before `Plan::replaces`
/// can release their normal meshes. The caller keeps the usual 32-column
/// request budget and waits for the replacement mesh before changing cutout.
fn retiring_detail<'a>(
plan: &'a Plan,
retiring: &'a FxHashSet<(i32, i32)>,
saved: &'a Saved,
masks: &'a FxHashMap<TileKey, [u64; 4]>,
) -> impl Iterator<Item = TileKey> + 'a {
retiring.iter().filter_map(move |&(x, z)| {
let key = TileKey { x, z, level: 0 };
(plan.nodes.contains(&key)
&& !saved.contains_key(&(x, z))
&& masks.get(&key) != Some(&[u64::MAX; 4]))
.then_some(key)
})
}
#[cfg(test)]
mod tests {
use super::*;
use crate::mesher::TerrainVertex;
#[test]
fn retiring_fine_stand_ins_request_detail_before_their_gpu_meshes_can_retire() {
let column = (12, 0);
let fine = TileKey {
x: 12,
z: 0,
level: 0,
};
let mut plan = Plan::default();
plan.nodes.insert(fine);
let ready: FxHashMap<TileKey, ()> = [(fine, ())].into_iter().collect();
let retiring = [column].into_iter().collect();
let saved = Saved::default();
let mut masks = FxHashMap::default();
// A covered stand-in is ready, but empty: ordinary sampling skips it,
// and selection leaves it out of `active`. It cannot yet replace the
// old full-detail column, even though the near world has unloaded it.
assert!(!plan.replaces(column, &ready, |key| masks.get(&key)
== Some(&[u64::MAX; 4])));
assert_eq!(
retiring_detail(&plan, &retiring, &saved, &masks).collect::<Vec<_>>(),
[fine]
);
// The existing RequestDetail -> apply_fine path marks complete detail;
// only then may selection retire it and publish the new mesh cutout.
masks.insert(fine, [u64::MAX; 4]);
assert!(
retiring_detail(&plan, &retiring, &saved, &masks)
.next()
.is_none()
);
assert!(plan.replaces(column, &ready, |key| masks.get(&key)
== Some(&[u64::MAX; 4])));
}
#[test]
fn retiring_detail_requests_only_planned_columns_still_missing_detail() {
let fine = |x| TileKey { x, z: 0, level: 0 };
let mut plan = Plan::default();
plan.nodes.extend((0..4).map(fine));
plan.nodes.insert(fine(5));
let retiring = (0..5).map(|x| (x, 0)).collect();
let saved = [((1, 0), Arc::new(std::array::from_fn(|_| Column::default())))]
.into_iter()
.collect();
let masks = [
(fine(2), [u64::MAX; 4]),
(fine(3), [u64::MAX, u64::MAX, u64::MAX, u64::MAX - 1]),
]
.into_iter()
.collect();
let mut requested: Vec<_> = retiring_detail(&plan, &retiring, &saved, &masks).collect();
requested.sort_unstable();
// Saved or complete detail needs no request; an unplanned retiree and
// a planned column that is not retiring must not consume the budget.
assert_eq!(requested, [fine(0), fine(3)]);
}
#[test]
fn reduced_far_detail_only_merges_tiles_away_from_the_near_terrain() {
let leaves = |plan: &Plan| {
plan.nodes
@@ -1772,6 +1922,82 @@ mod tests {
);
}
#[test]
fn open_water_and_its_floor_are_lit_as_the_seed_lights_them() {
let span = |min, max, state, light| Span {
min,
max,
state: BlockStateId(state),
biome: 0,
light,
};
// 0 air, 1 stone, 2 water, 3 lava.
let kinds = [AIR, KEPT, KEPT | FLUID, KEPT | FLUID | 15 << 4];
// A chunk's own light: a cave, the floor, water fading a level a block.
let mut sea = Column {
surface: None,
spans: vec![
span(30, 40, 1, 0),
span(40, 48, 1, 0x10 | 2 << 12),
span(48, 61, 2, 0x20),
span(61, 62, 2, 0xe0),
span(62, 63, 2, 0xf0),
],
};
sea.light_open_water(&kinds);
assert_eq!(
sea.spans,
[
span(30, 40, 1, 0),
span(40, 48, 1, 0xf0 | 2 << 12),
span(48, 63, 2, 0xf0)
]
);
// Land, and lava, keep their light.
for top in [1, 3] {
let mut column = Column {
surface: None,
spans: vec![span(40, 50, 2, 0x20), span(50, 63, top, 0x80)],
};
let before = column.spans.clone();
column.light_open_water(&kinds);
assert_eq!(column.spans, before);
}
}
#[test]
fn nearly_full_blocks_are_kept() {
assert!(nearly_full("minecraft:powder_snow"));
assert!(nearly_full("minecraft:dirt_path"));
assert!(nearly_full("minecraft:oak_stairs"));
assert!(!nearly_full("minecraft:oak_fence"));
assert!(!nearly_full("minecraft:wheat"));
}
#[test]
fn kelp_to_the_surface_is_drawn_as_water() {
// 0 air, 1 stone, 2 water, 3 kelp (holds water, draws as none).
let kinds = [AIR, KEPT, KEPT | FLUID, KEPT | FLUID | WATERY];
let mut chunk = Chunk::empty(0, 0);
for x in [3, 4] {
for y in MIN_Y..40 {
chunk.set(x, y, 3, 1);
}
}
for y in 40..63 {
chunk.set(3, y, 3, 3);
chunk.set(4, y, 3, 2);
}
let water = water_source(&kinds);
assert_eq!(water, Some(BlockStateId(2)));
let kelp = Column::from_chunk(&chunk, &kinds, water, 3, 3);
let sea = Column::from_chunk(&chunk, &kinds, water, 4, 3);
assert_eq!(kelp.spans, sea.spans);
assert_eq!(
kelp.spans.last().map(|s| (s.min, s.max, s.state)),
Some((40, 63, BlockStateId(2)))
);
assert_eq!(kelp.surface.unwrap().water, Some((63, BlockStateId(2))));
assert_eq!(kelp.surface.unwrap().height, 40);
}
#[test]
fn coarse_voxels_reduce_the_area_instead_of_inflating_one_leaf() {
let span = |min, max, state| Span {
min,
@@ -1967,6 +2193,24 @@ mod tests {
chunk.set(8, 71, 8, chorus.0);
chunk.set(8, 72, 8, chorus.0);
chunk.set(8, 73, 8, flower.0);
// Kelp to the surface is water; powder snow and a waterlogged stair
// are kept as themselves.
let state = |name: &str| assets.registry.default_state(name).unwrap();
let (kelp, powder_snow) = (state("minecraft:kelp"), state("minecraft:powder_snow"));
let stair = facts
.states
.iter()
.position(|f| &*f.name == "minecraft:oak_stairs" && f.waterlogged)
.map(|i| BlockStateId(i as u32))
.unwrap();
chunk.set(2, 54, 2, stone.0);
for y in 55..64 {
chunk.set(2, y, 2, kelp.0);
}
chunk.set(6, 90, 6, stone.0);
chunk.set(6, 91, 6, powder_snow.0);
chunk.set(10, 54, 10, stone.0);
chunk.set(10, 55, 10, stair.0);
lod.observe(Arc::new(chunk.clone()), &facts);
receive_observed(&mut lod);
let observed = &lod.saved[&(-1, -1)];
@@ -1984,6 +2228,12 @@ mod tests {
.collect::<Vec<_>>(),
vec![(70, 71, end_stone), (71, 73, chorus), (73, 74, flower)]
);
let kelp_column = &observed[2 * 16 + 2];
assert_eq!(kelp_column.surface.unwrap().height, 55);
assert_eq!(kelp_column.surface.unwrap().water, Some((64, water)));
assert_eq!(observed[6 * 16 + 6].surface.unwrap().state, powder_snow);
assert_eq!(observed[6 * 16 + 6].surface.unwrap().height, 92);
assert_eq!(observed[10 * 16 + 10].surface.unwrap().state, stair);
let fine = TileKey {
x: -1,
+13 -2
View File
@@ -45,9 +45,20 @@ pub fn data_dir() -> PathBuf {
std::env::temp_dir()
}
/// Where the launcher runs the game and keeps its saves: `HORIZON_HOME`, else `horizon` in the
/// platform data folder (launcher/src/backend.rs `game_home`).
/// `--home DIR`, set once at start; it wins over `HORIZON_HOME`.
static HOME: std::sync::OnceLock<PathBuf> = std::sync::OnceLock::new();
/// Makes `game_home` return `home` for the rest of the run (`--home`).
pub fn set_game_home(home: PathBuf) {
let _ = HOME.set(home);
}
/// Where the launcher runs the game and keeps its saves: `--home`, else `HORIZON_HOME`, else
/// `horizon` in the platform data folder (launcher/src/backend.rs `game_home`).
pub fn game_home() -> PathBuf {
if let Some(home) = HOME.get() {
return home.clone();
}
match std::env::var_os("HORIZON_HOME").filter(|h| !h.is_empty()) {
Some(h) => PathBuf::from(h),
None => data_dir().join("horizon"),
+137 -21
View File
@@ -123,9 +123,25 @@ mod vertex_tests {
fn emission_keeps_the_colour_and_the_free_bits() {
let rgb = super::pack_rgb([0x12, 0x34, 0x56]);
assert_eq!(super::emitting(rgb, 0), rgb);
assert_eq!(super::emitting(rgb, 9), 0xF656_3412);
assert_eq!(super::emitting(rgb, 15), 0xF056_3412);
assert_eq!(super::emitting(rgb, 15) | super::EMISSION_BITS, rgb);
assert_eq!(super::emitting(rgb, super::INCANDESCENT), 0xFD56_3412);
assert_eq!(super::emitting(rgb, super::VERY_BRIGHT), 0xFB56_3412);
assert_eq!(
super::emitting(rgb, super::VERY_BRIGHT) | super::EMISSION_BITS,
rgb
);
}
#[test]
fn light_sources_shine_by_kind_not_light_level() {
use super::{BRIGHT, INCANDESCENT, LOW, hdr_tier};
assert_eq!(hdr_tier("glowstone", 15), BRIGHT);
// A candle's flame is a particle: the block keeps only its wick.
assert_eq!(hdr_tier("torch", 14), INCANDESCENT);
assert_eq!(hdr_tier("red_candle", 3), LOW);
assert_eq!(hdr_tier("glow_lichen", 7), 0);
assert_eq!(hdr_tier("stone", 0), 0);
// Unlisted ones by their light level.
assert_eq!(hdr_tier("ochre_froglight", 15), INCANDESCENT);
assert_eq!(hdr_tier("sculk_sensor", 1), LOW);
}
}
pub struct SectionMesh {
@@ -263,6 +279,8 @@ enum Tint {
/// `BlockTintSources.grassBlock`: grass in the world, none on its particles.
GrassBlock,
TallGrassUpper,
SugarCane,
LilyPad,
Foliage,
DryFoliage,
Water,
@@ -282,6 +300,8 @@ struct Info {
/// `getShadeBrightness` (ambient occlusion contribution).
shade: f32,
emission: u8,
/// `hdr_tier`.
tier: u8,
/// `emissiveRendering`: drawn and sampled at full brightness.
emissive: bool,
fluid: FluidState,
@@ -329,6 +349,10 @@ pub struct MeshTables {
lava_still: u16,
lava_flow: u16,
}
fn stem_color(age: u8) -> u32 {
let a = u32::from(age);
(a * 32) << 16 | (255 - a * 8) << 8 | (a * 4)
}
fn redstone_color(power: u8) -> u32 {
// RedstoneWireBlock.COLORS
let f = f32::from(power) / 15.0;
@@ -377,10 +401,9 @@ impl MeshTables {
([Tint::Grass; 2], 1)
}
}
"fern" | "short_grass" | "potted_fern" | "bush" | "sugar_cane" => {
([Tint::Grass; 2], 1)
}
"fern" | "short_grass" | "potted_fern" | "bush" => ([Tint::Grass; 2], 1),
"grass_block" => ([Tint::GrassBlock; 2], 1),
"sugar_cane" => ([Tint::SugarCane; 2], 1),
"pink_petals" | "wildflowers" => ([Tint::None, Tint::Grass], 2),
"spruce_leaves" => ([Tint::Constant(0x61_9961); 2], 1),
"birch_leaves" => ([Tint::Constant(0x80_A755); 2], 1),
@@ -395,7 +418,7 @@ impl MeshTables {
([Tint::Constant(0xE0_C71C); 2], 1)
}
"melon_stem" | "pumpkin_stem" => ([Tint::Stem(prop("age")); 2], 1),
"lily_pad" => ([Tint::Constant(0x20_8030); 2], 1),
"lily_pad" => ([Tint::LilyPad; 2], 1),
_ => ([Tint::None; 2], 0),
};
// getShadeBrightness overrides; the default is 0.2 for full collision shapes.
@@ -450,6 +473,7 @@ impl MeshTables {
permeable: !s.solid_render || s.dampening == 0,
shade,
emission: s.emission,
tier: hdr_tier(name, s.emission),
emissive,
fluid: FluidState::from_block(state)?,
model: s.render_shape == RenderShape::Model,
@@ -491,6 +515,25 @@ impl MeshTables {
tint_sources: i.tint_count,
})
}
/// `BlockTintSource.color(state)`: block-model colour without a level.
/// `grass` is `GrassColor.getDefaultColor()` from the active pack's colormap.
/// Untinted faces, blank sources and invalid tint indices return `None`.
pub fn default_tint(&self, state: BlockStateId, index: i32, grass: u32) -> Option<u32> {
let info = self.info.get(state.0 as usize)?;
if index < 0 || index >= i32::from(info.tint_count) {
return None;
}
Some(match info.tints[index as usize] {
Tint::None | Tint::SugarCane | Tint::Water => return None,
Tint::Grass | Tint::GrassBlock | Tint::TallGrassUpper => grass & 0xFF_FFFF,
Tint::Foliage => 0x48_B518,
Tint::DryFoliage => 0x5C_3C32,
Tint::LilyPad => 0x71_C35C,
Tint::Constant(c) => c,
Tint::Redstone(p) => redstone_color(p),
Tint::Stem(age) => stem_color(age),
})
}
/// `TerrainParticle`'s colour: tint source 0's `colorAsTerrainParticle`,
/// which is the in-world (biome-blended) colour except on grass blocks,
/// whose dirt crumbs stay untinted. `None` when the state has no source.
@@ -513,6 +556,56 @@ impl MeshTables {
let mut tints = Tints::new(region, biomes, zoom, blend_radius, origin);
Mesher::tint(info, 0, &mut tints, [x & 15, y & 15, z & 15])
}
/// `BlockColors` for each of the state's tint indices at `pos`, as the
/// chunk mesher tints them (grass blocks included): `None` for an
/// untinted (-1) layer. For block models drawn outside the chunk mesh.
pub fn block_tints(
&self,
state: BlockStateId,
pos: [i32; 3],
region: &[[Option<&Chunk>; 3]; 3],
biomes: &Biomes,
zoom: BiomeZoom,
blend_radius: i32,
) -> impl Fn(i32) -> Option<u32> + use<> {
let sources = self.info.get(state.0 as usize).map(|info| {
let [x, y, z] = pos;
let origin = [x >> 4, z >> 4, y & !15];
let mut tints = Tints::new(region, biomes, zoom, blend_radius, origin);
let local = [x & 15, y & 15, z & 15];
let colors = [0, 1].map(|i| Mesher::tint(info, i, &mut tints, local));
(colors, i32::from(info.tint_count))
});
move |index| {
let (colors, count) = sources?;
if index < 0 || index >= count {
return None;
}
colors[(index as usize).min(1)]
}
}
/// `ModelBlockRenderer.tesselateFlat`'s light coords (`LightCoordsUtil`
/// packing, the quad's own emission included) for `quad` of `state`
/// drawn as the only block at `pos`, as `MovingBlockRenderState` gives
/// it: `light` is the world's stored light (sky << 4 | block) at a
/// position. For block models drawn outside the chunk mesh.
pub fn flat_light(
&self,
state: BlockStateId,
pos: [i32; 3],
quad: &horizon_assets::bake::ModelQuad,
light: impl Fn([i32; 3]) -> u8,
) -> u32 {
let own = self.info.get(state.0 as usize);
let full = own.is_some_and(|i| i.full);
let at = lighting::flat_position(pos, &quad.positions, quad.facing, quad.cull, full);
let packed = light(at);
let coords = match own {
Some(own) => lighting::packed_coords(own, packed),
None => u32::from(packed & 15) << 4 | u32::from(packed >> 4) << 20,
};
lighting::with_emission(coords, quad.light_emission)
}
/// `BlockState.getOffset` for blocks with a random model offset.
pub fn offset(&self, state: BlockStateId, x: i32, z: i32) -> Option<[f64; 3]> {
offset(self.info.get(state.0 as usize)?, x, z)
@@ -546,7 +639,7 @@ impl Padded {
fn new(region: &[[Option<&Chunk>; 3]; 3], sy: i32) -> Self {
let mut blocks = vec![0u32; P * P * P];
let mut light = vec![0u8; P * P * P];
let base_y = MIN_Y + sy * 16;
let base_y = region[1][1].map_or(MIN_Y, Chunk::min_y) + sy * 16;
// The section itself is unpacked in one pass; the border cells of the
// neighbouring sections are read one by one.
let mut own = Box::new([0u32; 4096]);
@@ -580,13 +673,37 @@ impl Padded {
}
/// Set on a terrain vertex's sprite layer when its texture alpha must be ignored.
pub const OPAQUE_LAYER: u16 = 1 << 15;
/// The bits of `TerrainVertex::color`'s alpha byte that hold the light its face emits, for
/// HDR output's highlights (`gfx/hdr.rs`): 15 minus the level, so the usual 0xFF means none.
/// The byte's other four bits stay set.
/// The bits of `TerrainVertex::color`'s alpha byte that hold how brightly its face shines
/// in HDR output (`gfx/hdr.rs`): 15 minus the tier, so the usual 0xFF means none. The
/// byte's other four bits stay set.
pub const EMISSION_BITS: u32 = 0x0F00_0000;
/// `color` marked as emitting light `level` (0 to 15).
pub fn emitting(color: u32, level: u8) -> u32 {
color & !EMISSION_BITS | u32::from(15 - level.min(15)) << 24
/// HDR tiers, by the kind of light rather than its level: a candle's flame is as bright as
/// a torch's, it only lights less around it. 0 stays as in SDR.
pub const LOW: u8 = 1;
pub const INCANDESCENT: u8 = 2;
pub const BRIGHT: u8 = 3;
/// The sun and lightning.
pub const VERY_BRIGHT: u8 = 4;
/// `color` marked as shining at `tier` (0 to `VERY_BRIGHT`).
pub fn emitting(color: u32, tier: u8) -> u32 {
color & !EMISSION_BITS | u32::from(15 - tier.min(VERY_BRIGHT)) << 24
}
/// The HDR tier of block `name` (no namespace), which emits light `level`.
pub fn hdr_tier(name: &str, level: u8) -> u8 {
match name {
_ if level == 0 => 0,
"glowstone" | "jack_o_lantern" | "campfire" | "soul_campfire" | "soul_lantern"
| "soul_torch" | "soul_wall_torch" | "soul_fire" => BRIGHT,
"torch" | "wall_torch" | "lantern" | "lava" | "crying_obsidian" | "fire"
| "sea_lantern" => INCANDESCENT,
"redstone_torch" | "redstone_wall_torch" | "magma_block" => LOW,
// Its flame is a particle.
_ if name.ends_with("candle") || name.ends_with("candle_cake") => LOW,
// A faint glow in the dark, as in SDR.
"glow_lichen" => 0,
_ if level >= 10 => INCANDESCENT,
_ => LOW,
}
}
const UNSET: u32 = u32::MAX;
const NO_BIOME: u16 = u16::MAX;
@@ -731,7 +848,7 @@ impl Mesher<'_> {
}
let pad = Padded::new(region, sy);
out.visibility = visibility(&pad, &self.tables.info);
let base_y = MIN_Y + sy * 16;
let base_y = center.min_y() + sy * 16;
let mut tints = Tints::new(
region,
self.biomes,
@@ -838,17 +955,15 @@ impl Mesher<'_> {
}
Some(match state.tints[(index as usize).min(1)] {
Tint::None => return None,
Tint::Grass | Tint::GrassBlock => tints.get(Resolver::Grass, x, y, z),
Tint::Grass | Tint::GrassBlock | Tint::SugarCane => tints.get(Resolver::Grass, x, y, z),
Tint::TallGrassUpper => tints.get(Resolver::Grass, x, y, z),
Tint::Foliage => tints.get(Resolver::Foliage, x, y, z),
Tint::DryFoliage => tints.get(Resolver::Dry, x, y, z),
Tint::Water => tints.get(Resolver::Water, x, y, z),
Tint::Constant(c) => c,
Tint::LilyPad => 0x20_8030,
Tint::Redstone(p) => redstone_color(p),
Tint::Stem(age) => {
let a = u32::from(age);
(a * 32) << 16 | (255 - a * 8) << 8 | (a * 4)
}
Tint::Stem(age) => stem_color(age),
})
}
#[allow(clippy::too_many_arguments)]
@@ -864,6 +979,7 @@ impl Mesher<'_> {
state: &Info,
) {
let q = &face.quad;
let tier = state.tier.max(hdr_tier("", q.light_emission));
let shade_face = q.shade_direction_override.unwrap_or(q.facing);
let directional = lighting::cardinal(self.nether_shading, shade_face);
// Grey level per vertex before tinting, and vanilla light coords.
@@ -903,7 +1019,7 @@ impl Mesher<'_> {
} else {
face.layer as u16
},
emitting(pack_rgb(rgb), state.emission.max(q.light_emission)),
emitting(pack_rgb(rgb), tier),
pack_coords(lighting::with_emission(coords[i], q.light_emission)),
));
}
@@ -227,8 +227,11 @@ pub(super) fn tesselate(
} else {
0xFF_FFFF
};
// Lava emits light level 15.
let emission = if water { 0 } else { 15 };
let emission = if water {
0
} else {
crate::mesher::INCANDESCENT
};
let color = |by: f32| {
let rgb = [16, 8, 0].map(|shift| lighting::scale((tint >> shift & 255) as i32, by) as u32);
crate::mesher::emitting(pack_rgb(rgb), emission)
@@ -39,10 +39,13 @@ fn state<'a>(pad: &Padded, info: &'a [Info], p: [i32; 3]) -> &'a Info {
/// `LightCoordsUtil.getLightCoords`: light at `p` as seen through `state`
/// (block level << 4 | sky level << 20).
pub(super) fn coords(pad: &Padded, state: &Info, p: [i32; 3]) -> u32 {
packed_coords(state, pad.light[pi(p[0], p[1], p[2])])
}
/// `coords` of a stored light byte (sky level << 4 | block level).
pub(super) fn packed_coords(state: &Info, packed: u8) -> u32 {
if state.emissive {
return FULL_BRIGHT;
}
let packed = pad.light[pi(p[0], p[1], p[2])];
let block = u32::from((packed & 15).max(state.emission));
block << 4 | u32::from(packed >> 4) << 20
}
@@ -274,8 +277,28 @@ pub(super) fn flat(
positions: &[[f32; 3]; 4],
face: D,
) -> u32 {
let cubic = shape(positions, face, own.full).cubic;
coords(pad, own, if cubic { step(pos, face) } else { pos })
coords(
pad,
own,
flat_position(pos, positions, face, None, own.full),
)
}
/// Where `tesselateFlat` reads the light of a quad of a block at `pos`: the
/// neighbour on its cull face, else `prepareQuadFlat`'s choice (the neighbour
/// when the quad is cubic, else the block itself). `full` is the block's
/// `isCollisionShapeFullBlock`.
pub(super) fn flat_position(
pos: [i32; 3],
positions: &[[f32; 3]; 4],
face: D,
cull: Option<D>,
full: bool,
) -> [i32; 3] {
match cull {
Some(d) => step(pos, d),
None if shape(positions, face, full).cubic => step(pos, face),
None => pos,
}
}
/// `prepareQuadAmbientOcclusion`: per-vertex AO brightness (before `ARGB.gray`)
/// and smooth light coords, by vertex index.
@@ -398,6 +421,39 @@ mod tests {
assert_eq!(max_coords(packed(3, 9), packed(7, 2)), packed(7, 9));
}
#[test]
fn flat_light_reads_the_neighbour_a_face_looks_at() {
let pos = [4, 64, -2];
let full_top = [
[0.0, 1.0, 0.0],
[0.0, 1.0, 1.0],
[1.0, 1.0, 1.0],
[1.0, 1.0, 0.0],
];
// A cull face samples its neighbour, whatever the quad's shape.
let inset = full_top.map(|[x, _, z]| [x, 0.75, z]);
assert_eq!(
flat_position(pos, &inset, D::Up, Some(D::Up), false),
[4, 65, -2]
);
// A flush quad without a cull face samples its neighbour too: a block
// drawn at a cell that is now opaque (a moving block, #3002) still
// takes the light around it.
assert_eq!(
flat_position(pos, &full_top, D::Up, None, false),
[4, 65, -2]
);
let west = [
[0.0, 0.0, 0.0],
[0.0, 0.0, 1.0],
[0.0, 1.0, 1.0],
[0.0, 1.0, 0.0],
];
assert_eq!(flat_position(pos, &west, D::West, None, false), [3, 64, -2]);
// An inset quad (a piston head's arm) takes the block's own light.
assert_eq!(flat_position(pos, &inset, D::Up, None, false), pos);
assert_eq!(flat_position(pos, &inset, D::Up, None, true), [4, 65, -2]);
}
#[test]
fn quad_shape_classifies_partial_and_cubic_faces() {
let full_top = [
[0.0, 1.0, 0.0],
@@ -54,3 +54,40 @@ fn terrain_particles_use_the_particle_sprite_and_vanilla_tint_sources() {
assert_eq!(tint("minecraft:pink_petals"), None);
assert_eq!(tint("minecraft:stone"), None);
}
/// Blocks drawn outside the chunk mesh (moved by a piston) take the chunk
/// mesher's per-layer tints: a grass block's top and side overlay are tinted
/// as in the world, not left gray like its particles.
#[test]
fn block_tints_match_the_chunk_mesh_for_grass_blocks() {
let root =
std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../.local/horizon-client/26.3");
if !root.join("horizon-resources.json").exists() {
return;
}
let assets = Assets::load(&root).unwrap();
let render = assets.reload(&root).unwrap();
let facts = BlockFacts::load(&root, assets.registry).unwrap();
let visibility = crate::models::load_visibility(&root, assets.registry).unwrap();
let tables = MeshTables::new(&assets, &render, &facts, visibility).unwrap();
let biomes = Biomes::load(&root).unwrap();
let state = |name| assets.registry.default_state(name).unwrap();
let center = Chunk::empty(0, 0);
let mut region = [[None; 3]; 3];
region[1][1] = Some(&center);
let tints = |name| {
tables.block_tints(
state(name),
[5, 70, 9],
&region,
&biomes,
BiomeZoom::new(0),
2,
)
};
let grass = tints("minecraft:grass_block");
assert!(grass(0).is_some());
assert_eq!(grass(-1), None);
assert_eq!(tints("minecraft:spruce_leaves")(0), Some(0x61_9961));
assert_eq!(tints("minecraft:stone")(0), None);
}
@@ -77,6 +77,7 @@ fn info(solid: bool) -> Info {
permeable: false,
shade: 1.0,
emission: 0,
tier: 0,
emissive: false,
fluid: FluidState::EMPTY,
model: false,
+8 -7
View File
@@ -8,7 +8,7 @@
//! changed.
use crate::{
blocks::{BlockFacts, Fluid, MAP_COLORS},
chunk::{Chunk, MIN_Y, SECTIONS},
chunk::Chunk,
fast_hash::FxHashMap,
world::World,
};
@@ -113,7 +113,8 @@ fn scan_column(
return (color | WALL, head as i16, 0);
}
}
while y > MIN_Y {
let bottom = chunk.min_y();
while y > bottom {
let (mut color, flags) = palette.get(chunk.get(x, y, z));
if color == 0 {
y -= 1;
@@ -123,7 +124,7 @@ fn scan_column(
let fluid = flags & FLUID;
if fluid != 0 {
let mut below = y - 1;
while below > MIN_Y && palette.get(chunk.get(x, below, z)).1 & FLUID != 0 {
while below > bottom && palette.get(chunk.get(x, below, z)).1 & FLUID != 0 {
depth = depth.saturating_add(1);
below -= 1;
}
@@ -134,11 +135,11 @@ fn scan_column(
}
return (color, y as i16, depth);
}
(0, MIN_Y as i16, 0)
(0, bottom as i16, 0)
}
/// The highest block of a chunk worth scanning from.
fn top_of(chunk: &Chunk, air: u32, layer: Layer) -> i32 {
let surface = (0..SECTIONS)
let surface = (0..chunk.sections.len())
.rev()
.find(|&s| {
chunk
@@ -146,7 +147,7 @@ fn top_of(chunk: &Chunk, air: u32, layer: Layer) -> i32 {
.get(s)
.is_some_and(|sec| !sec.is_uniform(air))
})
.map_or(MIN_Y, |s| MIN_Y + s as i32 * 16 + 15);
.map_or(chunk.min_y(), |s| chunk.min_y() + s as i32 * 16 + 15);
match layer {
Layer::Surface => surface,
Layer::Below(head) => surface.min(head),
@@ -156,7 +157,7 @@ fn scan_tile(chunk: &Chunk, palette: &Palette, air: u32, layer: Layer, revision:
let top = top_of(chunk, air, layer);
let mut tile = Tile {
color: [0; 256],
height: [MIN_Y as i16; 256],
height: [chunk.min_y() as i16; 256],
depth: [0; 256],
revision,
layer,
@@ -45,6 +45,7 @@ pub struct ModelInstance {
pub layer: u32,
pub shade: f32,
}
#[derive(Default)]
pub struct PreparedModels {
pub catalog: StateModels,
pub placements: Vec<(BlockPos, BlockStateId)>,
@@ -42,6 +42,9 @@ pub struct BakedModel {
pub cube: Option<[super::cube::CubeStyle; 6]>,
}
type VariantKey = (String, [u8; 3], bool);
/// Empty by default: no state has a model (a dedicated server, which draws
/// nothing).
#[derive(Default)]
pub struct StateModels {
/// Each definition's choices, a variant standing as its index in `baked`.
choices: Vec<CompiledChoices<u32>>,
+289 -114
View File
@@ -141,9 +141,7 @@ impl Opt {
| Opt::ChunkFade
| Opt::ImprovedTransparency
| Opt::ChunkBuilder
// Saved, but the creative tabs, the quit keys and the mouse
// don't read them yet.
| Opt::OperatorItemsTab
// Saved, but the quit keys and the mouse don't read them yet.
| Opt::QuitShortcuts
| Opt::CtrlClickEmulatesRightClick
)
@@ -254,7 +252,7 @@ impl Opt {
Opt::NotificationDisplayTime => "options.notifications.display_time",
Opt::Narrator => "options.narrator",
Opt::TextBackground => "options.accessibility.text_background",
Opt::ChatDelay => "Chat Delay",
Opt::ChatDelay => "horizon.options.chat_delay",
Opt::DistortionEffects => "options.screenEffectScale",
Opt::FovEffects => "options.fovEffectScale",
Opt::DarknessPulsing => "options.darknessEffectScale",
@@ -673,25 +671,25 @@ impl Opt {
} else {
"options.key.hold"
}),
Opt::PadLightbar => Text::literal(match s.controller.lightbar {
gamepad::Lightbar::Health => "Health",
gamepad::Lightbar::Dimension => "Dimension",
gamepad::Lightbar::Off => "Off",
Opt::PadLightbar => tr(match s.controller.lightbar {
gamepad::Lightbar::Health => "horizon.options.lightbar.health",
gamepad::Lightbar::Dimension => "horizon.options.lightbar.dimension",
gamepad::Lightbar::Off => "options.off",
}),
Opt::PadGlyphs => Text::literal(match s.controller.glyphs {
GlyphStyle::Auto => "Auto",
GlyphStyle::Xbox => "Xbox",
GlyphStyle::PlayStation => "PlayStation",
GlyphStyle::Nintendo => "Nintendo",
Opt::PadGlyphs => tr(match s.controller.glyphs {
GlyphStyle::Auto => "horizon.options.glyphs.auto",
GlyphStyle::Xbox => "horizon.options.glyphs.xbox",
GlyphStyle::PlayStation => "horizon.options.glyphs.playstation",
GlyphStyle::Nintendo => "horizon.options.glyphs.nintendo",
}),
Opt::PadMenuNav => Text::literal(match s.controller.menu_nav {
gamepad::MenuNav::Focus => "Focus",
gamepad::MenuNav::Pointer => "Pointer",
Opt::PadMenuNav => tr(match s.controller.menu_nav {
gamepad::MenuNav::Focus => "horizon.options.menu_focus",
gamepad::MenuNav::Pointer => "horizon.options.menu_pointer",
}),
Opt::PadKeyboard => Text::literal(match s.controller.keyboard {
gamepad::TextKeyboard::Auto => "Auto",
gamepad::TextKeyboard::Horizon => "Horizon",
gamepad::TextKeyboard::Steam => "Steam",
Opt::PadKeyboard => tr(match s.controller.keyboard {
gamepad::TextKeyboard::Auto => "horizon.options.keyboard.auto",
gamepad::TextKeyboard::Horizon => "horizon.options.keyboard.horizon",
gamepad::TextKeyboard::Steam => "horizon.options.keyboard.steam",
}),
_ => Text::empty(),
}
@@ -952,6 +950,24 @@ pub fn set_slider(opt: Opt, s: &mut Settings, v: f32) {
apply_preset(s);
}
}
/// A slider pressed or dragged to `v`: apply it live, and tell the game when
/// a category volume changed (`Options.createSoundSliderOptionInstance`'s
/// callback, which `OptionInstance.set` runs only for a new value).
fn drag_slider(opt: Opt, s: &mut Settings, v: f32, events: &mut Vec<Event>) {
let volume = |s: &Settings| match opt {
Opt::Volume(0) => Some(s.master_volume),
Opt::Volume(i) => Some(s.volumes[i]),
_ => None,
};
let before = volume(s);
set_slider(opt, s, v);
events.push(Event::SliderDrag);
if let (Opt::Volume(source), Some(after)) = (opt, volume(s))
&& before != Some(after)
{
events.push(Event::Volume(source, after));
}
}
/// GraphicsPreset.apply: the options Fast, Fancy and Fabulous set (texture
/// filtering and anisotropy have no option here yet).
pub fn apply_preset(s: &mut Settings) {
@@ -1106,6 +1122,9 @@ pub enum Event {
Changed,
/// A slider is being dragged: apply settings live but defer saving.
SliderDrag,
/// A category volume slider (`SoundSource` index) moved to a new value,
/// after its `SliderDrag` (the sound slider's `onValueUpdate`).
Volume(usize, f32),
/// The language changed (reload translations).
Language(String),
/// The pack selection changed (reload resources).
@@ -1273,22 +1292,14 @@ fn option_widget(s: &Settings, opt: Opt, x: f32, y: f32, w: f32) -> Widget {
/// What a button opening one of Horizon's pages says on hover.
fn horizon_page_tooltip(page: Page) -> Option<&'static str> {
Some(match page {
Page::Horizon => "Horizon's own settings: graphics, controllers, extras and mods.",
Page::Graphics => "Graphics, simply: each setting says what it costs.",
Page::GraphicsAdvanced => {
"Every graphics setting, Horizon's included, with what each costs."
}
Page::Controller => "Controllers: their buttons, sticks, vibration and menu navigation.",
Page::Extras => {
"Optional additions, all off by default: the game stays vanilla until you turn one on."
}
Page::Agent => "Let your own AI agent play: horizon-ctl and MCP clients on this computer.",
Page::ShaderPacks => {
"Shader packs from the shaderpacks folder: Horizon's own and those in the shaders/ format. One runs at a time."
}
Page::Mods => {
"Mods made for Horizon, from the horizon-mods folder. Each runs in a sandbox and stays off until you turn it on."
}
Page::Horizon => "horizon.pages.settings.tooltip",
Page::Graphics => "horizon.pages.graphics.tooltip",
Page::GraphicsAdvanced => "horizon.pages.graphics_advanced.tooltip",
Page::Controller => "horizon.pages.controller.tooltip",
Page::Extras => "horizon.pages.extras.tooltip",
Page::Agent => "horizon.pages.agent.tooltip",
Page::ShaderPacks => "horizon.pages.shader_packs.tooltip",
Page::Mods => "horizon.pages.mods.tooltip",
_ => return None,
})
}
@@ -1421,16 +1432,16 @@ impl OptionsUi {
Page::Language => "options.language.title",
Page::Font => "options.font.title",
Page::Packs => "resourcePack.title",
Page::Mods => "Mods",
Page::Mods => "horizon.pages.mods",
Page::NativeMod(_) => "Mod Settings",
Page::ShaderPacks => "Shader Packs",
Page::ShaderPacks => "horizon.pages.shader_packs",
Page::Graphics | Page::GraphicsAdvanced | Page::GraphicsHdr => "options.videoTitle",
Page::Controller => "Controller Settings",
Page::PadBinds => "Controller Binds",
Page::Extras => "Horizon Extras",
Page::Controller => "horizon.pages.controller",
Page::PadBinds => "horizon.pages.controller_binds",
Page::Extras => "horizon.pages.extras",
Page::Credits => "credits_and_attribution.screen.title",
Page::Horizon => "Horizon Settings",
Page::Agent => "AI Agent",
Page::Horizon => "horizon.pages.settings",
Page::Agent => "horizon.pages.agent",
}
}
fn scrollbar_x(&self, width: f32) -> f32 {
@@ -1568,21 +1579,23 @@ impl OptionsUi {
Page::Horizon => {
// Two to a row, as vanilla's OptionsList.addSmall lays out
// buttons; each opens a page built from vanilla's widgets.
let open = |label: &str, page: Page| {
button(0.0, 0.0, 150.0, Text::literal(label), Act::Push(page))
};
let open =
|key: &str, page: Page| button(0.0, 0.0, 150.0, tr(key), Act::Push(page));
vec![
Row::Buttons(
open("Graphics...", Page::Graphics),
Some(open("Advanced Graphics...", Page::GraphicsAdvanced)),
open("horizon.pages.open.graphics", Page::Graphics),
Some(open(
"horizon.pages.open.graphics_advanced",
Page::GraphicsAdvanced,
)),
),
Row::Buttons(
open("Shader Packs...", Page::ShaderPacks),
Some(open("Controller Settings...", Page::Controller)),
open("horizon.pages.open.shader_packs", Page::ShaderPacks),
Some(open("horizon.pages.open.controller", Page::Controller)),
),
Row::Buttons(
open("Extras...", Page::Extras),
Some(open("Mods...", Page::Mods)),
open("horizon.pages.open.extras", Page::Extras),
Some(open("horizon.pages.open.mods", Page::Mods)),
),
// No AI hides the AI Agent page and everything AI.
Row::Buttons(
@@ -1590,7 +1603,7 @@ impl OptionsUi {
Some(if s.extras.no_ai {
self.extra_button(s, crate::extras::Item::NoAi)
} else {
open("AI Agent...", Page::Agent)
open("horizon.pages.open.agent", Page::Agent)
}),
),
]
@@ -1609,7 +1622,7 @@ impl OptionsUi {
0.0,
0.0,
150.0,
Text::literal("Copy Connection Details"),
tr("horizon.agent.copy_details"),
Act::CopyAgentDetails,
)),
)];
@@ -1623,14 +1636,14 @@ impl OptionsUi {
0.0,
0.0,
150.0,
Text::literal("Horizon Graphics..."),
tr("horizon.pages.open.horizon_graphics"),
Act::Push(Page::Graphics),
),
Some(button(
0.0,
0.0,
150.0,
Text::literal("Advanced Graphics..."),
tr("horizon.pages.open.graphics_advanced"),
Act::Push(Page::GraphicsAdvanced),
)),
)];
@@ -1723,7 +1736,7 @@ impl OptionsUi {
0.0,
0.0,
310.0,
Text::literal("Controller Settings..."),
tr("horizon.pages.open.controller"),
Act::Push(Page::Controller),
),
None,
@@ -1736,7 +1749,7 @@ impl OptionsUi {
0.0,
0.0,
310.0,
Text::literal("Controller Binds..."),
tr("horizon.pages.open.controller_binds"),
Act::Push(Page::PadBinds),
),
None,
@@ -1794,9 +1807,7 @@ impl OptionsUi {
Page::Font => pairs(&[Opt::ForceUnicode, Opt::JapaneseGlyphs]),
Page::Mods => {
if s.mods.installed.is_empty() {
return vec![Row::Header(
"No mods: put .hmod files in the horizon-mods folder",
)];
return vec![Row::Header("horizon.mods.empty")];
}
s.mods
.installed
@@ -1806,9 +1817,9 @@ impl OptionsUi {
let mut label = Text::literal(format!("{}: ", installed.title))
.append(on_off(s.mods.is_on(i)));
if installed.problem.is_some() {
label = label.append(" (Stopped)");
label = label.append(tr("horizon.mods.stopped"));
} else if installed.dev {
label = label.append(" (Dev)");
label = label.append(tr("horizon.mods.dev"));
}
let dead = installed.dev || installed.id.is_empty();
// A native mod gets its settings page's button beside
@@ -1819,7 +1830,7 @@ impl OptionsUi {
0.0,
0.0,
150.0,
Text::literal("Settings"),
tr("horizon.mods.settings"),
Act::ModSettings(i),
);
Row::Buttons(
@@ -1836,17 +1847,17 @@ impl OptionsUi {
Page::NativeMod(i) => self.native_rows(s, i),
Page::ShaderPacks => {
if s.shader_packs.is_empty() {
return vec![Row::Header(
"No shader packs: put them in the shaderpacks folder",
)];
return vec![Row::Header("horizon.shader_packs.empty")];
}
s.shader_packs
.iter()
.enumerate()
.map(|(i, pack)| {
let kind = match pack.kind {
crate::shader_pack_list::Kind::Horizon => " (Horizon)",
crate::shader_pack_list::Kind::Classic => "",
crate::shader_pack_list::Kind::Horizon => {
lang::get("horizon.shader_packs.kind_horizon")
}
crate::shader_pack_list::Kind::Classic => String::new(),
};
let label = Text::literal(format!("{}{kind}: ", pack.title))
.append(on_off(s.horizon.shader_pack == pack.file));
@@ -1906,8 +1917,8 @@ impl OptionsUi {
// Vanilla's Telemetry Data and Credits slots: Horizon's
// settings and its mods, as a mod adds its button here.
// Credits & Attribution (WinScreen's credits) follows them.
("Horizon Settings...", Some(Page::Horizon)),
("Mods...", Some(Page::Mods)),
("horizon.pages.open.horizon_settings", Some(Page::Horizon)),
("horizon.pages.open.mods", Some(Page::Mods)),
("options.credits_and_attribution", Some(Page::Credits)),
];
let rows = entries.len().div_ceil(2) as f32;
@@ -2340,18 +2351,12 @@ impl OptionsUi {
content = y + self.scroll - top + 2.0;
out[list_start..].iter_mut().for_each(|w| w.list = true);
let folder = match page {
Page::Mods => Some(("Open Mod Folder", Act::OpenModFolder)),
Page::ShaderPacks => Some(("Open Pack Folder", Act::OpenShaderPackFolder)),
Page::Mods => Some(("horizon.mods.open_folder", Act::OpenModFolder)),
Page::ShaderPacks => Some(("pack.openFolder", Act::OpenShaderPackFolder)),
_ => None,
};
if let Some((label, act)) = folder {
out.push(button(
cx - 154.0,
h - 27.0,
150.0,
Text::literal(label),
act,
));
out.push(button(cx - 154.0, h - 27.0, 150.0, tr(label), act));
out.push(button(cx + 4.0, h - 27.0, 150.0, tr("gui.done"), Act::Done));
} else {
out.push(done(h - 27.0));
@@ -2464,7 +2469,7 @@ impl OptionsUi {
} = &wd.kind
&& let Some(text) = horizon_page_tooltip(*page)
{
tooltip = Some(atlas.font.split(&Text::literal(text), 170.0));
tooltip = Some(atlas.font.split(&tr(text), 170.0));
}
let key = match &wd.kind {
WKind::Button {
@@ -2491,10 +2496,7 @@ impl OptionsUi {
} = &wd.kind
&& !opt.available()
{
tooltip = Some(atlas.font.split(
&Text::literal("This feature is not yet available in Horizon."),
170.0,
));
tooltip = Some(atlas.font.split(&tr("horizon.options.unavailable"), 170.0));
}
if let WKind::Button {
act: Act::ToggleMod(i),
@@ -2549,6 +2551,7 @@ impl OptionsUi {
shown,
hover || dragging,
true,
dragging,
);
}
WKind::Text {
@@ -2635,9 +2638,7 @@ impl OptionsUi {
if search.value.is_empty() && !search.focused {
batch.text_styled(
atlas,
&Text::literal("Search settings...")
.with_color(text::GRAY)
.italic(),
&tr("horizon.options.search").with_color(text::GRAY).italic(),
search.text_x(),
search.text_y(),
u32::MAX,
@@ -2766,8 +2767,7 @@ impl OptionsUi {
{
let v = ui::slider_value(wd.x, wd.w, x);
self.slider_value = Some((opt, v, Instant::now()));
set_slider(opt, s, v);
events.push(Event::SliderDrag);
drag_slider(opt, s, v, &mut events);
}
return events;
}
@@ -2816,26 +2816,7 @@ impl OptionsUi {
}
Act::Done => events.extend(self.back(s)),
Act::Cycle(opt) => {
opt.cycle(s, right, framebuffer);
if opt == Opt::Preset {
apply_preset(s);
}
if opt == Opt::HighContrast {
// Options.highContrast: the built-in pack follows the option.
let on = s.resource_packs.iter().any(|id| id == "high_contrast");
if on != s.high_contrast {
s.resource_packs.retain(|id| id != "high_contrast");
if s.high_contrast {
s.resource_packs.push("high_contrast".into());
}
// PackSelectionScreen reads the repository each time it
// opens: the next one starts from this selection.
self.pack_selection = s.resource_packs.clone();
self.pack_screen = None;
events.push(Event::Packs(s.resource_packs.clone()));
}
}
events.push(Event::Changed);
events.extend(self.cycle_option(s, opt, right, framebuffer));
}
Act::Extra(item) => {
if let Some(name) = item.key_name() {
@@ -2899,8 +2880,7 @@ impl OptionsUi {
self.dragging = Some(opt);
let v = ui::slider_value(wd.x, wd.w, x);
self.slider_value = Some((opt, v, Instant::now()));
set_slider(opt, s, v);
events.push(Event::SliderDrag);
drag_slider(opt, s, v, &mut events);
}
WKind::LanguageRow { code, .. } => {
if self.language_choice.as_deref() == Some(code.as_str()) {
@@ -2943,6 +2923,77 @@ impl OptionsUi {
self.scroll -= amount * 18.0;
self.clamp_scroll(top, bottom, content);
}
/// `CycleButton.cycleValue` on an option, then what the option changes:
/// the preset's values, High Contrast's built-in pack.
fn cycle_option(
&mut self,
s: &mut Settings,
opt: Opt,
back: bool,
framebuffer: [i32; 2],
) -> Vec<Event> {
let mut events = Vec::new();
opt.cycle(s, back, framebuffer);
if opt == Opt::Preset {
apply_preset(s);
}
if opt == Opt::HighContrast {
// Options.highContrast: the built-in pack follows the option.
let on = s.resource_packs.iter().any(|id| id == "high_contrast");
if on != s.high_contrast {
s.resource_packs.retain(|id| id != "high_contrast");
if s.high_contrast {
s.resource_packs.push("high_contrast".into());
}
// PackSelectionScreen reads the repository each time it
// opens: the next one starts from this selection.
self.pack_selection = s.resource_packs.clone();
self.pack_screen = None;
events.push(Event::Packs(s.resource_packs.clone()));
}
}
events.push(Event::Changed);
events
}
/// The mouse wheel at the cursor. Over a cycle button it takes the step
/// (`CycleButton.mouseScrolled`: up goes back) and the list stays put.
pub fn wheel(
&mut self,
s: &mut Settings,
size: (f32, f32),
cursor: (f32, f32),
framebuffer: [i32; 2],
amount: f32,
) -> Vec<Event> {
let plain = self.resource_error.is_none()
&& Self::graphics_level(self.page()).is_none()
&& !(self.pack_screen.is_some() && self.stack.last() == Some(&Page::Packs));
if !plain {
self.scroll_at(s, size, cursor, amount);
return Vec::new();
}
let (widgets, top, bottom, _) = self.layout(s, size.0, size.1);
let hovered = widgets.iter().find_map(|wd| match &wd.kind {
WKind::Button {
active: true,
act: Act::Cycle(opt),
..
} if ui::hovered(cursor, wd.x, wd.y, wd.w, wd.h)
&& !(wd.list && (cursor.1 < top || cursor.1 >= bottom)) =>
{
Some(*opt)
}
_ => None,
});
match hovered {
Some(opt) if amount != 0.0 => self.cycle_option(s, opt, amount > 0.0, framebuffer),
Some(_) => Vec::new(),
None => {
self.scroll_at(s, size, cursor, amount);
Vec::new()
}
}
}
/// The mouse wheel at the cursor.
pub fn scroll_at(&mut self, s: &Settings, size: (f32, f32), cursor: (f32, f32), amount: f32) {
if self.resource_error.is_some() {
@@ -2959,6 +3010,33 @@ impl OptionsUi {
_ => self.scroll(s, size, amount),
}
}
/// `VideoSettingsScreen.mouseScrolled`: with Ctrl held the wheel steps the GUI scale
/// (auto counts as one past the maximum) and the list goes back to the top.
pub fn video_wheel_gui_scale(
&mut self,
s: &mut Settings,
framebuffer: [i32; 2],
amount: f32,
) -> Vec<Event> {
let max = i64::from(crate::window::calculate_scale(
framebuffer,
0,
s.force_unicode,
));
let old = if s.gui_scale == 0 {
max + 1
} else {
i64::from(s.gui_scale)
};
let step = i64::from(amount > 0.0) - i64::from(amount < 0.0);
let new = old + step;
if new == 0 || new > max {
return Vec::new();
}
s.gui_scale = new as u32;
self.scroll = 0.0;
vec![Event::Changed]
}
/// The pack screen at this GUI size, made on first use.
fn packs(&mut self, atlas: &HudAtlas, size: (f32, f32)) -> &mut crate::pack_screen::PackScreen {
let m = crate::screen_draw::Measure(&atlas.font);
@@ -3355,6 +3433,16 @@ mod tests {
assert!(loaded.toggle_attack && loaded.toggle_use);
}
#[test]
fn operator_items_tab_option_can_be_switched() {
// The creative screen reads it (CreativeModeInventoryScreen.hasPermissions).
assert!(Opt::OperatorItemsTab.available());
let mut s = Settings::default();
assert!(!s.operator_items_tab);
Opt::OperatorItemsTab.cycle(&mut s, false, [854, 480]);
assert!(s.operator_items_tab);
}
#[test]
fn render_distance_slider_round_trips_through_extended_options_range() {
let mut s = Settings::default();
@@ -3446,8 +3534,15 @@ mod tests {
ui.show(Page::Mods);
let empty = ui.layout(&s, size.0, size.1).0;
assert!(empty.iter().any(|w| {
matches!(&w.kind, WKind::Text { text, .. } if text.plain().contains(".hmod"))
matches!(&w.kind, WKind::Text { text, .. } if text.plain() == "horizon.mods.empty")
}));
// The empty page points at the bundled key; the English line behind it
// is what a player reads, so both halves are checked here.
let en = crate::lang::Language::load(&[], "en_us");
assert!(
en.get("horizon.mods.empty")
.is_some_and(|line| line.contains(".hmod"))
);
let open_folder = empty
.iter()
.find(|w| {
@@ -3578,6 +3673,57 @@ mod tests {
assert_eq!(ui.page(), Page::NativeMod(0));
}
#[test]
fn a_native_mods_key_shows_and_keeps_the_key_pressed() {
// #3539: Zoom's key set to R showed another key.
let atlas = atlas();
let mut s = Settings::default();
let mut ui = OptionsUi::default();
let size = (480.0, 240.0);
s.mods.installed.push(crate::mod_list::Installed {
id: "zoom".into(),
title: "Zoom 2.0.0".into(),
description: String::new(),
problem: None,
dev: false,
native: Some(crate::mod_list::NativePage {
keys: vec![["zoom".into(), "Zoom key".into(), "key.keyboard.z".into()]],
buttons: Vec::new(),
}),
});
ui.show(Page::NativeMod(0));
let key_label = |ui: &mut OptionsUi, s: &Settings| {
let (widgets, ..) = ui.layout(s, size.0, size.1);
widgets.into_iter().find_map(|w| match w.kind {
WKind::Button {
label,
act: Act::NativeKey(0, 0),
..
} => Some((label.plain(), w.x, w.y)),
_ => None,
})
};
let (label, x, y) = key_label(&mut ui, &s).expect("the key's row");
assert_eq!(label, "Z");
ui.click(
&mut s,
&atlas,
x + 1.0,
y + 1.0,
size,
[480, 240],
false,
false,
);
assert_eq!(
ui.key(&mut s, &atlas, winit::keyboard::KeyCode::KeyR, Some("r")),
vec![Event::Changed]
);
assert_eq!(key_label(&mut ui, &s).unwrap().0, "R");
let saved = crate::mod_list::ModList::parse(&s.mods.serialize());
assert_eq!(saved.keys_of("zoom"), vec![("zoom", "key.keyboard.r")]);
}
#[test]
fn option_tooltip_keys_follow_value_dependent_descriptions() {
let mut s = Settings::default();
@@ -4026,7 +4172,7 @@ mod tests {
for cx in [-100.0, 250.0, 1000.0] {
assert_eq!(
ui.click(&mut s, &atlas, cx, -100.0, size, [854, 480], true, false),
vec![Event::SliderDrag]
vec![Event::SliderDrag, Event::Volume(0, s.master_volume)]
);
}
assert_eq!(ui.release(), vec![Event::ButtonClick, Event::Changed]);
@@ -4036,6 +4182,35 @@ mod tests {
);
}
#[test]
fn a_moved_volume_slider_reports_its_category_and_value() {
let atlas = atlas();
let size = (480.0, 320.0);
let mut s = Settings::default();
let mut ui = OptionsUi::default();
ui.show(Page::Sound);
let hostile = SOUND_SOURCES.iter().position(|n| *n == "hostile").unwrap();
let (widgets, _, _, _) = ui.layout(&s, size.0, size.1);
let slider = widgets
.iter()
.find(|wd| matches!(wd.kind, WKind::Slider { opt: Opt::Volume(i), .. } if i == hostile))
.unwrap();
let y = slider.y + 1.0;
let x = slider.x + 4.0 + (slider.w - 8.0) * 0.5;
let events = ui.click(&mut s, &atlas, x, y, size, [854, 480], false, false);
let volume = s.volumes[hostile];
assert!((volume - 0.5).abs() < 1e-3, "{volume}");
assert_eq!(
events,
vec![Event::SliderDrag, Event::Volume(hostile, volume)]
);
// OptionInstance.set: an unchanged value runs no callback.
assert_eq!(
ui.click(&mut s, &atlas, x, -50.0, size, [854, 480], true, false),
vec![Event::SliderDrag]
);
}
#[test]
fn classic_sliders_follow_the_pointer_and_snap_on_release() {
let atlas = atlas();
+30 -2
View File
@@ -278,7 +278,8 @@ fn read_meta(source: &Source) -> Option<serde_json::Value> {
Source::Dir(d) => fs::read(d.join("pack.mcmeta")).ok()?,
Source::Zip(z) => Zip::open(z).ok()?.read("pack.mcmeta").ok()?,
};
serde_json::from_slice(&bytes).ok()
// Gson reads past a UTF-8 byte order mark; serde_json rejects it.
serde_json::from_slice(bytes.strip_prefix(b"\xEF\xBB\xBF").unwrap_or(&bytes)).ok()
}
fn pack(id: String, title: Text, source: Source) -> Option<Pack> {
pack_for(id, title, source, RESOURCE_FORMAT)
@@ -581,7 +582,15 @@ fn build_overlay_uncached(
Some(p) => link(p, &target)?,
None => {
if let Some(Some(z)) = zips.get(*owner) {
fs::write(&target, z.read(inner)?)?;
// One unreadable entry costs that file, not the
// pack: an error here failed the build and the
// reload dropped every server pack in the stack.
match z.read(inner) {
Ok(bytes) => fs::write(&target, bytes)?,
Err(e) => log::warn!(
"Horizon: skipping unreadable pack entry {inner}: {e}"
),
}
}
}
}
@@ -930,6 +939,25 @@ impl SelectionModel {
mod tests {
use super::*;
#[test]
fn mcmeta_with_utf8_bom_is_read() {
let dir = std::env::temp_dir().join(format!("horizon-bom-{}", std::process::id()));
fs::create_dir_all(&dir).unwrap();
let mut meta = b"\xEF\xBB\xBF".to_vec();
meta.extend_from_slice(br#"{"pack":{"description":"d","pack_format":97}}"#);
fs::write(dir.join("pack.mcmeta"), &meta).unwrap();
assert!(read_meta(&Source::Dir(dir.clone())).is_some());
// Without a BOM the same JSON still reads; other leading bytes still fail.
fs::write(dir.join("pack.mcmeta"), &meta[3..]).unwrap();
assert!(read_meta(&Source::Dir(dir.clone())).is_some());
fs::write(
dir.join("pack.mcmeta"),
[b"\xEF\xBB".as_slice(), &meta[3..]].concat(),
)
.unwrap();
assert!(read_meta(&Source::Dir(dir.clone())).is_none());
fs::remove_dir_all(&dir).ok();
}
#[test]
fn compatibility_ranges() {
let v = |s: &str| serde_json::from_str::<serde_json::Value>(s).unwrap();
assert!(compatible(&v(
+331 -5
View File
@@ -44,6 +44,9 @@ pub struct ParticleOptions {
/// `ItemParticleOption`: the particle sprite of each layer of the item's
/// model as resolved for the ground.
pub item: Option<Vec<String>>,
/// `GeyserParticleOptions.waterBlocks` and `GeyserBaseParticleOptions`'
/// `waterBlocks` and `burstImpulseBase` (0 where the type has none).
pub geyser: Option<(i32, f32)>,
}
impl ParticleOptions {
pub fn simple(ty: ParticleType) -> Self {
@@ -55,6 +58,21 @@ impl ParticleOptions {
to_color: [1.0, 0.0, 0.0],
trail: None,
item: None,
geyser: None,
}
}
/// `GeyserParticleOptions(type, waterBlocks)`.
pub fn geyser(ty: ParticleType, water_blocks: i32) -> Self {
Self {
geyser: Some((water_blocks, 0.0)),
..Self::simple(ty)
}
}
/// `GeyserBaseParticleOptions(type, waterBlocks, burstImpulseBase)`.
pub fn geyser_base(ty: ParticleType, water_blocks: i32, burst_impulse_base: f32) -> Self {
Self {
geyser: Some((water_blocks, burst_impulse_base)),
..Self::simple(ty)
}
}
/// `ItemParticleOption`: the stack's layer particle sprites (`BreakingItemParticle`).
@@ -189,6 +207,29 @@ enum Behaviour {
size_start: f32,
y_prev: f64,
},
/// `NoxiousGasParticle`: fades out from `fade_start` ticks of age.
NoxiousGas {
fade_start: f32,
},
/// `NoxiousGasCloudParticle`: every second tick, a gas particle where the
/// gas reaches.
NoxiousGasCloud,
/// `GeyserEruptionParticle`: the base puffs, the plume and the poofs of
/// one eruption; `aux` is the speed its provider was given.
GeyserEruption {
water_blocks: i32,
aux: [f64; 3],
},
/// `GeyserPlumeParticle`: shoots up `plumeHeight` blocks, then falls back.
GeyserPlume {
start_y: f64,
max_y: f64,
propulsion: f32,
spray: [f32; 2],
min_size: f32,
max_size: f32,
done: bool,
},
BubblePop,
BubbleColumnUp,
CurrentDown {
@@ -869,6 +910,26 @@ impl Particle {
(age / self.lifetime as f32).clamp(0.0, 1.0)
}
}
/// `NoxiousGasCloudParticle.pickRandomParticleSpawnPoint`: a point up to three
/// blocks from the centre of `center_block` in a random horizontal direction,
/// a quarter block lower, from the level's random.
fn pick_random_particle_spawn_point(random: &mut LegacyRandom, center_block: [i32; 3]) -> [f64; 3] {
let dx = f64::from(random.next_float() - 0.5);
let dz = f64::from(random.next_float() - 0.5);
// Vec3.normalize.
let length = (dx * dx + dz * dz).sqrt();
let (dx, dz) = if length < f64::from(1.0e-5f32) {
(0.0, 0.0)
} else {
(dx / length, dz / length)
};
let distance = f64::from(random.next_float() * 3.0);
[
f64::from(center_block[0]) + 0.5 + dx * distance,
f64::from(center_block[1]) + 0.5 - 0.25,
f64::from(center_block[2]) + 0.5 + dz * distance,
]
}
/// `FireflyParticle.getFadeAmount`.
fn fade_amount(progress: f32, fade_in: f32, fade_out: f32) -> f32 {
if progress >= 1.0 - fade_in {
@@ -928,7 +989,7 @@ impl ParticleLevel<'_> {
Err(_) => d,
}
}
fn block_at(p: [f64; 3]) -> [i32; 3] {
pub(crate) fn block_at(p: [f64; 3]) -> [i32; 3] {
[
p[0].floor() as i32,
p[1].floor() as i32,
@@ -950,7 +1011,7 @@ impl ParticleLevel<'_> {
(s.fluid, height)
}
/// The fluid at a block and whether it is a source (`FluidState.isSource`).
fn fluid_source(&self, b: [i32; 3]) -> (Fluid, bool) {
pub(crate) fn fluid_source(&self, b: [i32; 3]) -> (Fluid, bool) {
let s = self.facts.get(self.world.block(b[0], b[1], b[2]));
(s.fluid, s.fluid_level == 8 && !s.fluid_falling)
}
@@ -981,6 +1042,8 @@ pub struct ParticleEngine {
level_random: LegacyRandom,
/// `SpellParticle.RANDOM`.
spell_random: LegacyRandom,
/// The local player's eye while it looks through a spyglass in first person.
scope_eye: Option<[f64; 3]>,
/// Seeds for each particle's own random (`RandomSource.create()`).
seeds: LegacyRandom,
/// When set, particles ask the level for other particles here instead
@@ -1019,6 +1082,7 @@ impl ParticleEngine {
random: LegacyRandom::new(0x7061_7274),
level_random: LegacyRandom::new(0x6c65_7665),
spell_random: LegacyRandom::new(0x7370_656c),
scope_eye: None,
seeds: LegacyRandom::new(0x7365_6564),
requested: None,
names: Vec::new(),
@@ -1165,6 +1229,17 @@ impl ParticleEngine {
self.create(options, p, v);
}
}
/// `NoxiousGasCloudParticle.spawnNoxiousGasParticle`: the gas, as an
/// always visible particle (`ClientLevel.addAlwaysVisibleParticle`).
fn spawn_noxious_gas_particle(&mut self, pos: [f64; 3]) {
self.add_with(
&ParticleOptions::simple(ParticleType::NoxiousGas),
pos,
[0.0; 3],
false,
true,
);
}
/// `ClientLevel.calculateParticleLevel`: minimal still shows one in ten
/// always-visible particles as decreased, and decreased drops a third.
fn calculate_particle_level(&mut self, always_show: bool) -> u8 {
@@ -1365,6 +1440,16 @@ impl ParticleEngine {
}
}
}
/// Set each frame to the local player's eye while it scopes in first person.
pub fn set_scope_eye(&mut self, eye: Option<[f64; 3]>) {
self.scope_eye = eye;
}
/// `SpellParticle.isCloseToScopingPlayer`: within 3 blocks of that eye.
fn close_to_scoping_player(&self, pos: [f64; 3]) -> bool {
self.scope_eye.is_some_and(|eye| {
(eye[0] - pos[0]).powi(2) + (eye[1] - pos[1]).powi(2) + (eye[2] - pos[2]).powi(2) <= 9.0
})
}
/// `ClientPacketListener.handleParticleEvent` for `ServerLevel.sendParticles`.
pub fn send_particles(
&mut self,
@@ -1562,7 +1647,15 @@ impl ParticleEngine {
q.set = set;
q
}
T::Smoke | T::LargeSmoke | T::WhiteSmoke | T::Ash | T::WhiteAsh | T::DustPlume => {
T::Smoke
| T::LargeSmoke
| T::WhiteSmoke
| T::Ash
| T::WhiteAsh
| T::DustPlume
| T::NoxiousGas
| T::GeyserBase
| T::GeyserPoof => {
// BaseAshSmokeParticle(dir, xa, scale, colorRandom, maxLifetime, gravity, hasPhysics).
let (dir, scale, color_random, max_lifetime, gravity, physics, vel) = match ty {
T::Smoke | T::WhiteSmoke => ([0.1, 0.1, 0.1], 1.0, 0.3, 8, -0.1, true, v),
@@ -1578,6 +1671,22 @@ impl ParticleEngine {
false,
[v[0], v[1] + f64::from(0.15f32), v[2]],
),
// NoxiousGasParticle.Provider: scale 3.
T::NoxiousGas => ([0.1, 0.1, 0.1], 3.0, 0.3, 5, -0.02, true, v),
// GeyserBaseParticle: the burst impulse scales every axis.
T::GeyserBase | T::GeyserPoof => {
let (water_blocks, burst_impulse_base) = o.geyser?;
let burst_impulse = burst_impulse_base + 0.25 * water_blocks as f32;
(
[f64::from(burst_impulse); 3],
3.0 + 0.125 * water_blocks as f32,
0.0,
0,
0.0,
true,
v,
)
}
_ => {
// WhiteAshParticle.Provider draws the motion.
let pr = &mut self.random;
@@ -1593,6 +1702,18 @@ impl ParticleEngine {
([0.1, -0.1, 0.1], 1.0, 0.0, 20, 0.0125, false, [xa, ya, za])
}
};
// GeyserBaseParticle.Provider: a random spot half a block
// around the point, a fifth of a block up (the provider's
// random, as float arithmetic added to the double position).
let p = if matches!(ty, T::GeyserBase | T::GeyserPoof) {
let pr = &mut self.random;
let x = p[0] + f64::from((pr.next_float() - 0.5) * 0.5);
let y = p[1] + f64::from((pr.next_float() - 0.5) * 0.5) + f64::from(0.2f32);
let z = p[2] + f64::from((pr.next_float() - 0.5) * 0.5);
[x, y, z]
} else {
p
};
let mut q = Particle::moving(r, ty, p, [0.0; 3]);
q.friction = 0.96;
q.gravity = gravity;
@@ -1621,6 +1742,87 @@ impl ParticleEngine {
);
q.behaviour = Behaviour::DustPlume;
}
match ty {
// NoxiousGasParticle: white, living `6 / (0.5 to 1) * 3`
// ticks, fading out over its second half.
T::NoxiousGas => {
q.set_color(1.0, 1.0, 1.0);
q.lifetime = (6.0 / (f64::from(r.next_float()) * 0.5 + 0.5)
* f64::from(3.0f32)) as i32;
q.behaviour = Behaviour::NoxiousGas {
fade_start: q.lifetime as f32 / 2.0,
};
}
// GeyserBaseParticle: white, only ever rising, 20 to 25 ticks.
T::GeyserBase | T::GeyserPoof => {
q.friction = 0.725;
q.set_color(1.0, 1.0, 1.0);
q.velocity[1] = q.velocity[1].abs();
let lifetime_factor = 0.8 + 0.2 * self.level_random.next_float();
q.lifetime = (25.0 * lifetime_factor) as i32;
}
_ => {}
}
q.set = set;
q
}
// NoxiousGasCloudParticle: lives 20 ticks, draws nothing itself.
T::NoxiousGasCloud => {
let mut q = Particle::base_at(r, ty, p);
q.lifetime = 20;
q.no_render = true;
q.behaviour = Behaviour::NoxiousGasCloud;
q
}
// GeyserEruptionParticle: lives 20 ticks, draws nothing itself.
T::Geyser => {
let (water_blocks, _) = o.geyser?;
let mut q = Particle::base_at(r, ty, p);
q.lifetime = 20;
q.no_render = true;
q.behaviour = Behaviour::GeyserEruption {
water_blocks,
aux: v,
};
q
}
// GeyserPlumeParticle, after its provider's random placement.
T::GeyserPlume => {
let (water_blocks, _) = o.geyser?;
let pr = &mut self.random;
let at = [
p[0] + f64::from((pr.next_float() - 0.5) * 0.2),
p[1] + f64::from(pr.next_float()),
p[2] + f64::from((pr.next_float() - 0.5) * 0.2),
];
let plume_height = 5 * water_blocks.max(1);
let mut q = Particle::moving(r, ty, at, v);
q.has_physics = true;
q.speed_up_when_y_blocked = true;
q.lifetime = plume_height * 5;
q.velocity[1] = 0.0;
let level = &mut self.level_random;
let spray = [
(level.next_float() - 0.5) * 0.2,
(level.next_float() - 0.5) * 0.2,
];
q.friction = 1.0;
let propulsion =
(if water_blocks == 1 { 1.5 } else { 1.0 }) * plume_height as f32 * 1.45;
q.gravity = -propulsion;
let initial_size = q.size * 0.75;
let min_size = initial_size * (2.0 + plume_height as f32 / 8.0);
let max_size = initial_size * (3.0 + plume_height as f32 / 8.0);
q.size = min_size;
q.behaviour = Behaviour::GeyserPlume {
start_y: at[1],
max_y: at[1] + f64::from(plume_height) - 1.0,
propulsion,
spray,
min_size,
max_size,
done: false,
};
q.set = set;
q
}
@@ -2447,6 +2649,12 @@ impl ParticleEngine {
q.size *= 0.75;
q.lifetime = (8.0 / (f64::from(r.next_float()) * 0.8 + 0.2)) as i32;
q.has_physics = false;
// SpellParticle's constructor: setAlpha(0.0F), which also sets originalAlpha.
// MobEffectProvider sets the option's alpha after it, so an entity
// effect starts visible and the first tick hides it.
if self.close_to_scoping_player(q.position) {
q.rgba[3] = 0.0;
}
match ty {
T::Witch => {
let b = self.random.next_float() * 0.5 + 0.35;
@@ -3198,6 +3406,98 @@ impl ParticleEngine {
y_prev: p.position[1],
};
}
Behaviour::NoxiousGas { fade_start } => {
p.base_tick(level);
self.sprite_from_age(p);
if p.age as f32 > fade_start {
let frames_since_fade_out_start = p.age as f32 - fade_start;
p.rgba[3] =
(p.lifetime as f32 - frames_since_fade_out_start) / p.lifetime as f32;
}
}
Behaviour::NoxiousGasCloud => {
p.base_tick(level);
if p.age % 2 == 0 {
let source = ParticleLevel::block_at(p.position);
let spawn = pick_random_particle_spawn_point(&mut self.level_random, source);
if crate::potent_sulfur::can_be_reached_by_noxious_gas(level, source, spawn) {
self.spawn_noxious_gas_particle(spawn);
}
}
}
Behaviour::GeyserEruption { water_blocks, aux } => {
p.base_tick(level);
if p.age % 2 == 0 {
for _ in 0..2 {
self.add(
&ParticleOptions::geyser_base(
ParticleType::GeyserBase,
water_blocks,
1.5,
),
p.position,
aux,
);
}
}
for _ in 0..water_blocks + 2 {
self.add(
&ParticleOptions::geyser(ParticleType::GeyserPlume, water_blocks),
p.position,
aux,
);
}
if p.age % 10 == 0 {
for _ in 0..20 {
self.add(
&ParticleOptions::geyser_base(
ParticleType::GeyserPoof,
water_blocks,
2.0,
),
p.position,
aux,
);
}
}
}
Behaviour::GeyserPlume {
start_y,
max_y,
propulsion,
spray,
min_size,
max_size,
mut done,
} => {
p.base_tick(level);
if !done
&& (p.velocity[1] < 0.0
|| p.position[1] > max_y
|| p.position[1] == p.previous[1])
{
p.lifetime = p.lifetime.min(p.age + 5);
p.friction = 0.0;
done = true;
}
let y_progress_linear =
((p.position[1] - start_y) / (max_y - start_y)).clamp(0.0, 1.0);
let y_progress_exponential = horizon_core::jmath::pow(y_progress_linear, 3.0);
p.gravity = propulsion * y_progress_exponential as f32 * 0.12;
p.velocity[0] = y_progress_linear * f64::from(spray[0]);
p.velocity[2] = y_progress_linear * f64::from(spray[1]);
self.sprite_from_age(p);
p.size = min_size + (y_progress_linear * f64::from(max_size - min_size)) as f32;
p.behaviour = Behaviour::GeyserPlume {
start_y,
max_y,
propulsion,
spray,
min_size,
max_size,
done,
};
}
Behaviour::BubbleColumnUp => {
p.base_tick(level);
if !p.removed && level.fluid(ParticleLevel::block_at(p.position)).0 != Fluid::Water
@@ -3462,7 +3762,12 @@ impl ParticleEngine {
Behaviour::Spell { original_alpha } => {
p.base_tick(level);
self.sprite_from_age(p);
p.rgba[3] += (original_alpha - p.rgba[3]) * 0.05;
// SpellParticle.tick: alpha 0 while close, else eased back to originalAlpha.
if self.close_to_scoping_player(p.position) {
p.rgba[3] = 0.0;
} else {
p.rgba[3] += (original_alpha - p.rgba[3]) * 0.05;
}
}
Behaviour::Cloud => {
p.base_tick(level);
@@ -3818,7 +4123,7 @@ impl ParticleEngine {
layer: if layer {
crate::gfx::TRANSLUCENT_PARTICLE_OVERLAY
} else {
0
u32::from(hdr_tier(p.ty)) << 16
},
color,
light,
@@ -3830,6 +4135,27 @@ impl ParticleEngine {
}
}
}
/// How brightly particle `ty` shines in HDR output, as `mesher::hdr_tier`: flames and
/// glowing drops, not their smoke. Only opaque-layer particles are marked.
fn hdr_tier(ty: ParticleType) -> u8 {
use ParticleType as P;
match ty {
P::Flame
| P::SoulFireFlame
| P::CopperFireFlame
| P::SmallFlame
| P::Lava
| P::DrippingLava
| P::FallingLava
| P::LandingLava
| P::DrippingDripstoneLava
| P::FallingDripstoneLava => crate::mesher::INCANDESCENT,
P::DrippingObsidianTear | P::FallingObsidianTear | P::LandingObsidianTear => {
crate::mesher::LOW
}
_ => 0,
}
}
/// `Particle.LifetimeAlpha.currentAlphaForAge`.
fn lifetime_alpha(a: [f32; 4], age: i32, lifetime: i32, partial: f32) -> f32 {
if (a[0] - a[1]).abs() < 1.0e-5 {
@@ -0,0 +1,119 @@
//! `PotentSulfurBlockEntity`'s reads of the level: where the noxious gas of a
//! potent sulfur block comes out, how far a geyser throws, and whether the gas
//! reaches a point. The client's particles and the server's nausea and
//! launches read the level the same way, through a [`ParticleLevel`].
use crate::{blocks::Fluid, collisions::SceneCollisions, particles::ParticleLevel};
use horizon_core::{
geometry::{Vec3, traverse_blocks},
position::BlockPos,
};
/// `PotentSulfurBlock.ALLOWED_WATER_BLOCKS_ABOVE`.
const ALLOWED_WATER_BLOCKS_ABOVE: i32 = 4;
/// `PotentSulfurBlockEntity.isGeyserPassableBlock`: air, water, or a block
/// with no collision shape.
pub fn is_geyser_passable_block(level: &ParticleLevel, pos: [i32; 3]) -> bool {
let state = level.world.block(pos[0], pos[1], pos[2]);
if level.facts.is_air(state) || &*level.facts.get(state).name == "minecraft:water" {
return true;
}
let mut scene = SceneCollisions {
world: level.world,
binding: level.collision,
subject: None,
};
match level.collision.collision_shape(&mut scene, state, pos) {
Ok(shape) => shape.is_empty(),
Err(_) => !level.facts.get(state).full_collision,
}
}
/// `PotentSulfurBlockEntity.isWater`: the block at `pos` holds a water source
/// (`FluidState.isSourceOfType`).
fn is_water_source(level: &ParticleLevel, pos: [i32; 3]) -> bool {
let (fluid, source) = level.fluid_source(pos);
fluid == Fluid::Water && source
}
/// `PotentSulfurBlockEntity.findNoxiousGasSourceBlock`: the first block above
/// the sulfur, within the water column's reach, that is not water-filled and
/// lets gas through; None when something solid or a deeper column stops it.
pub fn find_noxious_gas_source_block(level: &ParticleLevel, origin: [i32; 3]) -> Option<[i32; 3]> {
let max_y = origin[1] + ALLOWED_WATER_BLOCKS_ABOVE + 1;
let mut pos = [origin[0], origin[1] + 1, origin[2]];
while pos[1] <= max_y {
let state = level.world.block(pos[0], pos[1], pos[2]);
let is_water_block = &*level.facts.get(state).name == "minecraft:water";
if !is_water_source(level, pos)
|| (!is_water_block && !is_geyser_passable_block(level, pos))
{
if level.facts.is_air(state) || is_geyser_passable_block(level, pos) {
return Some(pos);
}
break;
}
pos[1] += 1;
}
None
}
/// `PotentSulfurBlockEntity.getUnobstructedBlockCount`: how many blocks from
/// `pos` up, at most six per water block, a geyser's push goes through.
pub fn unobstructed_block_count(level: &ParticleLevel, pos: [i32; 3], water_blocks: i32) -> i32 {
let geyser_force_height = 6 * water_blocks;
for i in 0..geyser_force_height {
if !is_geyser_passable_block(level, [pos[0], pos[1] + i, pos[2]]) {
return i;
}
}
geyser_force_height
}
/// `PotentSulfurBlockEntity.canBeReachedByNoxiousGas`: `pos` is in a block gas
/// can enter, within three blocks of the source block's centre, and above
/// water the source's water can be seen from.
pub fn can_be_reached_by_noxious_gas(
level: &ParticleLevel,
source_block: [i32; 3],
pos: [f64; 3],
) -> bool {
let block = ParticleLevel::block_at(pos);
if !is_geyser_passable_block(level, block) {
return false;
}
let center = source_block.map(|c| f64::from(c) + 0.5);
let distance_sqr =
(center[0] - pos[0]).powi(2) + (center[1] - pos[1]).powi(2) + (center[2] - pos[2]).powi(2);
if distance_sqr > 9.0 {
return false;
}
let below_source = [center[0], f64::from(source_block[1] - 1) + 0.5, center[2]];
let below_pos = [pos[0], pos[1] - 1.0, pos[2]];
is_water_source(level, ParticleLevel::block_at(below_pos))
&& have_line_of_sight(level, below_source, below_pos)
}
/// `PotentSulfurBlockEntity.haveLineOfSight`: a clip over collider shapes and
/// no fluids (as the mobs' line of sight does) finds no block between the
/// points.
fn have_line_of_sight(level: &ParticleLevel, a: [f64; 3], b: [f64; 3]) -> bool {
let (from, to) = (Vec3::new(a[0], a[1], a[2]), Vec3::new(b[0], b[1], b[2]));
let mut scene = SceneCollisions {
world: level.world,
binding: level.collision,
subject: None,
};
let hit = traverse_blocks(from, to, 512, |p: BlockPos| {
let state = level.world.block(p.x, p.y, p.z);
if level.facts.is_air(state) {
return None;
}
let shape = level
.collision
.collision_shape(&mut scene, state, [p.x, p.y, p.z])
.ok()?;
shape.clip(from, to, p).map(|_| ())
});
!matches!(hit, Ok(Some(())))
}
@@ -121,6 +121,10 @@ pub fn warden_can_listen(event: &str) -> bool {
|| event == SHRIEK
|| shrieker_can_listen(event)
}
/// `GameEventTags.ALLAY_CAN_LISTEN`: note block notes.
pub fn allay_can_listen(event: &str) -> bool {
event == "minecraft:note_block_play"
}
/// `GameEventTags.IGNORE_VIBRATIONS_SNEAKING`.
pub fn ignored_when_sneaking(event: &str) -> bool {
matches!(
@@ -0,0 +1,164 @@
//! Sets of section indexes in a chunk column, a bit per section.
//!
//! Vanilla's tallest level has 254 sections (`DimensionType.Y_SIZE / 16`), and
//! light data adds a section below and above it: 256 bits hold every layout a
//! dimension type allows.
/// Section indexes of one column, 0 being the lowest.
#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
pub struct SectionMask([u64; 4]);
impl SectionMask {
pub const CAPACITY: usize = 256;
pub const EMPTY: Self = Self([0; 4]);
pub const ALL: Self = Self([u64::MAX; 4]);
/// The indexes `0..n`.
pub const fn below(n: usize) -> Self {
let mut words = [0; 4];
let mut w = 0;
while w < 4 {
let bits = n.saturating_sub(w * 64);
words[w] = if bits >= 64 {
u64::MAX
} else {
(1 << bits) - 1
};
w += 1;
}
Self(words)
}
pub fn single(i: usize) -> Self {
let mut mask = Self::EMPTY;
mask.insert(i);
mask
}
#[inline]
pub fn contains(&self, i: usize) -> bool {
i < Self::CAPACITY && self.0[i >> 6] >> (i & 63) & 1 != 0
}
#[inline]
pub fn insert(&mut self, i: usize) {
self.0[i >> 6] |= 1 << (i & 63);
}
#[inline]
pub fn remove(&mut self, i: usize) {
self.0[i >> 6] &= !(1 << (i & 63));
}
pub fn is_empty(&self) -> bool {
self.0 == [0; 4]
}
pub fn len(&self) -> usize {
self.0.iter().map(|w| w.count_ones() as usize).sum()
}
/// The indexes from `i` up.
pub fn from(self, i: usize) -> Self {
self & !Self::below(i)
}
/// The indexes, lowest first.
pub fn iter(self) -> Indexes {
Indexes(self)
}
}
impl std::ops::BitOr for SectionMask {
type Output = Self;
fn bitor(self, other: Self) -> Self {
Self(std::array::from_fn(|w| self.0[w] | other.0[w]))
}
}
impl std::ops::BitOrAssign for SectionMask {
fn bitor_assign(&mut self, other: Self) {
*self = *self | other;
}
}
impl std::ops::BitAnd for SectionMask {
type Output = Self;
fn bitand(self, other: Self) -> Self {
Self(std::array::from_fn(|w| self.0[w] & other.0[w]))
}
}
impl std::ops::Not for SectionMask {
type Output = Self;
fn not(self) -> Self {
Self(self.0.map(|w| !w))
}
}
impl std::fmt::Debug for SectionMask {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_set().entries(self.iter()).finish()
}
}
impl FromIterator<usize> for SectionMask {
fn from_iter<I: IntoIterator<Item = usize>>(indexes: I) -> Self {
let mut mask = Self::EMPTY;
for i in indexes {
mask.insert(i);
}
mask
}
}
/// `SectionMask::iter`: the set's indexes in ascending order.
#[derive(Clone, Copy, Debug)]
pub struct Indexes(SectionMask);
impl Iterator for Indexes {
type Item = usize;
#[inline]
fn next(&mut self) -> Option<usize> {
let words = &mut (self.0).0;
let w = words.iter().position(|&w| w != 0)?;
let bit = words[w].trailing_zeros() as usize;
words[w] &= words[w] - 1;
Some(w * 64 + bit)
}
fn size_hint(&self) -> (usize, Option<usize>) {
let len = self.0.len();
(len, Some(len))
}
}
impl ExactSizeIterator for Indexes {}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn sets_across_words() {
let mut mask = SectionMask::EMPTY;
for i in [0, 23, 63, 64, 130, 255] {
mask.insert(i);
}
assert_eq!(mask.iter().collect::<Vec<_>>(), [0, 23, 63, 64, 130, 255]);
assert_eq!(mask.len(), 6);
assert!(mask.contains(130) && !mask.contains(131) && !mask.contains(300));
mask.remove(64);
assert_eq!(mask.from(24).iter().collect::<Vec<_>>(), [63, 130, 255]);
assert_eq!(mask.from(256), SectionMask::EMPTY);
assert_eq!(mask.from(0), mask);
assert!(SectionMask::EMPTY.is_empty() && !mask.is_empty());
}
#[test]
fn below_counts_whole_and_partial_words() {
for n in [0, 1, 24, 63, 64, 65, 131, 254, 256] {
let mask = SectionMask::below(n);
assert_eq!(mask.len(), n);
assert_eq!(mask.iter().collect::<Vec<_>>(), (0..n).collect::<Vec<_>>());
}
assert_eq!(SectionMask::below(1000), SectionMask::ALL);
}
#[test]
fn operators() {
let a: SectionMask = [1, 70, 200].into_iter().collect();
let b: SectionMask = [70, 3].into_iter().collect();
assert_eq!((a | b).iter().collect::<Vec<_>>(), [1, 3, 70, 200]);
assert_eq!((a & b).iter().collect::<Vec<_>>(), [70]);
assert_eq!(
(!a & SectionMask::below(4)).iter().collect::<Vec<_>>(),
[0, 2, 3]
);
assert_eq!(format!("{a:?}"), "{1, 70, 200}");
}
}
@@ -50,6 +50,9 @@ pub fn sound_source(event: &str) -> usize {
index("ambient")
} else if e.starts_with("music_disc.") {
index("record")
} else if e.starts_with("item.goat_horn.") {
// InstrumentItem.play: SoundSource.RECORDS.
index("record")
} else if e.starts_with("music.") {
index("music")
} else if e.starts_with("weather.") || e.starts_with("entity.lightning_bolt") {
@@ -150,6 +153,8 @@ pub struct Settings {
pub chat_links: bool,
pub chat_links_prompt: bool,
pub chat_opacity: f32,
/// Chat Delay in seconds (`chatDelay`): player chat shows this far apart.
pub chat_delay: f64,
pub text_background_opacity: f32,
pub chat_scale: f32,
pub chat_width: f32,
@@ -246,6 +251,7 @@ impl Default for Settings {
chat_links: true,
chat_links_prompt: true,
chat_opacity: 1.0,
chat_delay: 0.0,
text_background_opacity: 0.5,
chat_scale: 1.0,
chat_width: 1.0,
@@ -448,6 +454,7 @@ impl Settings {
chat_links: f.bool("chatLinks"),
chat_links_prompt: f.bool("chatLinksPrompt"),
chat_opacity: f.double("chatOpacity") as f32,
chat_delay: f.double("chatDelay"),
text_background_opacity: f.double("textBackgroundOpacity") as f32,
chat_scale: f.double("chatScale") as f32,
chat_width: f.double("chatWidth") as f32,
@@ -551,6 +558,9 @@ impl Settings {
put_b(&mut f, "chatLinks", self.chat_links);
put_b(&mut f, "chatLinksPrompt", self.chat_links_prompt);
put_f(&mut f, "chatOpacity", self.chat_opacity);
if self.chat_delay != f.double("chatDelay") {
f.set("chatDelay", V::Double(self.chat_delay));
}
put_f(
&mut f,
"textBackgroundOpacity",
+87 -4
View File
@@ -31,9 +31,45 @@ impl Default for SignText {
lines: Default::default(),
color: BLACK,
glowing: false,
click: Default::default(),
}
}
}
/// The click events `SignBlockEntity.executeClickCommandsIfPresent` acts on.
#[derive(Debug, PartialEq)]
pub enum ClickAction<'a> {
/// `ClickEvent.RunCommand`.
RunCommand(String),
/// `ClickEvent.ShowDialog`: a registry id or the dialog itself.
ShowDialog(&'a Tag),
/// `ClickEvent.Custom`.
Custom {
id: String,
payload: Option<&'a Tag>,
},
}
/// A saved `click_event` as its action: the three a sign acts on, read the
/// way `ClickEvent.CODEC` does; any other action or a malformed one is None.
pub fn click_action(event: &Tag) -> Option<ClickAction<'_>> {
let Some(Tag::String(action)) = event.get("action") else {
return None;
};
match action.to_string_lossy().as_str() {
"run_command" => match event.get("command") {
Some(Tag::String(command)) => Some(ClickAction::RunCommand(command.to_string_lossy())),
_ => None,
},
"show_dialog" => event.get("dialog").map(ClickAction::ShowDialog),
"custom" => match event.get("id") {
Some(Tag::String(id)) => Some(ClickAction::Custom {
id: id.to_string_lossy(),
payload: event.get("payload"),
}),
_ => None,
},
_ => None,
}
}
impl SignText {
pub fn is_empty(&self) -> bool {
self.lines.iter().all(String::is_empty)
@@ -42,6 +78,14 @@ impl SignText {
pub fn text_color(&self) -> u32 {
DYE_TEXT[usize::from(self.color.min(15))].1
}
/// `SignText.hasAnyClickCommands`: a line whose style has a `run_command`
/// click event.
pub fn has_any_click_commands(&self) -> bool {
self.click
.iter()
.flatten()
.any(|event| matches!(click_action(event), Some(ClickAction::RunCommand(_))))
}
/// `AbstractSignRenderer.getDarkColor`.
pub fn dark_color(&self) -> u32 {
let c = self.text_color();
@@ -70,6 +114,13 @@ impl SignData {
pub fn line_height(&self) -> f32 {
if self.hanging { 9.0 } else { 10.0 }
}
/// `SignBlockEntity.canExecuteClickCommands`: a waxed sign whose side
/// has a `run_command` click event. (Horizon keeps no filtered text, so
/// `Player.isTextFilteringEnabled` never selects it.)
pub fn can_execute_click_commands(&self, front: bool) -> bool {
let side = if front { &self.front } else { &self.back };
self.waxed && side.has_any_click_commands()
}
/// NBT entries after the common block-entity header.
pub fn encode(&self) -> Vec<(&'static str, Tag)> {
let side = |t: &SignText| {
@@ -79,7 +130,18 @@ impl SignData {
Tag::List(
t.lines
.iter()
.map(|l| Tag::String(l.as_str().into()))
.zip(&t.click)
.map(|(line, click)| {
let text = Tag::String(line.as_str().into());
match click {
// The line's style keeps its click event.
Some(event) => Tag::compound([
("text", text),
("click_event", event.clone()),
]),
None => text,
}
})
.collect(),
),
),
@@ -90,19 +152,25 @@ impl SignData {
("has_glowing_text", Tag::Byte(i8::from(t.glowing))),
])
};
vec![
let mut out = Vec::new();
if self.allow_op_features {
out.push(("allow_op_features", Tag::Byte(1)));
}
out.extend([
("front_text", side(&self.front)),
("back_text", side(&self.back)),
("is_waxed", Tag::Byte(i8::from(self.waxed))),
]
]);
out
}
pub fn decode(&mut self, tag: &Tag) {
let side = |t: Option<&Tag>| -> SignText {
let mut out = SignText::default();
let Some(t) = t else { return out };
if let Some(Tag::List(messages)) = t.get("messages") {
for (line, m) in out.lines.iter_mut().zip(messages) {
for ((line, click), m) in out.lines.iter_mut().zip(&mut out.click).zip(messages) {
*line = component_text(m);
*click = click_event(m);
}
}
if let Some(Tag::String(c)) = t.get("color") {
@@ -117,6 +185,21 @@ impl SignData {
self.front = side(tag.get("front_text"));
self.back = side(tag.get("back_text"));
self.waxed = matches!(tag.get("is_waxed"), Some(Tag::Byte(b)) if *b != 0);
self.allow_op_features =
matches!(tag.get("allow_op_features"), Some(Tag::Byte(b)) if *b != 0);
}
}
/// The `click_event` in the style of a stored line: the one of a component
/// object, or of the first component of a list (`createFromList` copies it
/// and appends the rest as siblings).
fn click_event(tag: &Tag) -> Option<Tag> {
let root = match tag {
Tag::List(list) => list.first()?,
other => other,
};
match root.get("click_event") {
Some(event @ Tag::Compound(_)) => Some(event.clone()),
_ => None,
}
}
/// Plain text of a stored text component (string, `{text: ...}` or JSON string).
+135 -1
View File
@@ -468,7 +468,10 @@ pub fn head_skin(
{
let location = skin_location(&hash);
match downloads.state(Kind::Skin, &url) {
Download::Ready if atlas(&location) => return location,
Download::Ready if atlas(&location) => {
downloads.drawn(&location);
return location;
}
// Its slot was evicted: offer the image again.
Download::Ready => {
downloads.again(&location);
@@ -681,6 +684,8 @@ pub struct Downloader {
/// atlas uploads again (`again`); the disk cache backs anything dropped.
images: std::collections::HashMap<String, Vec<u8>>,
image_order: std::collections::VecDeque<String>,
/// Skins and capes drawn from the atlas since `take_drawn`.
drawn: std::collections::HashSet<String>,
}
/// `images` is bounded only so a long session on a busy server does not grow
/// without end; the disk cache holds everything it drops.
@@ -697,6 +702,7 @@ impl Downloader {
queued: Default::default(),
images: Default::default(),
image_order: Default::default(),
drawn: Default::default(),
}
}
/// How the download of `url` stands, starting it the first time.
@@ -801,6 +807,77 @@ impl Downloader {
}
std::mem::take(&mut self.ready)
}
/// A skin or cape in the atlas drawn this frame: `SkinSlots` keeps its slot.
pub fn drawn(&mut self, location: &str) {
if !self.drawn.contains(location) {
self.drawn.insert(location.to_owned());
}
}
/// The skins and capes drawn since the last call.
pub fn take_drawn(&mut self) -> std::collections::HashSet<String> {
std::mem::take(&mut self.drawn)
}
}
/// Which downloaded skins and capes hold the atlas's skin slots
/// (`hud::SKIN_SLOTS`). Vanilla's `SkinManager.TextureCache.getOrLoad`
/// registers a texture per skin and keeps it. Here the slots are shared: a
/// new skin takes a free slot, else the least recently drawn skin's, but
/// never one drawn in the last frame. With every slot drawn, the new skin
/// waits (its player keeps the default skin) instead of pushing out one in
/// use, which then came back by pushing out another, so players vanished
/// for a frame and heads swapped textures as the slots went round.
pub struct SkinSlots {
capacity: usize,
/// Stored locations and their slot, the least recently drawn first.
slots: Vec<(String, usize)>,
/// Drawn in the last frame, or stored since: kept from eviction.
kept: std::collections::HashSet<String>,
}
impl SkinSlots {
pub fn new(capacity: usize) -> Self {
Self {
capacity,
slots: Vec::new(),
kept: Default::default(),
}
}
/// Whether `location` is in a slot.
pub fn contains(&self, location: &str) -> bool {
self.slots.iter().any(|(l, _)| l == location)
}
/// A new frame: the skins `drawn` in the last one
/// (`Downloader::take_drawn`) become the most recently drawn, and keep
/// their slots through this frame's `place`s.
pub fn next_frame(&mut self, drawn: std::collections::HashSet<String>) {
let (recent, old): (Vec<_>, Vec<_>) = std::mem::take(&mut self.slots)
.into_iter()
.partition(|(l, _)| drawn.contains(l));
self.slots = old;
self.slots.extend(recent);
self.kept = drawn;
}
/// A slot for `location`: its own, a free one, else the least recently
/// drawn one not kept, with the location it held. `None` while every
/// slot is kept.
pub fn place(&mut self, location: String) -> Option<(usize, Option<String>)> {
if let Some((_, slot)) = self.slots.iter().find(|(l, _)| *l == location) {
return Some((*slot, None));
}
let (slot, evicted) = if self.slots.len() < self.capacity {
(self.slots.len(), None)
} else {
let i = self
.slots
.iter()
.position(|(l, _)| !self.kept.contains(l))?;
let (old, slot) = self.slots.remove(i);
(slot, Some(old))
};
self.kept.insert(location.clone());
self.slots.push((location, slot));
Some((slot, evicted))
}
}
/// A GET over HTTP or HTTPS (textures.minecraft.net serves both; vanilla
@@ -999,6 +1076,63 @@ mod tests {
assert!(super::resolve_profile(&super::NameOrId::Name("Notch".into()), &doc).is_none());
}
/// More skins drawn every frame than there are slots (#3829): a frame's
/// uploads used to push out skins drawn the frame before, which then
/// uploaded again and pushed out others, so the drawn skins went missing
/// in turn. Those drawn keep their slots; the rest wait.
#[test]
fn skins_drawn_last_frame_keep_their_slots() {
let mut d = super::Downloader::new(std::env::temp_dir().join("horizon-test-skin-slots"));
let skins: Vec<String> = (0..6).map(|i| format!("skins/{i}")).collect();
for (i, s) in skins.iter().enumerate() {
d.remember(s.clone(), vec![i as u8]);
}
let mut slots = super::SkinSlots::new(4);
let mut last: Option<Vec<String>> = None;
for frame in 0..8 {
// draw_tab_list: the downloads that finished go to the atlas.
slots.next_frame(d.take_drawn());
let mut uploads = 0;
for (location, _) in d.take_ready() {
if slots.place(location).is_some() {
uploads += 1;
}
}
// update_remote_skins: every skin is drawn, from its slot, or
// asked for again while it has none.
let mut shown = Vec::new();
for s in &skins {
if slots.contains(s) {
d.drawn(s);
shown.push(s.clone());
} else {
d.again(s);
}
}
if frame >= 2 {
assert_eq!(uploads, 0, "frame {frame} uploaded again");
assert_eq!(Some(&shown), last.as_ref(), "frame {frame} lost a skin");
}
// The first frame asks for the skins; from the next, four show.
assert_eq!(shown.len(), if frame == 0 { 0 } else { 4 });
last = Some(shown);
}
// A skin no longer drawn gives up its slot to a waiting one.
let mut slots = super::SkinSlots::new(2);
slots.next_frame(Default::default());
assert_eq!(slots.place("skins/a".into()), Some((0, None)));
assert_eq!(slots.place("skins/b".into()), Some((1, None)));
assert_eq!(slots.place("skins/c".into()), None);
slots.next_frame(["skins/b".to_owned()].into());
assert_eq!(
slots.place("skins/c".into()),
Some((0, Some("skins/a".into())))
);
// Stored this frame, kept through it.
assert_eq!(slots.place("skins/d".into()), None);
assert!(slots.contains("skins/b") && slots.contains("skins/c"));
}
/// A skin evicted from the atlas re-uploads (`again`), once per ask.
#[test]
fn evicted_skins_upload_again() {
@@ -0,0 +1,179 @@
//! `SoundPreviewHandler`: the sound a category volume slider plays while it
//! moves on the title screen's options (`Options.createSoundSliderOptionInstance`
//! calls `preview` when there is no level).
use crate::settings::SOUND_SOURCES;
use crate::sound_engine::{InstanceId, SoundEngine, SoundInstance, Sounds};
/// The sound `SoundPreviewHandler.preview` plays for a `SoundSource` index,
/// or `None` (`SoundEvents.EMPTY`) for master, music and voice.
pub fn preview_event(source: usize) -> Option<&'static str> {
Some(match *SOUND_SOURCES.get(source)? {
"record" => "minecraft:block.note_block.guitar",
"weather" => "minecraft:entity.lightning_bolt.thunder",
"block" => "minecraft:block.grass.place",
"hostile" => "minecraft:entity.zombie.ambient",
// SoundEvents.COW_SOUNDS.get(CowSoundVariants.SoundSet.CLASSIC).ambientSound()
"neutral" => "minecraft:entity.cow.ambient",
"player" => "minecraft:entity.generic.eat",
"ambient" => "minecraft:ambient.cave",
"ui" => "minecraft:ui.button.click",
_ => return None,
})
}
/// `SoundPreviewHandler`'s `activePreview` and `previousCategory`.
#[derive(Debug, Default)]
pub struct SoundPreview {
active: Option<InstanceId>,
previous: Option<usize>,
}
impl SoundPreview {
/// `SoundPreviewHandler.preview(soundManager, category, volume)`: stop the
/// preview of another category, then, unless the last preview still
/// plays, play this category's sound (`SimpleSoundInstance.forUI` at
/// pitch 1 and the slider's volume).
pub fn preview(&mut self, sounds: &mut impl Sounds, source: usize, volume: f32) {
self.stop_other_category_preview(sounds, source);
if !self.can_play_sound(sounds) {
return;
}
let Some(event) = preview_event(source) else {
return;
};
if let Some(old) = self.active.take() {
sounds.release(old);
}
let instance = SoundInstance::for_ui(event, 1.0, volume, SoundEngine::unseeded());
self.active = Some(sounds.play_instance(instance, true).0);
}
/// The preview playing now, if any.
pub fn active(&self) -> Option<InstanceId> {
self.active
}
/// `stopOtherCategoryPreview`.
fn stop_other_category_preview(&mut self, sounds: &mut impl Sounds, source: usize) {
if self.previous != Some(source) {
self.previous = Some(source);
if let Some(active) = self.active {
sounds.stop_instance(active);
}
}
}
/// `canPlaySound`: no preview yet, or the last one has finished.
fn can_play_sound(&self, sounds: &mut impl Sounds) -> bool {
self.active.is_none_or(|active| !sounds.is_active(active))
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::sound_engine::{Bound, TickContext, UI, test_backend::Null};
use crate::sound_events::SoundRegistry;
fn engine() -> SoundEngine {
let mut registry = SoundRegistry::default();
registry.add_file(
"minecraft",
br#"{"entity.zombie.ambient": {"sounds": ["mob/zombie/say1"]},
"entity.cow.ambient": {"sounds": ["mob/cow/say1"]},
"ui.button.click": {"sounds": ["random/click"]}}"#,
&|_, _| true,
);
SoundEngine::new(registry)
}
fn source(name: &str) -> usize {
SOUND_SOURCES.iter().position(|s| *s == name).unwrap()
}
#[test]
fn each_category_previews_its_vanilla_sound() {
let expected = [
("master", None),
("music", None),
("record", Some("minecraft:block.note_block.guitar")),
("weather", Some("minecraft:entity.lightning_bolt.thunder")),
("block", Some("minecraft:block.grass.place")),
("hostile", Some("minecraft:entity.zombie.ambient")),
("neutral", Some("minecraft:entity.cow.ambient")),
("player", Some("minecraft:entity.generic.eat")),
("ambient", Some("minecraft:ambient.cave")),
("voice", None),
("ui", Some("minecraft:ui.button.click")),
];
for (name, event) in expected {
assert_eq!(preview_event(source(name)), event, "{name}");
}
}
fn slide(
preview: &mut SoundPreview,
engine: &mut SoundEngine,
backend: &mut Null,
name: &str,
volume: f32,
) {
preview.preview(&mut Bound { engine, backend }, source(name), volume);
}
/// Ticks enough for the engine to drop finished or stopped channels.
fn settle(engine: &mut SoundEngine, backend: &mut Null) {
for _ in 0..40 {
engine.tick(false, &TickContext::default(), backend);
}
}
#[test]
fn a_moving_slider_plays_one_preview_at_a_time_and_switching_stops_it() {
let (mut engine, mut backend) = (engine(), Null::default());
let mut preview = SoundPreview::default();
slide(&mut preview, &mut engine, &mut backend, "hostile", 0.4);
let first = preview
.active()
.expect("the hostile slider plays a preview");
let instance = engine.instance(first).unwrap();
assert_eq!(instance.identifier, "minecraft:entity.zombie.ambient");
assert_eq!(instance.source, UI);
assert_eq!((instance.volume, instance.pitch), (0.4, 1.0));
assert!(instance.relative);
assert!(engine.is_active(first));
// canPlaySound: still playing, so dragging further does not restart it.
slide(&mut preview, &mut engine, &mut backend, "hostile", 0.6);
assert_eq!(preview.active(), Some(first));
assert_eq!(engine.active_instances(), vec![first]);
// Once it has finished, the next move plays it again.
for stopped in backend.stopped.values_mut() {
*stopped = true;
}
settle(&mut engine, &mut backend);
assert!(!engine.is_active(first));
slide(&mut preview, &mut engine, &mut backend, "hostile", 0.6);
let second = preview.active().unwrap();
assert_ne!(second, first);
assert!(engine.is_active(second));
// Another category stops the playing preview (SoundManager.stop); the
// engine lets its channel go on the next ticks, then that category's
// own sound plays.
slide(&mut preview, &mut engine, &mut backend, "neutral", 1.0);
assert!(backend.stopped.values().all(|stopped| *stopped));
settle(&mut engine, &mut backend);
assert!(engine.active_instances().is_empty());
slide(&mut preview, &mut engine, &mut backend, "neutral", 1.0);
let third = preview.active().unwrap();
assert_eq!(
engine.instance(third).unwrap().identifier,
"minecraft:entity.cow.ambient"
);
// Master has no sound but still stops the other category's preview.
slide(&mut preview, &mut engine, &mut backend, "master", 1.0);
settle(&mut engine, &mut backend);
assert!(engine.active_instances().is_empty());
slide(&mut preview, &mut engine, &mut backend, "master", 1.0);
assert!(engine.active_instances().is_empty());
}
}
@@ -27,6 +27,10 @@ pub struct Span {
pub fn enable(on: bool) {
ENABLED.store(on, Ordering::Relaxed);
}
/// Whether spans are being recorded.
pub fn enabled() -> bool {
ENABLED.load(Ordering::Relaxed)
}
/// Run `f`, recording its duration under `name` when spans are enabled.
#[inline]
pub fn time<T>(name: &'static str, f: impl FnOnce() -> T) -> T {
@@ -159,6 +159,14 @@ impl Sprites {
/// up to a power of two and limited to [`MAX_ARRAY_BYTES`]. Smaller
/// textures are scaled up by whole pixels, so UVs stay per layer.
pub fn finish(&mut self) {
self.lay_out(true);
}
/// [`Sprites::finish`] for a server, which draws nothing: the layers'
/// size, but neither their pixels nor the animations' frames.
pub fn finish_without_pixels(&mut self) {
self.lay_out(false);
}
fn lay_out(&mut self, pixels: bool) {
let layers = self.native.len().max(1) as u64;
let largest = self.native.iter().map(|n| n.0).max().unwrap_or(SPRITE_SIZE);
self.minimum_size = self.native.iter().map(|n| n.0).min().unwrap_or(SPRITE_SIZE);
@@ -166,6 +174,12 @@ impl Sprites {
while size > SPRITE_SIZE && layers * u64::from(size * size) * 4 > MAX_ARRAY_BYTES {
size /= 2;
}
if !pixels {
self.pixels = Vec::new();
self.animations = Vec::new();
self.size = size;
return;
}
let mut resized = Vec::with_capacity(self.native.len());
self.pixels.clear();
for (from, frames, initial) in &self.native {
+243 -38
View File
@@ -3,8 +3,9 @@
//! hands immutable `Arc` snapshots to workers; results carry a sequence number
//! so stale work is dropped.
use crate::fast_hash::{FxHashMap, FxHashSet};
use crate::section_mask::SectionMask;
use crate::{
chunk::{Chunk, SECTIONS},
chunk::Chunk,
light::{LightChanges, LightTables, apply_lighting, apply_relighting, light_chunk},
mesher::{MeshTables, Mesher, Region, SectionMesh, borrow},
world::World,
@@ -16,11 +17,15 @@ use std::{
collections::{BinaryHeap, HashSet, VecDeque},
sync::{
Arc, Condvar, Mutex, MutexGuard, RwLock, TryLockError,
atomic::{AtomicBool, Ordering},
atomic::{AtomicBool, AtomicUsize, Ordering},
},
thread,
};
/// How long a worker waits with nothing to do before it gives back its
/// generator's scratch buffers ([`ChunkGenerator::idle`]).
pub const IDLE_RELEASE: std::time::Duration = std::time::Duration::from_secs(5);
/// A chunk under generation, opaque to the streamer.
pub type Proto = Box<dyn std::any::Any + Send>;
/// Chunk generation in vanilla's stages: a neighbour-independent proto chunk
@@ -57,6 +62,9 @@ pub trait ChunkGenerator: Send + Sync + 'static {
/// What a loaded chunk needs from the generator before the game uses it,
/// on the worker that loaded it.
fn prepare_loaded(&self, _worker: &mut Self::Worker, _chunk: &Chunk) {}
/// The worker has had nothing to do for [`IDLE_RELEASE`]: give back what
/// it keeps between jobs only to go faster.
fn idle(&self, _worker: &mut Self::Worker) {}
fn proto(&self, worker: &mut Self::Worker, x: i32, z: i32) -> Proto;
fn decorates(&self) -> bool {
false
@@ -74,6 +82,12 @@ pub trait ChunkGenerator: Send + Sync + 'static {
fn light_view(&self, _proto: &Proto) -> Option<Chunk> {
None
}
/// A decorated proto chunk's column sections (`Chunk::sections`
/// indexes) holding a block other than air: what its neighbours' light
/// layers count once it is at INITIALIZE_LIGHT.
fn non_air_sections(&self, _proto: &Proto) -> Option<SectionMask> {
None
}
fn saved_proto(&self, _proto: &Proto) -> Option<crate::chunk::SavedProto> {
None
}
@@ -220,6 +234,9 @@ struct Shared {
/// packs reload; each mesh job takes the current one.
context: RwLock<Arc<WorkerContext>>,
done: Mailbox,
/// Workers that have freed their buffers ([`IDLE_RELEASE`]) and taken no
/// job since: the last of them gives the freed memory back to the OS.
released: AtomicUsize,
}
/// Finished jobs, from the workers to the game thread, in the order they
/// finished. Not an `mpsc` channel: its receiver waits for a sender it finds
@@ -265,6 +282,7 @@ impl Mailbox {
pub struct Streaming {
shared: Arc<Shared>,
light_view: Arc<dyn Fn(&Proto) -> Option<Chunk> + Send + Sync>,
non_air_sections: Arc<dyn Fn(&Proto) -> Option<SectionMask> + Send + Sync>,
threads: Vec<thread::JoinHandle<()>>,
order: u64,
/// Ticks since the columns and protos that fell out of range were swept.
@@ -275,6 +293,11 @@ pub struct Streaming {
generation_scan: GenerationScan,
/// Proto chunks: `None` while checked out to a decoration or save job.
protos: FxHashMap<(i32, i32), Option<Proto>>,
/// The light jobs' views of proto chunks past the area (`light_region`),
/// built once per proto: each is a neighbour of up to three columns and
/// waits in failed regions until the last one loads. Dropped whenever
/// the proto is checked out, replaced or removed.
light_views: FxHashMap<(i32, i32), Arc<Chunk>>,
decorated: FxHashSet<(i32, i32)>,
decorating: usize,
/// Save jobs in flight.
@@ -305,6 +328,8 @@ pub struct Streaming {
deferred: Vec<Done>,
sequence: u64,
pub center: (i32, i32),
/// The view distance around `center`; below 0, no area there (a dedicated
/// server nobody is on).
pub radius: i32,
/// `/forceload`ed chunks: kept loaded whatever the distance.
pub forced: HashSet<(i32, i32)>,
@@ -444,8 +469,14 @@ impl GenerationScan {
wanted.push((input.ranges.priority(x, z, input.loading), x, z));
}
}
// Forced chunks and their generation neighbourhood.
let reach = margin - 1;
// Forced chunks and their generation neighbourhood: the ring that
// is decorated (or finished, without decoration) and the one its
// 3x3 needs.
let reach = if input.decorates {
FORCED_TERRAIN_RING
} else {
FORCED_FEATURES_RING
};
for &(fx, fz) in input.ranges.forced {
for dz in -reach..=reach {
for dx in -reach..=reach {
@@ -502,7 +533,9 @@ impl Streaming {
stop: AtomicBool::new(false),
context: RwLock::new(context.clone()),
done: Mailbox::default(),
released: AtomicUsize::new(0),
});
let workers = threads.max(1);
let light_tables = context.light.clone();
let saves: Arc<dyn Saves> = generator.clone();
let threads = (0..threads.max(1))
@@ -523,14 +556,42 @@ impl Streaming {
loop {
let job = {
let mut queue = shared.queue.lock().unwrap();
let mut released = false;
loop {
if shared.stop.load(Ordering::Relaxed) {
return;
}
if let Some(job) = queue.pop() {
if released {
shared.released.fetch_sub(1, Ordering::Relaxed);
}
break job.job;
}
queue = shared.ready.wait(queue).unwrap();
if released {
queue = shared.ready.wait(queue).unwrap();
continue;
}
let (woken, wait) =
shared.ready.wait_timeout(queue, IDLE_RELEASE).unwrap();
queue = woken;
if wait.timed_out() && queue.is_empty() {
// A server nobody is on, a client standing still:
// free the generator's buffers (and the mesher's
// face cache) until the next job needs them.
drop(queue);
generator.idle(&mut worker);
faces = None;
released = true;
// The allocator keeps freed pages until memory
// runs short: once every worker has freed its own,
// hand them back.
if shared.released.fetch_add(1, Ordering::Relaxed) + 1
== workers
{
horizon_threads::release_free_memory();
}
queue = shared.queue.lock().unwrap();
}
}
};
let done = match job {
@@ -600,9 +661,14 @@ impl Streaming {
let generator = generator.clone();
Arc::new(move |p: &Proto| generator.light_view(p))
};
let non_air_sections = {
let generator = generator.clone();
Arc::new(move |p: &Proto| generator.non_air_sections(p))
};
Self {
shared,
light_view,
non_air_sections,
threads,
order: 0,
scan_age: 0,
@@ -610,6 +676,7 @@ impl Streaming {
generating: Default::default(),
generation_scan: GenerationScan::default(),
protos: Default::default(),
light_views: Default::default(),
decorated: Default::default(),
decorating: 0,
saving: 0,
@@ -665,7 +732,7 @@ impl Streaming {
self.meshing.clear();
for &(x, z) in world.chunks.keys() {
if self.lit.contains(&(x, z)) {
for sy in 0..SECTIONS as i32 {
for sy in 0..world.layout().sections() as i32 {
world.dirty_sections.insert((x, sy, z));
}
}
@@ -683,7 +750,7 @@ impl Streaming {
self.generated_total += 1;
for dz in -1..=1 {
for dx in -1..=1 {
for sy in 0..SECTIONS as i32 {
for sy in 0..world.layout().sections() as i32 {
world.dirty_sections.insert((key.0 + dx, sy, key.1 + dz));
}
}
@@ -698,7 +765,7 @@ impl Streaming {
for dy in -1..=1 {
for dx in -1..=1 {
let s = sy as i32 + dy;
if (0..SECTIONS as i32).contains(&s) {
if (0..world.layout().sections() as i32).contains(&s) {
world.dirty_sections.insert((x + dx, s, z + dz));
}
}
@@ -724,7 +791,7 @@ impl Streaming {
self.lighting.remove(&(x, z));
// By key, not by a pass over every pending section: a moved or
// shrunk storage forgets thousands of columns in one frame.
for sy in 0..SECTIONS as i32 {
for sy in 0..world.layout().sections() as i32 {
self.meshing.remove(&(x, sy, z));
self.waiting.remove(&(x, sy, z));
}
@@ -770,6 +837,7 @@ impl Streaming {
self.decorated.insert((x, z));
for (i, proto) in region.into_iter().enumerate() {
let key = (x + (i % 3) as i32 - 1, z + (i / 3) as i32 - 1);
self.light_views.remove(&key);
self.protos.insert(key, Some(proto));
self.written.insert(key);
}
@@ -780,6 +848,7 @@ impl Streaming {
self.generation_scan.exhausted = false;
self.saving -= 1;
for (key, proto) in protos {
self.light_views.remove(&key);
self.protos.insert(key, Some(proto));
}
}
@@ -787,7 +856,11 @@ impl Streaming {
fn save_checked_out(&mut self, keys: impl IntoIterator<Item = (i32, i32)>) {
let protos: Vec<((i32, i32), Proto)> = keys
.into_iter()
.filter_map(|k| Some((k, self.protos.get_mut(&k)?.take()?)))
.filter_map(|k| {
let proto = self.protos.get_mut(&k)?.take()?;
self.light_views.remove(&k);
Some((k, proto))
})
.collect();
if !protos.is_empty() {
self.saving += 1;
@@ -836,7 +909,7 @@ impl Streaming {
world.chunks.insert(key, Arc::new(chunk));
if loaded {
self.lit.insert(key);
for sy in 0..SECTIONS as i32 {
for sy in 0..world.layout().sections() as i32 {
world.dirty_sections.insert((key.0, sy, key.1));
}
}
@@ -856,7 +929,7 @@ impl Streaming {
/// The 3x3 a light job reads: the finished columns, and for a neighbour
/// that will not finish (past the area), its decorated proto chunk, as
/// vanilla lights its last FULL ring against neighbours at FEATURES.
fn light_region(&self, world: &World, x: i32, z: i32) -> Option<Box<Region>> {
fn light_region(&mut self, world: &World, x: i32, z: i32) -> Option<Box<Region>> {
let mut region: Region = Default::default();
for dz in 0..3 {
for dx in 0..3 {
@@ -864,8 +937,14 @@ impl Streaming {
region[dz][dx] = Some(match world.chunks.get(&n) {
Some(chunk) => chunk.clone(),
None if !self.in_range(n.0, n.1, 1) && self.decorated.contains(&n) => {
let proto = self.protos.get(&n)?.as_ref()?;
Arc::new((self.light_view)(proto)?)
if let Some(view) = self.light_views.get(&n) {
view.clone()
} else {
let proto = self.protos.get(&n)?.as_ref()?;
let view = Arc::new((self.light_view)(proto)?);
self.light_views.insert(n, view.clone());
view
}
}
None => return None,
});
@@ -890,6 +969,15 @@ impl Streaming {
pub fn is_lit(&self, x: i32, z: i32) -> bool {
self.lit.contains(&(x, z))
}
/// The non-air sections of a column that is a decorated proto chunk
/// here (vanilla's INITIALIZE_LIGHT and on), if it is one: a level
/// chunk's light layers count them (#4294).
pub fn proto_sections(&self, x: i32, z: i32) -> Option<SectionMask> {
if !self.decorated.contains(&(x, z)) {
return None;
}
(self.non_air_sections)(self.protos.get(&(x, z))?.as_ref()?)
}
/// `ChunkMap.getLatestStatus` for the loading screen's chunk map: the
/// furthest step this column has reached, `None` before it is asked for.
pub fn latest_status(
@@ -975,6 +1063,7 @@ impl Streaming {
self.generation_scan.exhausted = false;
self.generating.remove(&(x, z));
if self.in_range(x, z, 4) || self.near_finished(x, z, 2) {
self.light_views.remove(&(x, z));
self.protos.insert((x, z), Some(proto));
if decorated || !self.decorates {
self.decorated.insert((x, z));
@@ -1012,7 +1101,7 @@ impl Streaming {
if first {
for dz in -1..=1 {
for dx in -1..=1 {
for sy in 0..SECTIONS as i32 {
for sy in 0..world.layout().sections() as i32 {
world.dirty_sections.insert((x + dx, sy, z + dz));
}
}
@@ -1080,13 +1169,15 @@ impl Streaming {
.iter()
.filter(|&(&(x, z), p)| {
p.is_some()
&& i64::from(x - center.0).pow(2) + i64::from(z - center.1).pow(2) > r4 * r4
&& (self.radius < 0
|| i64::from(x - center.0).pow(2) + i64::from(z - center.1).pow(2)
> r4 * r4)
&& !ranges.in_extra(x, z, 4)
&& !ranges.in_band(x, z, 4)
&& !ranges
.forced
.iter()
.any(|f| (x - f.0).abs() <= 3 && (z - f.1).abs() <= 3)
&& !ranges.forced.iter().any(|f| {
(x - f.0).abs() <= FORCED_TERRAIN_RING
&& (z - f.1).abs() <= FORCED_TERRAIN_RING
})
})
.map(|(k, _)| *k)
.collect();
@@ -1101,6 +1192,7 @@ impl Streaming {
written.push(key);
} else {
self.protos.remove(&key);
self.light_views.remove(&key);
}
}
self.save_checked_out(written);
@@ -1130,6 +1222,7 @@ impl Streaming {
.remove(&(x, z))
.flatten()
.expect("present proto");
self.light_views.remove(&(x, z));
self.finishing.insert((x, z));
self.written.remove(&(x, z));
self.submit(Some((x, z)), 0, Job::Finish(proto));
@@ -1228,6 +1321,7 @@ impl Streaming {
let region: Vec<Proto> = keys
.iter()
.map(|k| {
self.light_views.remove(k);
self.protos
.insert(*k, None)
.flatten()
@@ -1303,7 +1397,7 @@ impl Streaming {
}
if !self.ranges().in_view(x, z) {
world.dirty_sections.take_column(x, z);
for sy in section_indexes(sections) {
for sy in sections.iter().map(|sy| sy as i32) {
self.waiting.insert((x, sy, z));
}
continue;
@@ -1327,7 +1421,7 @@ impl Streaming {
continue;
};
world.dirty_sections.take_column(x, z);
for sy in section_indexes(sections) {
for sy in sections.iter().map(|sy| sy as i32) {
let first = self.meshed.insert((x, z));
self.sequence += 1;
self.meshing.insert((x, sy, z), self.sequence);
@@ -1403,6 +1497,7 @@ impl Streaming {
&mut changed,
);
Self::mark_light_changes(world, &changed);
Self::relight_beside_unlit(world, &changed);
if !self.light_snapshots.is_empty() {
for p in positions {
self.light_edit_sequence += 1;
@@ -1432,6 +1527,7 @@ impl Streaming {
&mut changed,
);
Self::mark_light_changes(world, &changed);
Self::relight_beside_unlit(world, &changed);
}
let oldest = self.light_snapshots.values().copied().min();
match oldest {
@@ -1439,12 +1535,20 @@ impl Streaming {
None => self.light_log.clear(),
}
}
/// A column whose light an edit changed beside a column not lit yet gets
/// a full light job ([`crate::light::beside_unlit`]).
fn relight_beside_unlit(world: &mut World, changed: &LightChanges) {
let columns = crate::light::beside_unlit(changed, |x, z| {
world.chunks.get(&(x, z)).is_some_and(|c| !c.lit)
});
world.dirty_light.extend(columns);
}
/// Sections whose meshes sample a changed light value (faces and corners
/// read light from neighbouring blocks).
fn mark_light_changes(world: &mut World, changed: &LightChanges) {
if let Some(log) = &mut world.light_log {
for (x, sy, z) in changed.sections() {
*log.entry((x, z)).or_default() |= 1 << sy;
log.entry((x, z)).or_default().insert(sy as usize);
}
}
changed.dirty_sections(|section| {
@@ -1528,6 +1632,16 @@ impl Streaming {
fn in_range(&self, x: i32, z: i32, margin: i32) -> bool {
self.ranges().in_range(x, z, margin)
}
/// Rank the 3x3 a chunk loaded to FULL decorates, in one generation
/// task's order (`ChunkGenerationTask`: x-outer, z-inner), after every
/// chunk ranked before.
pub fn rank_full_task(&mut self, x: i32, z: i32) {
for dx in -1..=1 {
for dz in -1..=1 {
self.decoration_order.rank_or_append(x + dx, z + dz);
}
}
}
pub fn band(&self) -> Option<Band> {
self.band
}
@@ -1606,6 +1720,14 @@ pub fn in_view_distance(center: (i32, i32), radius: i32, x: i32, z: i32) -> bool
let (dx, dz) = (gap(x - center.0), gap(z - center.1));
dx * dx + dz * dz < i64::from(radius) * i64::from(radius)
}
/// The rings around a `/forceload`ed chunk, in chunks. Vanilla's FORCED
/// ticket is level 31 (`ChunkMap.FORCED_TICKET_LEVEL`), the level rises one
/// per ring (`ChunkTracker.computeLevelFromNeighbor`), and the level picks
/// the column's status (`ChunkLevel.generationStatus`): full (33) two rings
/// out, features (34) at three, terrain (35) at four.
const FORCED_FULL_RING: i32 = 2;
const FORCED_FEATURES_RING: i32 = 3;
const FORCED_TERRAIN_RING: i32 = 4;
/// The areas kept loaded: circles around the player and `extra`, and forced chunks.
struct Ranges<'a> {
center: (i32, i32),
@@ -1825,7 +1947,7 @@ impl Ranges<'_> {
let (dx, dz) = (gap(x - self.center.0), gap(z - self.center.1));
let r = i64::from(self.radius + 1);
// The extra areas are squares: their finished square grown by `reach`.
dx * dx + dz * dz <= r * r
(self.radius >= 0 && dx * dx + dz * dz <= r * r)
|| self.in_extra(x, z, 1 + reach)
|| self.in_band(x, z, 1 + reach)
}
@@ -1858,10 +1980,19 @@ impl Ranges<'_> {
fn in_main_range(&self, x: i32, z: i32, margin: i32) -> bool {
let r = i64::from(self.radius + margin);
let (dx, dz) = (i64::from(x - self.center.0), i64::from(z - self.center.1));
if dx * dx + dz * dz <= r * r {
if self.radius >= 0 && dx * dx + dz * dz <= r * r {
return true;
}
let reach = (margin - 1).max(0);
// A forced chunk holds a FORCED ticket at level 31
// (`ChunkMap.FORCED_TICKET_LEVEL`), and the level rises one per ring
// (`ChunkTracker.computeLevelFromNeighbor`): the margin is the
// vanilla status ring the caller asks for.
let reach = match margin {
1 => FORCED_FULL_RING,
2 => FORCED_FEATURES_RING,
3 => FORCED_TERRAIN_RING,
_ => margin + 1,
};
self.forced
.iter()
.any(|f| (x - f.0).abs() <= reach && (z - f.1).abs() <= reach)
@@ -1886,16 +2017,6 @@ impl Drop for Streaming {
}
}
}
/// The section indexes set in a column's bits, lowest first.
fn section_indexes(mut bits: u32) -> impl Iterator<Item = i32> {
std::iter::from_fn(move || {
(bits != 0).then(|| {
let sy = bits.trailing_zeros() as i32;
bits &= bits - 1;
sy
})
})
}
/// The queued jobs' priorities computed again from each one's column
/// `distance` (`Streaming::submit`).
fn rank_again(queue: &mut BinaryHeap<Queued>, distance: impl Fn(i32, i32) -> i64) {
@@ -2130,9 +2251,14 @@ mod tests {
}
}
}
let forced_reach = if input.decorates {
FORCED_TERRAIN_RING
} else {
FORCED_FEATURES_RING
};
for &(fx, fz) in input.ranges.forced {
for dz in -(margin - 1)..=(margin - 1) {
for dx in -(margin - 1)..=(margin - 1) {
for dz in -forced_reach..=forced_reach {
for dx in -forced_reach..=forced_reach {
let (x, z) = (fx + dx, fz + dz);
if missing(x, z) {
wanted.push((input.ranges.distance(x, z), x, z));
@@ -2479,6 +2605,34 @@ mod tests {
}
}
/// An idle dedicated server keeps no area around its centre: only a spawn
/// search's chunk (FULL alone: its 3x3 decorated, 5x5 generated) and the
/// forced chunks.
#[test]
fn no_area_around_an_idle_servers_centre() {
let forced = HashSet::from([(30, 30)]);
let extra = [((5, -3), -1)];
let r = Ranges {
center: (5, -3),
radius: -1,
extra: &extra,
forced: &forced,
cover: None,
band: None,
};
for x in -5i32..=15 {
for z in -13i32..=7 {
let d = (x - 5).abs().max((z + 3).abs());
assert_eq!(r.in_range(x, z, 1), d == 0, "({x}, {z})");
assert_eq!(r.chunk_kept(x, z, true), d <= 2, "({x}, {z})");
assert_eq!(r.requested(x, z, true), d <= 2, "({x}, {z})");
}
}
assert!(r.in_range(30, 30, 1));
let idle = Ranges { extra: &[], ..r };
assert!(!idle.requested(5, -3, true) && idle.unloaded(5, -3, true));
}
/// A server player's area (`lan_update_streaming`: the server view
/// distance + 1) finishes vanilla's FULL square: PLAYER_LOADING tickets at
/// level 31 out to the view distance, FULL (33) two chunks past it. Every
@@ -2534,6 +2688,57 @@ mod tests {
}
}
}
/// A `/forceload`ed chunk holds a FORCED ticket at level 31
/// (`ChunkMap.FORCED_TICKET_LEVEL`): the level rises one per ring
/// (`ChunkTracker.computeLevelFromNeighbor`) and picks the column's
/// status (`ChunkLevel.generationStatus`). So vanilla finishes the two
/// rings around it (33), gives the third its features (34) and the
/// fourth its terrain (35), and the rings past that are left alone.
#[test]
fn forced_chunks_reach_vanillas_rings() {
let forced: HashSet<(i32, i32)> = [(40, -40)].into();
let r = Ranges {
// The player's own area, far away.
center: (-400, 300),
radius: 2,
extra: &[],
forced: &forced,
cover: None,
band: None,
};
let level = |x: i32, z: i32| 31 + (x - 40).abs().max((z + 40).abs());
for x in 40 - 6..=40 + 6 {
for z in -40 - 6..=-40 + 6 {
// The full ring: the column becomes a level chunk.
assert_eq!(r.in_range(x, z, 1), level(x, z) <= 33, "({x}, {z})");
// The features ring, and the terrain ring.
assert_eq!(r.in_range(x, z, 2), level(x, z) <= 34, "({x}, {z})");
assert_eq!(r.in_range(x, z, 3), level(x, z) <= 35, "({x}, {z})");
assert_eq!(r.requested(x, z, true), level(x, z) <= 35, "({x}, {z})");
assert_eq!(r.chunk_kept(x, z, true), level(x, z) <= 35, "({x}, {z})");
assert_eq!(r.unloaded(x, z, true), level(x, z) > 35, "({x}, {z})");
}
}
// Generation reaches the terrain ring: the features ring is
// decorated from it.
let mut fixture = GenerationFixture::new(2, true);
fixture.center = (-400, 300);
fixture.forced = forced;
let candidates = GenerationScan::default()
.candidates(fixture.input(), usize::MAX)
.expect("a scan");
for (dx, dz) in [(-4, 0), (4, 0), (0, -4), (0, 4), (3, 3)] {
assert!(
candidates
.iter()
.any(|&(_, x, z)| (x, z) == (40 + dx, -40 + dz)),
"the terrain ring at ({}, {}) is not generated",
40 + dx,
-40 + dz
);
}
}
}
#[cfg(test)]
@@ -146,9 +146,10 @@ fn apply_fog(color: vec4<f32>, spherical: f32, cylindrical: f32) -> vec4<f32> {
// Bit 15 of the layer marks opaque leaves (forceOpaque): no alpha cutout.
let color = sprite(in.uv, in.layer & 0x7fffu) * in.color;
if color.a < 0.5 && (in.layer & 0x8000u) == 0u { discard; }
// Alpha 0 tells HDR output (hdr.wgsl) a light-emitting block's bright pixels
// may shine. Nothing else reads the frame's alpha.
let emissive = select(1.0, 0.0, in.emission > 0u);
// Below 0.75, alpha tells HDR output (hdr.wgsl) a light source's bright
// pixels may shine, and at which tier (mesher::hdr_tier): 0.525 at the
// lowest, 0 at the brightest. Nothing else reads the frame's alpha.
let emissive = select(1.0, 0.7 * f32(4u - min(in.emission, 4u)) / 4.0, in.emission > 0u);
return apply_fog(vec4(color.rgb, emissive), in.spherical, in.cylindrical);
}
@fragment fn fs_translucent(in: TerrainOut) -> @location(0) vec4<f32> {
+44 -10
View File
@@ -390,6 +390,7 @@ pub fn slider(
value: f32,
hover: bool,
active: bool,
dragging: bool,
) {
let kind = crate::widgets::Kind::Slider {
value,
@@ -401,17 +402,8 @@ pub fn slider(
// A controller's D-pad can focus it (Horizon's controller support).
crate::widgets::target_as([x, y, w, 20.0], kind);
}
let track = if hover && active {
"gui/sprites/widget/slider_highlighted"
} else {
"gui/sprites/widget/slider"
};
let (track, handle) = slider_sprites(hover, active, dragging);
nine_slice(batch, atlas, track, x, y, w, 20.0, u32::MAX);
let handle = if hover && active {
"gui/sprites/widget/slider_handle_highlighted"
} else {
"gui/sprites/widget/slider_handle"
};
nine_slice(
batch,
atlas,
@@ -429,6 +421,21 @@ pub fn slider(
};
centered_text(batch, atlas, label, x + 2.0, y + 6.0, w - 4.0, color);
}
/// Track and handle sprites: the track outline shows only while the slider is
/// dragged, hovering highlights just the handle.
fn slider_sprites(hover: bool, active: bool, dragging: bool) -> (&'static str, &'static str) {
let track = if dragging {
"gui/sprites/widget/slider_highlighted"
} else {
"gui/sprites/widget/slider"
};
let handle = if hover && active {
"gui/sprites/widget/slider_handle_highlighted"
} else {
"gui/sprites/widget/slider_handle"
};
(track, handle)
}
/// Slider value for a click at `cx` (AbstractSliderButton.setValueFromMouse).
pub fn slider_value(x: f32, w: f32, cx: f32) -> f32 {
((cx - (x + 4.0)) / (w - 8.0)).clamp(0.0, 1.0)
@@ -1078,6 +1085,21 @@ impl EditBox {
self.set_cursor(pos, shift);
}
}
/// `MultilineTextField.selectWordAtCursor` on a book page: the word before
/// the cursor is selected, its end found past non-whitespace only
/// (`getWordEndPosition`).
pub fn select_word_at_cursor(&mut self) {
let begin = multiline_word_position(&self.value, -1, self.cursor);
let end = begin
+ self
.value
.chars()
.skip(begin)
.take_while(|c| !java_whitespace(*c))
.count();
self.set_cursor(begin, false);
self.set_cursor(end, true);
}
/// EditBox.onDrag: the selection follows the pointer.
pub fn drag_to(&mut self, atlas: &HudAtlas, x: f32) {
let pos = self.position_at(atlas, x);
@@ -1329,6 +1351,18 @@ mod tests {
parse_nine_slice(&serde_json::from_str(json).unwrap()).unwrap()
}
#[test]
fn slider_track_is_outlined_only_while_dragged() {
let (track, handle) = slider_sprites(true, true, false);
assert_eq!(track, "gui/sprites/widget/slider");
assert_eq!(handle, "gui/sprites/widget/slider_handle_highlighted");
let (track, handle) = slider_sprites(true, true, true);
assert_eq!(track, "gui/sprites/widget/slider_highlighted");
assert_eq!(handle, "gui/sprites/widget/slider_handle_highlighted");
let (track, handle) = slider_sprites(false, true, false);
assert_eq!(track, "gui/sprites/widget/slider");
assert_eq!(handle, "gui/sprites/widget/slider_handle");
}
#[test]
fn separator_tiles_sample_both_rows_and_clip_the_last_column() {
let mut batch = HudBatch::new([640, 480]);
tile(
+53 -27
View File
@@ -1,7 +1,10 @@
//! Resident client world: streamed chunk columns plus the bookkeeping the game
//! loop needs to relight and remesh after edits.
use crate::chunk::{Chunk, MIN_Y, SECTIONS};
use crate::fast_hash::{FxHashMap, FxHashSet};
use crate::{
chunk::{Chunk, ColumnLayout, LevelShape},
fast_hash::{FxHashMap, FxHashSet},
section_mask::SectionMask,
};
use horizon_core::random::LegacyRandom;
use horizon_world::registry::BlockStateId;
use std::sync::Arc;
@@ -11,28 +14,30 @@ use std::sync::Arc;
/// rather than at every section of it.
#[derive(Clone, Debug, Default)]
pub struct DirtySections {
columns: crate::fast_hash::FxHashMap<(i32, i32), u32>,
columns: crate::fast_hash::FxHashMap<(i32, i32), SectionMask>,
}
const _: () = assert!(SECTIONS <= 32);
impl DirtySections {
pub fn insert(&mut self, (x, sy, z): (i32, i32, i32)) {
debug_assert!((0..SECTIONS as i32).contains(&sy));
*self.columns.entry((x, z)).or_default() |= 1 << sy;
debug_assert!((0..SectionMask::CAPACITY as i32).contains(&sy));
self.columns.entry((x, z)).or_default().insert(sy as usize);
}
pub fn contains(&self, &(x, sy, z): &(i32, i32, i32)) -> bool {
(0..SECTIONS as i32).contains(&sy)
&& self.columns.get(&(x, z)).is_some_and(|m| m & 1 << sy != 0)
(0..SectionMask::CAPACITY as i32).contains(&sy)
&& self
.columns
.get(&(x, z))
.is_some_and(|m| m.contains(sy as usize))
}
/// The dirty section indexes of column (x, z), as bits, removed.
pub fn take_column(&mut self, x: i32, z: i32) -> u32 {
self.columns.remove(&(x, z)).unwrap_or(0)
/// The dirty section indexes of column (x, z), removed.
pub fn take_column(&mut self, x: i32, z: i32) -> SectionMask {
self.columns.remove(&(x, z)).unwrap_or_default()
}
/// Keep the columns `keep` accepts.
pub fn retain_columns(&mut self, mut keep: impl FnMut(i32, i32) -> bool) {
self.columns.retain(|&(x, z), _| keep(x, z));
}
/// The columns holding dirty sections, with their section bits.
pub fn columns(&self) -> impl Iterator<Item = ((i32, i32), u32)> + '_ {
/// The columns holding dirty sections, with their section indexes.
pub fn columns(&self) -> impl Iterator<Item = ((i32, i32), SectionMask)> + '_ {
self.columns.iter().map(|(&c, &m)| (c, m))
}
pub fn clear(&mut self) {
@@ -43,10 +48,13 @@ impl DirtySections {
}
/// How many sections are dirty.
pub fn len(&self) -> usize {
self.columns.values().map(|m| m.count_ones() as usize).sum()
self.columns.values().map(SectionMask::len).sum()
}
}
pub struct World {
/// The level's build range and skylight (its dimension type); its
/// chunks hold `shape.column()`.
pub shape: LevelShape,
pub fast_lava: bool,
pub chunks: crate::chunk_map::ChunkMap,
pub random: LegacyRandom,
@@ -88,7 +96,7 @@ pub struct World {
/// The sections whose light changed since the log was last drained, as
/// a bit per section of each column, kept while `block_log` is
/// (`ChunkHolder.sectionLightChanged`).
pub light_log: Option<crate::fast_hash::FxHashMap<(i32, i32), u32>>,
pub light_log: Option<crate::fast_hash::FxHashMap<(i32, i32), SectionMask>>,
/// The villager POIs of each section (`PoiManager`'s sections).
pub pois: crate::poi_sections::PoiSections<crate::poi_sections::Poi>,
/// Moving-piston states removed during the last tick; retained until the
@@ -165,6 +173,7 @@ impl Weather {
impl World {
pub fn new(air: BlockStateId, seed: i64) -> Self {
Self {
shape: LevelShape::OVERWORLD,
chunks: Default::default(),
random: LegacyRandom::new(seed),
revision: 0,
@@ -249,6 +258,18 @@ impl World {
world.revision = 0;
Ok(world)
}
/// The column the level's chunks hold.
pub fn layout(&self) -> ColumnLayout {
self.shape.column()
}
/// The lowest block Y the level's chunks hold.
pub fn bottom_y(&self) -> i32 {
self.layout().min_y()
}
/// One above the highest block Y the level's chunks hold.
pub fn top_y(&self) -> i32 {
self.layout().max_y()
}
/// Resident storage write; marks the touched sections (and neighbours on
/// section borders) for remeshing and the surrounding chunks for relighting.
/// Neighbour updates, drops and block entities belong to the gameplay layer.
@@ -256,7 +277,8 @@ impl World {
let Some(chunk) = self.chunks.get_mut(&(x >> 4, z >> 4)) else {
return Err("write outside resident chunks".into());
};
if y < MIN_Y || y >= MIN_Y + (SECTIONS as i32) * 16 {
let (min_y, sections) = (chunk.min_y(), chunk.sections.len() as i32);
if chunk.section_index(y).is_none() {
return Err("write outside world height".into());
}
let previous = Arc::make_mut(chunk).set(x & 15, y, z & 15, state.0);
@@ -276,14 +298,14 @@ impl World {
// the sections it can reach: this section, the one above/below
// only on a section face, and a neighbour column only on a chunk
// border (the diagonal only where both borders meet).
let sy = (y - MIN_Y) >> 4;
let sy = (y - min_y) >> 4;
let local_y = y & 15;
let mark = |dirty: &mut DirtySections, bx: i32, bz: i32| {
dirty.insert((bx >> 4, sy, bz >> 4));
if local_y == 0 && sy > 0 {
dirty.insert((bx >> 4, sy - 1, bz >> 4));
}
if local_y == 15 && sy + 1 < SECTIONS as i32 {
if local_y == 15 && sy + 1 < sections {
dirty.insert((bx >> 4, sy + 1, bz >> 4));
}
};
@@ -319,17 +341,20 @@ impl World {
Ok(())
}
/// `getHeight(Heightmap.Types.WORLD_SURFACE, x, z)`: one above the highest
/// block that isn't `air`, or `MIN_Y` (also where the chunk isn't loaded).
/// block that isn't `air`, or the column's minimum Y (also where the chunk
/// isn't loaded).
pub fn world_surface(&self, x: i32, z: i32, air: impl Fn(BlockStateId) -> bool) -> i32 {
self.chunks.get(&(x >> 4, z >> 4)).map_or(MIN_Y, |chunk| {
let bottom = self.layout().min_y();
self.chunks.get(&(x >> 4, z >> 4)).map_or(bottom, |chunk| {
chunk.world_surface(x, z, |v| air(BlockStateId(v)))
})
}
/// `getHeight(Heightmap.Types.MOTION_BLOCKING, x, z)`: one above the
/// highest block where `blocks` (motion blocking or holding a fluid),
/// or `MIN_Y` (also where the chunk isn't loaded).
/// or the column's minimum Y (also where the chunk isn't loaded).
pub fn motion_blocking(&self, x: i32, z: i32, blocks: impl Fn(BlockStateId) -> bool) -> i32 {
self.chunks.get(&(x >> 4, z >> 4)).map_or(MIN_Y, |chunk| {
let bottom = self.layout().min_y();
self.chunks.get(&(x >> 4, z >> 4)).map_or(bottom, |chunk| {
chunk.motion_blocking(x & 15, z & 15, |v| blocks(BlockStateId(v)))
})
}
@@ -348,12 +373,13 @@ impl World {
hi: [i32; 3],
mut matches: impl FnMut(BlockStateId) -> bool,
) -> bool {
let top = MIN_Y + SECTIONS as i32 * 16 - 1;
let layout = self.layout();
let (bottom, top) = (layout.min_y(), layout.max_y() - 1);
// Heights outside the sections read as state 0.
if (lo[1] < MIN_Y || hi[1] > top) && matches(BlockStateId(0)) {
if (lo[1] < bottom || hi[1] > top) && matches(BlockStateId(0)) {
return true;
}
let sections = (lo[1].max(MIN_Y) - MIN_Y) >> 4..=(hi[1].min(top) - MIN_Y) >> 4;
let sections = (lo[1].max(bottom) - bottom) >> 4..=(hi[1].min(top) - bottom) >> 4;
for cx in lo[0] >> 4..=hi[0] >> 4 {
for cz in lo[2] >> 4..=hi[2] >> 4 {
let Some(chunk) = self.chunks.get(&(cx, cz)) else {
@@ -465,8 +491,8 @@ mod tests {
}
let mut got: Vec<_> = world.dirty_sections.columns().collect();
let mut want: Vec<_> = expected.columns().collect();
got.sort_unstable();
want.sort_unstable();
got.sort_unstable_by_key(|&(column, _)| column);
want.sort_unstable_by_key(|&(column, _)| column);
assert_eq!(got, want, "write at {x} {y} {z}");
if (x & 15, z & 15) == (3, 3) {
assert_eq!(world.dirty_sections.len(), 1);
+85 -9
View File
@@ -77,19 +77,31 @@ impl Zip {
// A clone shares the bytes and the central directory: reading needs `&mut`.
let mut archive = self.archive.clone();
let mut entry = archive.by_index_raw(index).map_err(invalid)?;
let (method, size) = (entry.compression(), entry.size() as usize);
let method = entry.compression();
let mut raw = Vec::with_capacity((entry.compressed_size() as usize).min(self.len));
entry.read_to_end(&mut raw)?;
match method {
CompressionMethod::Stored => Ok(raw),
CompressionMethod::Deflated => miniz_oxide::inflate::decompress_to_vec_with_limit(
&raw,
size.max(1)
.saturating_mul(2)
.saturating_add(1024)
.min(MAX_ENTRY),
)
.map_err(|_| invalid("corrupt deflate stream")),
CompressionMethod::Deflated => {
// Java's ZipFile trusts neither size an entry declares: it
// inflates the stream to its end and keeps what comes out.
// Packs in the wild (a Nexo-generated one served through
// Dropbox, for one) carry central-directory sizes that point
// at other files, and miniz_oxide, which refuses input past
// the stream's end, failed whole entries with "corrupt
// deflate stream" and with them the whole pack. Only the
// size limit stands between the archive and a zip bomb.
let decoder = flate2::read::DeflateDecoder::new(raw.as_slice());
let mut decoded = Vec::with_capacity(raw.len().min(MAX_ENTRY));
decoder
.take(MAX_ENTRY as u64 + 1)
.read_to_end(&mut decoded)
.map_err(|_| invalid("corrupt deflate stream"))?;
if decoded.len() > MAX_ENTRY {
return Err(invalid("entry inflates past the size limit"));
}
Ok(decoded)
}
_ => Err(invalid("unsupported zip compression")),
}
}
@@ -214,6 +226,70 @@ mod tests {
assert!(zip.read("missing").is_err());
}
/// The offset of the central-directory header of `name`.
fn central_header(bytes: &[u8], name: &str) -> usize {
let mut at = 0;
while let Some(i) = bytes[at..]
.windows(4)
.position(|s| s == [0x50, 0x4b, 0x01, 0x02])
{
let p = at + i;
let nlen = u16::from_le_bytes(bytes[p + 28..p + 30].try_into().unwrap()) as usize;
if &bytes[p + 46..p + 46 + nlen] == name.as_bytes() {
return p;
}
at = p + 4;
}
panic!("no central header for {name}");
}
/// Java's `ZipFile` inflates the stream and keeps what comes out, so a
/// central directory that names a size other than the stream's (the
/// Nexo pack Dropbox serves for one server does) changes nothing.
#[test]
fn reads_a_deflate_stream_larger_than_its_declared_size() {
use std::io::Write;
use zip::write::SimpleFileOptions;
let mut writer = zip::ZipWriter::new(Cursor::new(Vec::new()));
writer
.start_file(
"large.txt",
SimpleFileOptions::default().compression_method(CompressionMethod::Deflated),
)
.unwrap();
writer.write_all(&vec![b'x'; 4096]).unwrap();
let mut bytes = writer.finish().unwrap().into_inner();
let central = central_header(&bytes, "large.txt");
bytes[central + 24..central + 28].copy_from_slice(&1u32.to_le_bytes());
let zip = Zip::from_bytes(bytes).unwrap();
assert_eq!(zip.read("large.txt").unwrap(), vec![b'x'; 4096]);
}
/// Some pack writers leave an entry's compressed size longer than its
/// deflate stream, so the bytes past the stream's end are part of it.
/// Java inflates to the stream's end and ignores them; miniz_oxide
/// refused the input and failed the entry, and with it the whole pack.
#[test]
fn reads_past_trailing_bytes_after_the_deflate_stream() {
let mut bytes = written();
let name = "Pack-main/assets/minecraft/lang/en_us.json";
let central = central_header(&bytes, name);
let local =
u32::from_le_bytes(bytes[central + 42..central + 46].try_into().unwrap()) as usize;
for at in [central + 20, local + 18] {
let csize = u32::from_le_bytes(bytes[at..at + 4].try_into().unwrap());
bytes[at..at + 4].copy_from_slice(&(csize + 8).to_le_bytes());
}
let zip = Zip::from_bytes(bytes).unwrap();
assert_eq!(
zip.read(name).unwrap(),
"{\"a\":\"b\"}".repeat(100).as_bytes()
);
}
/// Loka's server pack (#3413) names its metadata `pack.mcmeta/`.
/// `ZipFile.getEntry("pack.mcmeta")` falls back to that folder entry and
/// vanilla reads its bytes; a file of the exact name still comes first.
+1 -1
View File
@@ -65,7 +65,7 @@ unicode-bidi = "0.3.18"
[target.'cfg(unix)'.dependencies]
# The server thread's CPU time per tick (`HORIZON_SPIKES`, spans.rs).
rustix = { version = "1", default-features = false, features = ["std", "time"] }
rustix = { version = "1", default-features = false, features = ["std", "time", "process"] }
[target.'cfg(windows)'.dependencies]
# Use the registered URI handler without routing links through Explorer/cmd.
@@ -11,5 +11,57 @@
"horizon.options.look_deadzone": "Look Deadzone",
"horizon.options.button_glyphs": "Button Glyphs",
"horizon.options.menu_navigation": "Menu Navigation",
"horizon.options.on_screen_keyboard": "On-Screen Keyboard"
"horizon.options.on_screen_keyboard": "On-Screen Keyboard",
"horizon.options.chat_delay": "Chat Delay",
"horizon.options.lightbar.health": "Health",
"horizon.options.lightbar.dimension": "Dimension",
"horizon.options.glyphs.auto": "Auto",
"horizon.options.glyphs.xbox": "Xbox",
"horizon.options.glyphs.playstation": "PlayStation",
"horizon.options.glyphs.nintendo": "Nintendo",
"horizon.options.menu_focus": "Focus",
"horizon.options.menu_pointer": "Pointer",
"horizon.options.keyboard.auto": "Auto",
"horizon.options.keyboard.horizon": "Horizon",
"horizon.options.keyboard.steam": "Steam",
"horizon.options.unavailable": "This feature is not yet available in Horizon.",
"horizon.options.search": "Search settings...",
"horizon.pages.mods": "Mods",
"horizon.pages.shader_packs": "Shader Packs",
"horizon.pages.controller": "Controller Settings",
"horizon.pages.controller_binds": "Controller Binds",
"horizon.pages.extras": "Horizon Extras",
"horizon.pages.settings": "Horizon Settings",
"horizon.pages.agent": "AI Agent",
"horizon.pages.settings.tooltip": "Horizon's own settings: graphics, controllers, extras and mods.",
"horizon.pages.graphics.tooltip": "Graphics, simply: each setting says what it costs.",
"horizon.pages.graphics_advanced.tooltip": "Every graphics setting, Horizon's included, with what each costs.",
"horizon.pages.controller.tooltip": "Controllers: their buttons, sticks, vibration and menu navigation.",
"horizon.pages.extras.tooltip": "Optional additions, all off by default: the game stays vanilla until you turn one on.",
"horizon.pages.agent.tooltip": "Let your own AI agent play: horizon-ctl and MCP clients on this computer.",
"horizon.pages.shader_packs.tooltip": "Shader packs from the shaderpacks folder: Horizon's own and those in the shaders/ format. One runs at a time.",
"horizon.pages.mods.tooltip": "Mods made for Horizon, from the horizon-mods folder. Each runs in a sandbox and stays off until you turn it on.",
"horizon.pages.open.graphics": "Graphics...",
"horizon.pages.open.graphics_advanced": "Advanced Graphics...",
"horizon.pages.open.shader_packs": "Shader Packs...",
"horizon.pages.open.controller": "Controller Settings...",
"horizon.pages.open.extras": "Extras...",
"horizon.pages.open.mods": "Mods...",
"horizon.pages.open.agent": "AI Agent...",
"horizon.pages.open.horizon_graphics": "Horizon Graphics...",
"horizon.pages.open.controller_binds": "Controller Binds...",
"horizon.pages.open.horizon_settings": "Horizon Settings...",
"horizon.mods.empty": "No mods: put .hmod files in the horizon-mods folder",
"horizon.mods.stopped": " (Stopped)",
"horizon.mods.dev": " (Dev)",
"horizon.mods.settings": "Settings",
"horizon.mods.open_folder": "Open Mod Folder",
"horizon.shader_packs.empty": "No shader packs: put them in the shaderpacks folder",
"horizon.shader_packs.kind_horizon": " (Horizon)",
"horizon.agent.copy_details": "Copy Connection Details",
"horizon.multiplayer.join": "Join",
"horizon.multiplayer.cancel_reconnecting": "Cancel Reconnecting",
"horizon.multiplayer.join_friend": "Join a Friend",
"horizon.multiplayer.invite_code": "Invite Code",
"horizon.multiplayer.relay": "Relay (optional)"
}
@@ -0,0 +1,15 @@
{
"horizon.options.controller": "Kontroler",
"horizon.options.vibration": "Wibracje",
"horizon.options.adaptive_triggers": "Adaptacyjne spusty",
"horizon.options.lightbar": "Pasek świetlny",
"horizon.options.look_sensitivity": "Czułość rozglądania",
"horizon.options.invert_x": "Odwróć oś X rozglądania",
"horizon.options.invert_y": "Odwróć oś Y rozglądania",
"horizon.options.sneak_button": "Przycisk skradania",
"horizon.options.move_deadzone": "Martwa strefa ruchu",
"horizon.options.look_deadzone": "Martwa strefa rozglądania",
"horizon.options.button_glyphs": "Symbole przycisków",
"horizon.options.menu_navigation": "Nawigacja po menu",
"horizon.options.on_screen_keyboard": "Klawiatura ekranowa"
}
Loaded 100 of 821 files, more files were not shown because too many files have changed in this diff. Show more