[PR #2989] [MERGED] Save format: world border in the overworld data folder, level.dat_old and player file recovery, map markers, previous game mode, unlimited NBT size #4740

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2989
Author: @kacpherek
Created: 10/27/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @ludovic111

Base: main ← Head: fix/save-format-parity


📝 Commits (7)

  • 3392146 Save the world border in the overworld's data folder
  • 8f26771 Fall back to level.dat_old and keep an unreadable level.dat
  • 8ba3057 Back up an unreadable player file and fall back to its .dat_old
  • f351bcb Keep a map's banner and frame markers when it is saved
  • 382cc39 Save and restore previousPlayerGameType
  • 11b36e3 Read and write saved NBT without the node cap
  • 632179b Format

📊 Changes

7 files changed (+127 additions, -31 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+2 -0)
📝 crates/horizon-client/src/game/cartography.rs (+2 -1)
📝 crates/horizon-client/src/game/game_mode.rs (+18 -13)
📝 crates/horizon-client/src/game/maps.rs (+14 -2)
📝 crates/horizon-client/src/game/scoreboard.rs (+11 -2)
📝 crates/horizon-client/src/save.rs (+68 -13)
📝 crates/horizon-world/src/nbt.rs (+12 -0)

📄 Description

What and why

  • The world border was saved at the world root, where vanilla never looks. It now goes to dimensions/minecraft/overworld/data/minecraft/world_border.dat. The old root file is still read when the new one is missing.
  • A level.dat that could not be read was treated as a new world and overwritten. Now level.dat_old is read instead, and the bad file is kept as level.dat_corrupted_<time> while the old one takes its place.
  • A player file that could not be read was written over with no copy. Now it is copied to <uuid>_corrupted_<time>.dat and <uuid>.dat_old is loaded.
  • Maps wrote empty banners and frames lists, so a vanilla map lost its markers on the first save. They are kept as read, and a locked copy keeps the banner markers. Horizon still does not draw or track banner markers itself.
  • previousPlayerGameType was never written, so the F3+F4 switcher's return mode was lost. It is saved and restored.
  • Chunks, entities, POI and .dat files were capped at 1M NBT nodes. Vanilla reads them with unlimitedHeap, so such a chunk loads there but not here. The cap is gone; the 1 GiB byte limit stays.

Vanilla reference

  • ServerLevel.java:1592 and LevelDatToSavedDataFileFix.java:64-72: border saved data per dimension.
  • LevelStorageSource.java:431-436, 744-748: level.dat_old, level.dat_corrupted_<time>, restoreLevelDataFromOld.
  • PlayerDataStorage.java:53-54, 76-84: copy to _corrupted_<time>, fall back to .dat_old.
  • MapBanner.java:15-20, MapFrame.java:7-12, MapItemSavedData.java:139-148 (locked).
  • ServerPlayer.java:423, 2263-2265: playerGameType and previousPlayerGameType.
  • NbtIo.java:95-108: NbtAccounter.unlimitedHeap().

Not in this PR

  • Per-dimension borders in play: Horizon keeps one border for all dimensions, so only the overworld file is read and written.
  • InhabitedTime and LastUpdate: already saved on main (attach_save_data).
  • Border warning_time default: vanilla's saved default is also 300 (Settings.DEFAULT), so there is no gap.
  • Staged file fixes, structure template datafix, DataPacks feature flags, dragon_uuid, fix_4899: skipped.

Self-check

clippy and fmt pass for horizon-client and horizon-world. Not run in game.


🔄 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/2989 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/save-format-parity` --- ### 📝 Commits (7) - [`3392146`](https://github.com/horizon-rust/horizon/commit/33921460ccd56cf161311798a706a4a28981a617) Save the world border in the overworld's data folder - [`8f26771`](https://github.com/horizon-rust/horizon/commit/8f2677105330b06ad8e0711ca712294d436d8161) Fall back to level.dat_old and keep an unreadable level.dat - [`8ba3057`](https://github.com/horizon-rust/horizon/commit/8ba30576d14f174976a26303cd17e0749c7ad223) Back up an unreadable player file and fall back to its .dat_old - [`f351bcb`](https://github.com/horizon-rust/horizon/commit/f351bcb06ba7ceffb8067b7206051994f8b5a2ad) Keep a map's banner and frame markers when it is saved - [`382cc39`](https://github.com/horizon-rust/horizon/commit/382cc39713a875d38062b4e5e2603a0259bc0f8c) Save and restore previousPlayerGameType - [`11b36e3`](https://github.com/horizon-rust/horizon/commit/11b36e38671f8f3fd22704b586c9402f1bd1fa23) Read and write saved NBT without the node cap - [`632179b`](https://github.com/horizon-rust/horizon/commit/632179bda63a742f08172fe73b657526a31bf28d) Format ### 📊 Changes **7 files changed** (+127 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+2 -0) 📝 `crates/horizon-client/src/game/cartography.rs` (+2 -1) 📝 `crates/horizon-client/src/game/game_mode.rs` (+18 -13) 📝 `crates/horizon-client/src/game/maps.rs` (+14 -2) 📝 `crates/horizon-client/src/game/scoreboard.rs` (+11 -2) 📝 `crates/horizon-client/src/save.rs` (+68 -13) 📝 `crates/horizon-world/src/nbt.rs` (+12 -0) </details> ### 📄 Description ## What and why - The world border was saved at the world root, where vanilla never looks. It now goes to `dimensions/minecraft/overworld/data/minecraft/world_border.dat`. The old root file is still read when the new one is missing. - A `level.dat` that could not be read was treated as a new world and overwritten. Now `level.dat_old` is read instead, and the bad file is kept as `level.dat_corrupted_<time>` while the old one takes its place. - A player file that could not be read was written over with no copy. Now it is copied to `<uuid>_corrupted_<time>.dat` and `<uuid>.dat_old` is loaded. - Maps wrote empty `banners` and `frames` lists, so a vanilla map lost its markers on the first save. They are kept as read, and a locked copy keeps the banner markers. Horizon still does not draw or track banner markers itself. - `previousPlayerGameType` was never written, so the F3+F4 switcher's return mode was lost. It is saved and restored. - Chunks, entities, POI and `.dat` files were capped at 1M NBT nodes. Vanilla reads them with `unlimitedHeap`, so such a chunk loads there but not here. The cap is gone; the 1 GiB byte limit stays. ## Vanilla reference - `ServerLevel.java:1592` and `LevelDatToSavedDataFileFix.java:64-72`: border saved data per dimension. - `LevelStorageSource.java:431-436, 744-748`: `level.dat_old`, `level.dat_corrupted_<time>`, `restoreLevelDataFromOld`. - `PlayerDataStorage.java:53-54, 76-84`: copy to `_corrupted_<time>`, fall back to `.dat_old`. - `MapBanner.java:15-20`, `MapFrame.java:7-12`, `MapItemSavedData.java:139-148` (`locked`). - `ServerPlayer.java:423, 2263-2265`: `playerGameType` and `previousPlayerGameType`. - `NbtIo.java:95-108`: `NbtAccounter.unlimitedHeap()`. ## Not in this PR - Per-dimension borders in play: Horizon keeps one border for all dimensions, so only the overworld file is read and written. - `InhabitedTime` and `LastUpdate`: already saved on main (`attach_save_data`). - Border `warning_time` default: vanilla's saved default is also 300 (`Settings.DEFAULT`), so there is no gap. - Staged file fixes, structure template datafix, `DataPacks` feature flags, `dragon_uuid`, `fix_4899`: skipped. ## Self-check clippy and fmt pass for horizon-client and horizon-world. Not run in game. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:07:36 +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#4740
No description provided.