Commit Graph

3685 Commits

Author SHA1 Message Date
Ludovic Marie a1af7fdad5 Worlds without structures generate none
`generate-structures=false` (server.properties, stored by #733) and the
world screen's Generate Structures were written to the world's settings
but the generator ignored them. VanillaTerrain now builds its generator
from the world's `generate_structures`
(OverworldGenerator::for_world): without structures there are no starts,
terrain adaptation or structure pieces, as in
ChunkStatusTasks.generateStructureStarts, and `locate structure` and eyes
of ender find nothing (ChunkGenerator.findNearestMapStructure).

The server world gen harness's world without structures now also
compares `locate structure` for a village and a mineshaft and the saved
chunks' structure starts and references.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 03:01:55 +02:00
Ludovic Marie 5e1abf2b4e Clients of a server show its primed TNT, falling blocks, projectiles and crystals
A Horizon client of a server places what PR #766 sends: primed TNT with
its fuse, falling blocks with their block state and start position,
arrows (critical, in the ground), snowballs, eggs, pearls, fireballs,
wither skulls, wind charges and llama spit, tridents, firework rockets
and end crystals with their beam and base. They interpolate like mobs,
turn with the move packets, and are cleared with the connection, a
respawn or a dimension change.

`status` lists them (`projectiles`), and lan_e2e has a `projectiles`
check: the guest sees the host's primed TNT, end crystal and landed
arrow where the host has them, and a falling block lands on both sides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 03:00:42 +02:00
Ludovic Marie 946bf84818 Load summoned and saved primed TNT as live TNT; step the entity harness
`/summon minecraft:tnt` and primed TNT in a saved chunk were kept as an
unsimulated entity. They now become primed TNT with the fuse (80 when
absent) and motion they were saved with (PrimedTnt.readAdditionalSaveData).

The entity harness runs its scene for a fixed 200 ticks (`tick step`),
so what still changes when the client stops recording (a fuse) ends the
same on both servers. Its scene has two primed TNT (one falling), a
floating falling block, an arrow that lands and an end crystal. Unit
tests cover arrows' position and rotation, fireballs' bundled power and
precise position syncs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 02:57:12 +02:00
Ludovic Marie 866e772227 Server: track primed TNT, falling blocks, projectiles, tridents, fireworks and crystals
These entities had no id in Horizon, so a server could not send them to
its clients. Each now has one, given from the entity counter before it is
first tracked, and goes to guests as vanilla's ServerEntity sends it:

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

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 02:57:12 +02:00
Ludovic Marie 583502f0f4 Clients of a server show its boats, minecarts, armor stands, frames and paintings
ClientPacketListener.handleAddEntity for the objects a server tracks: a
Horizon client of a server (a LAN host, a dedicated server, single
player's server thread) now places the boats, minecarts, armor stands,
item frames and paintings it is sent, where the server says.

- Spawn: carts by kind, boats and rafts by wood (with a chest), armor
  stands, frames and paintings at their block with the direction from the
  spawn data.
- Entity data: frame items and rotation, painting variants (a registry
  holder), armor stand flags and health, boat paddles, vehicle hurt.
- Equipment: what an armor stand wears and holds.
- Moves interpolate like mobs'; rotation and ground state follow.
- They are cleared with the connection, a respawn or a dimension change.

`status` lists them (`objects`), and lan_e2e has an `objects` check: the
host summons them, the guest sees each as the host has it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 02:54:25 +02:00
Ludovic Marie 43e8b54918 Server: track boats, minecarts, armor stands, frames and paintings to clients
A server sent its clients only mobs and dropped items. Boats, every kind of
minecart, armor stands, item frames, paintings and the entities Horizon keeps
without simulating are now tracked as ServerEntity does: the AddEntity data
(hanging entities at their block, with their direction), the synched data that
differs from the defaults, equipment, passengers (ClientboundSetPassengersPacket
at pairing and on change; a passenger syncs only its rotation and resyncs its
position when it dismounts), and the type's update interval and range.

Also vanilla-exact on the way, as the new harness found:
- mobs pair with their health (always non-default) and Mob flags (no AI, left-handed);
- /summon without NBT summons any type from an empty compound;
- armor stands move before gravity (LivingEntity.travelInAir), so a stand at rest
  keeps vanilla's -0.0784 vertical motion.

tools/test_server_entities_parity.py compares, from a vanilla-codec client, what
vanilla's dedicated server and Horizon's track for a scene of 20 entities.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 02:50:14 +02:00
Ludovic Marie 2c244f1888 Creaking hearts: scan only sections whose palette holds a heart
scan_for_hearts read all 4,096 blocks of every non-air section of each new
chunk on the server thread to find creaking hearts. A section whose palette
holds no heart state (PalettedContainer.maybeHas) cannot have one, so it is
skipped. Same block entities, same order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 02:48:45 +02:00
Ludovic Marie ce571f789c Merge pull request #786 from LookImEcho-Rick/codex/issue-780-open-mod-folder
🤖 Agent: merged LookImEcho-Rick's Open Mod Folder buttons (fixes #780).
2026-10-18 02:33:20 +02:00
LookImEcho-Rick 2faa99e5f1 Fix item tooltip display parity 2026-10-17 19:30:23 -05:00
Ludovic Marie 01f4c56dc1 Cull boats, paintings, item frames, armor stands, TNT and tridents like vanilla
These entities were drawn every frame wherever they were in the loaded
world: every armor stand, item frame and painting of every loaded village
or base went through its model, item and per-vertex occlusion test even
far behind the camera. EntityRenderer.shouldRender now decides, as for
mobs and minecarts:

- Entity.shouldRenderAtSqrDistance from the current position: 64 times the
  bounding box's mean edge times the entity distance option (boats about
  71 blocks, primed TNT 63, paintings by size); item frames 1024 blocks;
  armor stands 256 times the box's mean edge whatever the option (4 for a
  marker's empty box); tridents ten times the default (AbstractArrow);
  firework rockets 64 blocks.
- the interpolated culling box grown by 0.5 in the view; tridents grow it
  by 1.5 more (ThrownTridentRenderer), armor stands with a dragon head by
  0.5 (LivingEntityRenderer), item frames holding a map use the block-wide
  box.

The fishing bobber is unchanged: vanilla never frustum-culls it
(FishingHookRenderer.affectedByCulling) and Horizon only draws the
player's own, always within its 64 blocks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 02:04:30 +02:00
Ludovic Marie c78bf74744 Cave culling: search on a worker thread, frames never wait for it
The section occlusion search (SectionOcclusionGraph) ran on the render
thread whenever a section was meshed or the camera entered another
section: at render distance 32 that is a breadth-first walk over about
124,000 cells, and while exploring it ran nearly every frame.

As in vanilla 26.3, the full search now runs off the render thread. A
worker keeps its own copy of every section's face connectivity, fed the
changes with each job, and searches over dense arrays around the camera.
Frames use the last finished graph and never wait for the next. The search
starts at the top of the frame, as soon as the camera is known, so it
usually lands before the frame builds its visible list. A section meshed in
between propagates into the graph the frame has (vanilla's
runPartialUpdate), so a wall that opens shows what is behind it at once; a
section that closes goes at the next full search. A graph that never
reached the camera's section (after a teleport, say) is not used: until the
next one lands every section in the frustum is drawn.

The search itself is unchanged: the same box, steps and first-entry rule,
checked cell for cell against the previous code in a test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 02:04:21 +02:00
lazy-importer 3bb973efae fix(game): persist creative flight status across world save and reload (#777) 2026-10-18 01:57:22 +02:00
LookImEcho-Rick 1ffdb5f3f5 Add open mod folder buttons
Expose the Horizon mods directory from both the Classic and Horizon mods screens, creating it if needed before opening it.

Closes #780
2026-10-17 18:55:26 -05:00
Ludovic Marie 86d745853a Merge remote-tracking branch 'origin/main' into bm2/combined 2026-10-18 01:51:50 +02:00
Ludovic Marie e4f8154cb4 Merge pull request #783 from LookImEcho-Rick/codex/issue-730-horizon-scrollbar
🤖 Agent: merged LookImEcho-Rick's Horizon options scrollbar dragging (fixes #730).
2026-10-18 01:40:18 +02:00
rdbtCVS 68475af653 Startup stage 3d: make the menu interactive before world core loads (#712) 2026-10-18 00:35:17 +01:00
LookImEcho-Rick d33929c8fa Fix Horizon options scrollbar dragging 2026-10-17 18:22:40 -05:00
rdbtCVS 33c6578f5a Log whether the tail is ready when the live backdrop fades in 2026-10-18 00:14:51 +01:00
rdbtCVS 08532d6b1f Report the active tail phase while world entry waits 2026-10-18 00:14:51 +01:00
rdbtCVS a5edc14b97 Startup stage 3c: keep world entry responsive while joining resources (#712) 2026-10-18 00:14:50 +01:00
rdbtCVS 9004019800 light: pack the flood fill and precompute neighbour blocking
light_chunk's sky and block spreads read LightTables::cells for every
neighbour, and the fill and both spreads dominated lighting. Pack each
cell into two bytes (occlusion type and dampening) with a per-type
blocking mask, step neighbours by linear offset with an axis bounds
check, and precompute the per-column present table.

1156-column probe: 1.81 -> 1.31 ms/col (~28%). Vanilla light parity is
unchanged (1,179,648 sky/block values, 0 differences).
2026-10-18 00:12:51 +01:00
lazy-importer ecdff7ad2d fix(game): apply absorption effect attribute modifiers and health (#750) 2026-10-18 00:57:04 +02:00
lazy-importer 9779eb7271 fix(game): allow always-edible food when full and apply consume effects (#750) 2026-10-18 00:57:04 +02:00
rdbtCVS a3cf97f2fa Build the core renderer before starting audio 2026-10-17 23:50:46 +01:00
rdbtCVS d9686faf35 Startup stage 3b: publish world core before the simulation tail (#712) 2026-10-17 23:47:53 +01:00
Ludovic Marie 0eec25d14b Sculk: Fx hashing for the per-mob step and damage maps
entity_motion_events looked up each moving mob in a SipHash map every
tick. The keys are mob ids the server gives out, so the fast hasher is
safe there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 00:45:49 +02:00
rdbtCVS 42d65465a4 Startup stage 3a: split shared resources into core and rest (#712) 2026-10-17 23:39:11 +01:00
Ludovic Marie 5253e94262 Dedicated server: skip the client ticks of spawners, trial spawners and vaults
Their particles, ambient sounds and the turning display mob are for a
window. A dedicated or integrated server has none, yet made a display
mob for every spawner it ticked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 00:29:46 +02:00
Ludovic Marie 7de8c51f4e Block entity tickers: sweep the list only after a slot is freed
The list kept its slots for the whole tick; sweeping it every tick cost
two hash lookups per ticker. Now it is swept only when a slot was freed
or a block entity was taken out and not brought back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 00:29:46 +02:00
rdbtCVS 05ecd873d4 Startup: show the title before the world bundle finishes loading (#712) 2026-10-17 23:24:05 +01:00
rdbtCVS 5c55e7d855 Paletted container access: skip the storage revalidation a section already did
BlockSection::get and set check the section index and the state id once,
then read and write through new PackedStorage::read/write, which skip the
storage-level bounds and value checks and the Result that get/set keep for
external callers. A section index is below 4,096 and a palette id always
fits the width bits_for_palette chose; both methods debug_assert that
contract. Used for the hot read, the hot write and the growth re-encode.

Benchmark (ignored tests, best of alternating-order rounds, fast profile):
BlockSection::set 13.15 -> 9.12 ns/write (1.44x), get 2.33 -> 1.45 ns/read
(1.61x). See docs/performance/paletted-container-access-results.md.
2026-10-17 23:23:15 +01:00
Cosmic 594929b795 Validate LOD loading, shader depth and current terrain draw paths 2026-10-17 18:13:20 -04:00
lazy-importer e92f74f01d fix(minecarts): use per-kind display offset in cart geometry (#741) 2026-10-18 00:12:39 +02:00
Ludovic Marie ff94490992 Block entities: tick only those with a ticker, in vanilla's order
World::block_entities keeps vanilla's Level.blockEntityTickers beside the
map: a slot when a block entity whose state has a ticker is added, kept
when it is replaced, freed when it is removed, unloaded or its state loses
the ticker; a loaded chunk's in its block entity map's order. The tick
visits that list once, in block-ticking chunks within the world border,
instead of scanning the whole map once per kind.

New harness block_entity_tickers: real LevelChunks of a server level
against BlockEntities.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 00:08:44 +02:00
Cosmic 9ce739796e Merge remote-tracking branch 'origin/main' into feat/terrain-lod
# Conflicts:
#	crates/horizon-client/src/gfx.rs
#	crates/horizon-client/src/graphics.rs
2026-10-17 18:06:36 -04:00
Cosmic bae7975757 Add bounded hierarchical surface terrain LODs for distant views (#718) 2026-10-17 18:05:39 -04:00
Ludovic Marie cf63dcd39f Merge remote-tracking branch 'pr/724' into bm2/combined
# Conflicts:
#	crates/horizon-client/src/game/lan_actions.rs
#	tools/lan_e2e.py
2026-10-17 23:57:19 +02:00
Ludovic Marie 40e9e9660b Merge remote-tracking branch 'pr/727' into bm2/combined
# Conflicts:
#	crates/horizon-client/src/game/agent.rs
#	tools/lan_e2e.py
2026-10-17 23:55:19 +02:00
Ludovic Marie e74d5207dc Merge remote-tracking branch 'pr/726' into bm2/combined
# Conflicts:
#	crates/horizon-client/src/game/remote.rs
#	tools/lan_e2e.py
2026-10-17 23:54:59 +02:00
Ludovic Marie 9bb22caa22 Merge remote-tracking branch 'pr/725' into bm2/combined
# Conflicts:
#	tools/lan_e2e.py
2026-10-17 23:54:22 +02:00
Ludovic Marie 6f5a3319ee Merge commit '123e8286ac55894a0e9f61c78b3844fd46241e2a' into bm2/combined
# Conflicts:
#	crates/horizon-client/src/game/remote.rs
#	tools/lan_e2e.py
2026-10-17 23:54:21 +02:00
Ludovic Marie a72e2a2f0e Merge commit '69dd4feb316616eef6255a4f41dc3b680a6a43e6' into bm2/combined 2026-10-17 23:52:39 +02:00
Ludovic Marie af3e75fece Merge pull request #740 from rdbtCVS/t3code/08bad3fd
🤖 Agent: merged by Ludovic's AI agent. CI parity passed (harness paths stay synchronous). Smoke test of the new path on current main (macOS, --offscreen, normal launch): resources loaded on the worker in 9.3 s, renderer swapped, title screen up and running for 60 s, no panic. Thanks @rdbtCVS!
2026-10-17 23:52:27 +02:00
Ludovic Marie 5f5781b17e Merge pull request #745 from rdbtCVS/perf/worker-headroom
🤖 Agent: merged by Ludovic's AI agent. Measured by perf-ticks-6 (comment above): ThinkPad 4 threads RD12 1% low 17→29 FPS (31→40 with --server-thread), FPS up everywhere; in-frame spawn load ~15% slower (32.5→37.2 s); Mac 14 threads within noise. Thanks @rdbtCVS!
2026-10-17 23:44:17 +02:00
rdbtCVS 56a251eb13 Paletted container access: one palette probe per write, dispatched unpack
BlockSection::set resolved the old cell through get and then probed the
section palette three times per non-trivial write: keying the old state by
id, testing the incoming state and finding it. The slot at the written index
already is the old state's id, so read it straight from storage and resolve
only the incoming state, with a single map probe. Palette reuse, free slots
and growth are unchanged, so palette, counts, free list and NBT are identical.

PalettedContainer::unpack and unpack_u16 matched the palette variant inside
the per-cell loop; dispatch Single/List/Global once before it.

Measured against copies of the pre-optimization code (ignored tests):
BlockSection::set 12.73 -> 11.37 ns/write (1.12x), unpack list 1.956 ->
1.860 us/call (1.05x), global 2.255 -> 2.172 (1.04x). See
docs/performance/paletted-container-access-results.md.

set_matches_baseline_under_random_edits drives both implementations over the
same 50k-edit streams for 1/2/16/17/24/64 distinct states, with periodic
whole-section collapses, and asserts equal results, bits, palette, counts,
free list and NBT.
2026-10-17 22:38:35 +01:00
Ludovic Marie 9afb6d76de Carry: structure mods' worldgen in vanilla's types, with the loader's biome tags
Structure mods build on libraries whose structure, placement and pool element
types are vanilla's with extra rules: Lithostitched's, Moog's Structure Lib's
and Repurposed Structures' jigsaw structures, their advanced random spreads,
versioned and ocean-bottom single pool elements. Carry rewrites them as
vanilla's types; the extra rules (no start in liquid, a minimum distance from
the origin) are lost, so a structure may start where the mod would not. Types
with no vanilla counterpart (YUNG's, Formations', the nether variants) are left
as they are and counted in the carry report.

The structures' biomes name the loader's convention tags (#c:is_plains). fetch
now also gets the pack's NeoForge jar from NeoForge's Maven repository, checked
against its SHA-1, and carry copies the convention biome tags each mod's
structures use, with those they include, into the mod.

ATM10's 42 carried mods: 1,061 files rewritten, 103 convention biome tags.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 23:32:48 +02:00
Ludovic Marie d3673b1509 Carry: write the self-drop loot table a mod registers in code
Chipped registers its blocks' loot in code: its jar ships 7 loot tables for
about 7,000 blocks, so carried over they dropped nothing, while in the NeoForge
oracle every one drops itself. When a declared block has no loot table in the
jar and the oracle shows vanilla's dropSelf (one of itself with every tool,
nothing only where the state needs a tool it did not get), carry writes that
table in 26.3's shape. When only the states with one property value drop it
and the rest drop nothing (a door's lower half), the entry gets vanilla's
match_block condition on that value, as createDoorTable writes. Chipped:
6,843 tables added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 23:32:35 +02:00
rdbtCVS c4cc7954ce Portal scans: keep per-chunk section masks across ticks
The nether-portal section precheck from #661 answered "does this section's
palette hold a portal?" per section, per tick. Keep the answer per resident
chunk in `portal_sections`, keyed by a weak handle: an edit or a chunk
replacement rebuilds it, and it is dropped when a chunk unloads and cleared
when the block facts change, so a portal block always forces the sweep. The
entity sweep now finds portal blocks without the per-tick map.

This is a scan microbenchmark, not a whole-game claim: steady improves 2.4x
to 17x over the fixtures and the run parity-checks the cached and per-tick
answers. Rescanning every chunk every tick (cold, reload, edit_all) is slower
because a miss reads all 24 sections of a chunk; see
docs/portal-scan-benchmark.md.
2026-10-17 22:29:59 +01:00
Ludovic Marie a2f8952d05 Compression: flate2's zlib-rs backend instead of miniz_oxide
Halves the CPU of deflating a chunk column and makes small packets about
20 % cheaper. The compressed bytes change; what they inflate to doesn't.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 23:18:12 +02:00
rdbtCVS e25672ed4f Startup: split block assets into block data and render assets (#712) 2026-10-17 22:16:45 +01:00