[PR #4380] [MERGED] Exploration maps skip the structures a map already pointed at #5593

Closed
opened 2026-11-03 05:13:38 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4380
Author: @xFedeT
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @rdbtCVS

Base: main ← Head: fix/explorer-map-references


📝 Commits (5)

  • bc92841 Exploration maps skip the structures a map already pointed at
  • d06b7d7 Merge origin/main into fix/explorer-map-references
  • e40a53d Map references: write the file beside it and rename over it
  • 0161c4d Merge remote-tracking branch 'origin/main' into fix/explorer-map-references
  • ffb0e28 Exploration maps count the references a chunk saved for its starts

📊 Changes

10 files changed (+289 additions, -15 deletions)

View changed files

📝 crates/horizon-client/src/game/maps.rs (+3 -1)
📝 crates/horizon-client/src/game/trading.rs (+3 -1)
📝 crates/horizon-client/src/game/world_loading.rs (+10 -0)
📝 crates/horizon-client/src/mod_content_tests.rs (+96 -0)
📝 crates/horizon-client/src/save.rs (+18 -0)
📝 crates/horizon-client/src/vanillagen.rs (+90 -0)
📝 crates/horizon-world/src/worldgen/generator.rs (+17 -1)
📝 crates/horizon-world/src/worldgen/generator_structures.rs (+10 -8)
📝 tools/lan_e2e.py (+38 -0)
📝 tools/port_map/classes-07.tsv (+4 -4)

📄 Description

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

Refs #3517

What and why

In vanilla an exploration map with skip_existing_chunks (the default, and what every cartographer trade uses) is made by ChunkGenerator.findNearestMapStructure(..., createReference = true). For each start it finds, StructureCheck.checkStart ignores one that is already referenced (requireUnreferenced), and the start it picks gets addReference (getMaxReferences is 1). So two maps made one after the other never lead to the same structure.

Horizon ignored all of this: locate always returned the nearest start, so every map made from the same place pointed at the same structure.

Now VanillaTerrain::locate_for_map does it: with skip_existing_chunks it searches past starts a map already pointed at (locate_skipping takes a skip predicate; the ring search for strongholds-style placements also goes on to the next ring chunk) and marks the one it finds. Without it (skip_existing_chunks: false, as the shipwreck/ruin chests have it) and for /locate nothing changes. The two callers, a map from a loot container (resolve_pending_map) and a cartographer trade (exploration_map), pass the flag.

One difference from vanilla, on purpose: vanilla keeps the count in each start's chunk (references in the chunk file), and a start nobody visited has no chunk file here, so the pointed-at starts are kept in data/horizon_structure_references_<dimension>.json and survive reopening the world. Saved chunks still write references: 0.

Proof

python3 tools/lan_e2e.py --server-thread --check explorer_map: three cartographers with a map trade are summoned and opened one after the other. Each one adds exactly one new start ([1, 2, 3]), so no start is pointed at twice; the check prints the starts they point at: woodland mansions at chunks (-305, 108) and (93, 516) first, then a third one. The trade screen of the first one:

cartographer trades

Before this change the three maps would point at the same mansion (locate returns the same start every time). The content-root test exploration_maps_skip_the_structures_maps_pointed_at pins that: /locate keeps returning the nearest, the first map takes it, the second takes another, a map without skipping still takes the nearest, and a reopened world (new VanillaTerrain, same file) takes a third.

pr_ready --quick: fmt, clippy, 1254 tests, 480 python tests and the 6 content-root tests pass; parity harnesses left to CI.

Rows updated: StructureCheck.checkStart, checkStructureInfo, incrementReference (inline, with the sidecar noted). onStructureLoad is inline too (VanillaTerrain::set_saved_references): the references a chunk saved for its starts count as known, read from the region file by SaveDir::start_references; the references maps add here stay in the sidecar file.

🤖 Generated with Claude Code


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

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/4380 **Author:** [@xFedeT](https://github.com/xFedeT) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/explorer-map-references` --- ### 📝 Commits (5) - [`bc92841`](https://github.com/horizon-rust/horizon/commit/bc92841fe68d0b43fe3b6f9f1747b01a969c4b9f) Exploration maps skip the structures a map already pointed at - [`d06b7d7`](https://github.com/horizon-rust/horizon/commit/d06b7d7fe3f39b641d234347d54e609ac5094275) Merge origin/main into fix/explorer-map-references - [`e40a53d`](https://github.com/horizon-rust/horizon/commit/e40a53d871581d19d918a05b9e36fbb9106289f3) Map references: write the file beside it and rename over it - [`0161c4d`](https://github.com/horizon-rust/horizon/commit/0161c4d30ba010dc5e16a451ea2af86655870e86) Merge remote-tracking branch 'origin/main' into fix/explorer-map-references - [`ffb0e28`](https://github.com/horizon-rust/horizon/commit/ffb0e280b352796797d68d436bc27074a9760e82) Exploration maps count the references a chunk saved for its starts ### 📊 Changes **10 files changed** (+289 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/maps.rs` (+3 -1) 📝 `crates/horizon-client/src/game/trading.rs` (+3 -1) 📝 `crates/horizon-client/src/game/world_loading.rs` (+10 -0) 📝 `crates/horizon-client/src/mod_content_tests.rs` (+96 -0) 📝 `crates/horizon-client/src/save.rs` (+18 -0) 📝 `crates/horizon-client/src/vanillagen.rs` (+90 -0) 📝 `crates/horizon-world/src/worldgen/generator.rs` (+17 -1) 📝 `crates/horizon-world/src/worldgen/generator_structures.rs` (+10 -8) 📝 `tools/lan_e2e.py` (+38 -0) 📝 `tools/port_map/classes-07.tsv` (+4 -4) </details> ### 📄 Description > 🤖 Opened by xFedeT's AI agent (Claude Code, Claude Sonnet 5.5), not by xFedeT personally. Refs #3517 ## What and why In vanilla an exploration map with `skip_existing_chunks` (the default, and what every cartographer trade uses) is made by `ChunkGenerator.findNearestMapStructure(..., createReference = true)`. For each start it finds, `StructureCheck.checkStart` ignores one that is already referenced (`requireUnreferenced`), and the start it picks gets `addReference` (`getMaxReferences` is 1). So two maps made one after the other never lead to the same structure. Horizon ignored all of this: `locate` always returned the nearest start, so every map made from the same place pointed at the same structure. Now `VanillaTerrain::locate_for_map` does it: with `skip_existing_chunks` it searches past starts a map already pointed at (`locate_skipping` takes a skip predicate; the ring search for strongholds-style placements also goes on to the next ring chunk) and marks the one it finds. Without it (`skip_existing_chunks: false`, as the shipwreck/ruin chests have it) and for `/locate` nothing changes. The two callers, a map from a loot container (`resolve_pending_map`) and a cartographer trade (`exploration_map`), pass the flag. One difference from vanilla, on purpose: vanilla keeps the count in each start's chunk (`references` in the chunk file), and a start nobody visited has no chunk file here, so the pointed-at starts are kept in `data/horizon_structure_references_<dimension>.json` and survive reopening the world. Saved chunks still write `references: 0`. ## Proof `python3 tools/lan_e2e.py --server-thread --check explorer_map`: three cartographers with a map trade are summoned and opened one after the other. Each one adds exactly one new start (`[1, 2, 3]`), so no start is pointed at twice; the check prints the starts they point at: woodland mansions at chunks (-305, 108) and (93, 516) first, then a third one. The trade screen of the first one: ![cartographer trades](https://raw.githubusercontent.com/xFedeT/horizon/pr-screenshots/explorer-map/cartographer-trades.png) Before this change the three maps would point at the same mansion (`locate` returns the same start every time). The content-root test `exploration_maps_skip_the_structures_maps_pointed_at` pins that: `/locate` keeps returning the nearest, the first map takes it, the second takes another, a map without skipping still takes the nearest, and a reopened world (new `VanillaTerrain`, same file) takes a third. `pr_ready --quick`: fmt, clippy, 1254 tests, 480 python tests and the 6 content-root tests pass; parity harnesses left to CI. Rows updated: `StructureCheck.checkStart`, `checkStructureInfo`, `incrementReference` (inline, with the sidecar noted). `onStructureLoad` is inline too (`VanillaTerrain::set_saved_references`): the references a chunk saved for its starts count as known, read from the region file by `SaveDir::start_references`; the references maps add here stay in the sidecar file. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:13:38 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

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