Refuse only worlds older than 1.17 in the save upgrade test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-12 17:58:34 +02:00
parent 6402d44ce7
commit f88b1da965
+4 -4
View File
@@ -116,7 +116,7 @@ impl SessionLock {
/// (`FileFixerUpper`), then the DataFixers upgrades of every chunk, entity chunk,
/// POI chunk, player, saved data, advancements and statistics file. Vanilla runs
/// the latter as it reads each file; Horizon runs them all on opening, which reads
/// the same data. Worlds older than the ported fixes (1.18.2) are refused.
/// the same data. Worlds older than the ported fixes (1.17) are refused.
pub fn upgrade_older_world(world: &Path) -> Result<()> {
let Some(root) = read_dat(&world.join("level.dat")) else {
return Ok(());
@@ -2217,10 +2217,10 @@ mod tests {
super::read_dat(&dir.join("level.dat"))
.and_then(|r| super::number(r.get("Data")?.get("DataVersion")))
};
// 1.18, older than the ported fixes: refused, left as it is.
super::write_dat(&dir.join("level.dat"), level(2860)).unwrap();
// 1.16.5, older than the ported fixes: refused, left as it is.
super::write_dat(&dir.join("level.dat"), level(2586)).unwrap();
assert!(super::upgrade_older_world(&dir).is_err());
assert_eq!(version(&dir), Some(2860));
assert_eq!(version(&dir), Some(2586));
// 1.21.1: upgraded to the current version.
super::write_dat(&dir.join("level.dat"), level(3955)).unwrap();
super::upgrade_older_world(&dir).unwrap();