[PR #232] [MERGED] Explorer, treasure and abandoned camp maps work (#147) #2423

Closed
opened 2026-11-02 15:55:58 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/232
Author: @ludovic111
Created: 10/14/2026
Status: ✅ Merged
Merged: 10/14/2026
Merged by: @ludovic111

Base: main ← Head: fix/explorer-maps-147


📝 Commits (1)

  • 2ce2ddc Explorer, treasure and abandoned camp maps work (#147)

📊 Changes

11 files changed (+572 additions, -44 deletions)

View changed files

📝 crates/horizon-client/examples/entity_death_loot_fixture.rs (+1 -0)
📝 crates/horizon-client/src/game.rs (+6 -0)
📝 crates/horizon-client/src/game/creatures.rs (+1 -0)
📝 crates/horizon-client/src/game/maps.rs (+351 -6)
📝 crates/horizon-client/src/game/trading.rs (+1 -1)
📝 crates/horizon-client/src/merchant.rs (+2 -21)
📝 crates/horizon-client/src/mobs/drops.rs (+1 -0)
📝 crates/horizon-client/src/structure_blocks.rs (+138 -14)
📝 crates/horizon-client/src/vanillagen.rs (+7 -0)
📝 crates/horizon-world/src/loot.rs (+44 -2)
📝 crates/horizon-world/src/worldgen/generator.rs (+20 -0)

📄 Description

Fixes #147

Root cause. Four separate gaps.

  1. In 26.3 every explorer map is its own MapItem (buried_treasure_map, abandoned_camp_map, woodland_mansion_map, trial_chambers maps and others), and vanilla treats any stack with map_id as a map (has(DataComponents.MAP_ID) in the hand renderer, item frames and the cartography table). Horizon's map_id() only accepted filled_map.
  2. Trades replaced the map item with filled_map.
  3. tick_maps cleared every decoration each tick and re-added only the player marker, so the item's minecraft:map_decorations target (the red X, mansion, camp…) was never drawn. Vanilla re-adds them in MapItemSavedData.tickCarriedBy.
  4. Chest loot is rolled when the chunk generates, and exploration_map there only flagged the map as found. Shipwreck and underwater-ruin treasure maps, and the maps in 26.3's abandoned-camp chests, had no map id, no target and no picture.

Fix.

  • map_id: accepts any stack with the component.
  • Target decorations: read from the item's map_decorations and placed as addDecoration does: clampMapCoordinate, shown off the map only when tracking is unlimited, rotation from calculateRotation (spinning in the Nether). The MapDecorationTypes → sprite table includes 26.3's abandoned_camp.
  • render_biome_preview (MapItem.renderBiomePreviewMap): biomes at sea level for every map pixel, through the world's biome zoom (BiomeManager) and a new generator query, noise_biomes (BiomeSource.getNoiseBiome, so chunks don't need to be generated), with #water_on_map_outlines. It draws the orange/brown water outline and the striped open water with vanilla's thresholds and Mth.sin.
  • Chest loot: LootStack.exploration carries the function's settings, with the codec defaults. The generated item keeps the search in minecraft:custom_data (vanilla loads it as it is). Opening the chest runs ExplorationMapFunction from the chest's position; vanilla runs it when the chest's loot is unpacked on first open. If the item reaches the inventory some other way (a hopper), it runs from the player. When no structure is in range the item is dropped, as the tables' filtered map_id check does.
  • Trades keep the trade's map item and get the biome preview too.

Evidence.

  • Unit tests: the custom_data round trip (other custom data is kept, and the component is removed when the search was its only entry); every target decoration type → sprite; reading decorations back and the rotation (calculateRotation(180) = 8); clampMapCoordinate.
  • In game on a vscreen, seed 12345:
    • A shipwreck's map chest (paper and feathers) has no treasure map, because the nearest buried treasure is 1036 blocks away, beyond the 50-chunk search. Vanilla discards that map too.
    • A pending treasure map near a treasure becomes buried_treasure_map with map_id and a "+" red_x decoration at the /locate position. Held in hand it shows the vanilla picture: striped orange ocean, brown coastline, red X and player marker (agent-state/wave6a-shots/treasure-map-147.png).
  • Mac mini: fmt and workspace clippy -D warnings are clean; the new tests pass.

Not here: /place structure fails in Horizon ("An unexpected error occurred"), so a shipwreck can't be placed on demand. That's a separate gap.

🤖 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/232 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/14/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/explorer-maps-147` --- ### 📝 Commits (1) - [`2ce2ddc`](https://github.com/horizon-rust/horizon/commit/2ce2ddcd4dd9b0cd0b429e5133c98fa6eb056901) Explorer, treasure and abandoned camp maps work (#147) ### 📊 Changes **11 files changed** (+572 additions, -44 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/entity_death_loot_fixture.rs` (+1 -0) 📝 `crates/horizon-client/src/game.rs` (+6 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+1 -0) 📝 `crates/horizon-client/src/game/maps.rs` (+351 -6) 📝 `crates/horizon-client/src/game/trading.rs` (+1 -1) 📝 `crates/horizon-client/src/merchant.rs` (+2 -21) 📝 `crates/horizon-client/src/mobs/drops.rs` (+1 -0) 📝 `crates/horizon-client/src/structure_blocks.rs` (+138 -14) 📝 `crates/horizon-client/src/vanillagen.rs` (+7 -0) 📝 `crates/horizon-world/src/loot.rs` (+44 -2) 📝 `crates/horizon-world/src/worldgen/generator.rs` (+20 -0) </details> ### 📄 Description Fixes #147 **Root cause.** Four separate gaps. 1. In 26.3 every explorer map is its own `MapItem` (`buried_treasure_map`, `abandoned_camp_map`, `woodland_mansion_map`, `trial_chambers` maps and others), and vanilla treats any stack with `map_id` as a map (`has(DataComponents.MAP_ID)` in the hand renderer, item frames and the cartography table). Horizon's `map_id()` only accepted `filled_map`. 2. Trades replaced the map item with `filled_map`. 3. `tick_maps` cleared every decoration each tick and re-added only the player marker, so the item's `minecraft:map_decorations` target (the red X, mansion, camp…) was never drawn. Vanilla re-adds them in `MapItemSavedData.tickCarriedBy`. 4. Chest loot is rolled when the chunk generates, and `exploration_map` there only flagged the map as found. Shipwreck and underwater-ruin treasure maps, and the maps in 26.3's abandoned-camp chests, had no map id, no target and no picture. **Fix.** - `map_id`: accepts any stack with the component. - Target decorations: read from the item's `map_decorations` and placed as `addDecoration` does: `clampMapCoordinate`, shown off the map only when tracking is unlimited, rotation from `calculateRotation` (spinning in the Nether). The `MapDecorationTypes` → sprite table includes 26.3's `abandoned_camp`. - `render_biome_preview` (`MapItem.renderBiomePreviewMap`): biomes at sea level for every map pixel, through the world's biome zoom (`BiomeManager`) and a new generator query, `noise_biomes` (`BiomeSource.getNoiseBiome`, so chunks don't need to be generated), with `#water_on_map_outlines`. It draws the orange/brown water outline and the striped open water with vanilla's thresholds and `Mth.sin`. - Chest loot: `LootStack.exploration` carries the function's settings, with the codec defaults. The generated item keeps the search in `minecraft:custom_data` (vanilla loads it as it is). Opening the chest runs `ExplorationMapFunction` from the chest's position; vanilla runs it when the chest's loot is unpacked on first open. If the item reaches the inventory some other way (a hopper), it runs from the player. When no structure is in range the item is dropped, as the tables' `filtered` map_id check does. - Trades keep the trade's map item and get the biome preview too. **Evidence.** - Unit tests: the custom_data round trip (other custom data is kept, and the component is removed when the search was its only entry); every target decoration type → sprite; reading decorations back and the rotation (`calculateRotation(180)` = 8); `clampMapCoordinate`. - In game on a vscreen, seed 12345: - A shipwreck's map chest (paper and feathers) has no treasure map, because the nearest buried treasure is 1036 blocks away, beyond the 50-chunk search. Vanilla discards that map too. - A pending treasure map near a treasure becomes `buried_treasure_map` with `map_id` and a `"+"` red_x decoration at the `/locate` position. Held in hand it shows the vanilla picture: striped orange ocean, brown coastline, red X and player marker (`agent-state/wave6a-shots/treasure-map-147.png`). - Mac mini: fmt and workspace `clippy -D warnings` are clean; the new tests pass. Not here: `/place structure` fails in Horizon ("An unexpected error occurred"), so a shipwreck can't be placed on demand. That's a separate gap. 🤖 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-02 15:55:58 +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#2423
No description provided.