Datafix: every server fix ported; saves without a DataVersion upgrade from -1
This commit is contained in:
@@ -121,10 +121,9 @@ pub fn upgrade_older_world(world: &Path) -> Result<()> {
|
||||
let Some(root) = read_dat(&world.join("level.dat")) else {
|
||||
return Ok(());
|
||||
};
|
||||
let version = root
|
||||
.get("Data")
|
||||
.and_then(|d| number(d.get("DataVersion")))
|
||||
.unwrap_or(i64::from(DATA_VERSION));
|
||||
let version = root.get("Data").map_or(i64::from(DATA_VERSION), |d| {
|
||||
number(d.get("DataVersion")).unwrap_or(-1) // saves of 1.8 and before have none
|
||||
});
|
||||
if version >= i64::from(DATA_VERSION) {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
//! Vanilla's DataFixers from the 1.19 schemas on (`net.minecraft.util.datafix`):
|
||||
//! the data of worlds saved by 1.18.2 to 26.2 brought to the 26.3 format exactly
|
||||
//! Vanilla's DataFixers (`net.minecraft.util.datafix`, DataVersion 99 on):
|
||||
//! the data of worlds saved by 1.8 to 26.2 brought to the 26.3 format exactly
|
||||
//! as 26.3 does when it reads them, and the file fixes it runs when it opens
|
||||
//! such a world (`net.minecraft.util.filefix`).
|
||||
//!
|
||||
//! DataFixerUpper reads the data once with the schema of its version (running
|
||||
//! the schema's read hooks), applies every fix with a key above that version
|
||||
//! in order, and writes it with the current schema. Each fix finds its values
|
||||
//! with the schema just below its own key ([`schema`]). Data older than
|
||||
//! [`OLDEST_SUPPORTED`] needs fixes that are not ported. The fixes of client
|
||||
//! with the schema just below its own key ([`schema`]). Every
|
||||
//! fix of the server data is ported ([`OLDEST_SUPPORTED`]). The fixes of client
|
||||
//! files (options, hotbars, debug profiles) are not ported either.
|
||||
mod block_state_data;
|
||||
mod chunk_flatten;
|
||||
@@ -34,9 +34,9 @@ use schema::{Key, Ty, key, walk};
|
||||
|
||||
/// The DataVersion of the game.
|
||||
pub const CURRENT: i32 = crate::DATA_VERSION;
|
||||
/// Data saved before this DataVersion (1.17 is 2724) needs fixes that are not
|
||||
/// ported (2717 and everything before).
|
||||
pub const OLDEST_SUPPORTED: i32 = 2571;
|
||||
/// Data saved before this DataVersion needs fixes that are not ported. Every
|
||||
/// server fix is, down to the saves of 1.8, which have no DataVersion (read as -1).
|
||||
pub const OLDEST_SUPPORTED: i32 = -1;
|
||||
|
||||
/// `Identifier.tryParse` validity, as `NamespacedSchema.ensureNamespaced` uses it.
|
||||
pub fn identifier(id: &str) -> Option<(String, String)> {
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ The registry loader checks data version, duplicate states, default IDs and
|
||||
block-name coverage. The local oracle exports all 35,723 state identities and
|
||||
defaults from vanilla. This imports identities, not block implementations,
|
||||
shapes or behavior. Registry exports and game-derived fixtures stay in `.local/`.
|
||||
Chunk access requires data version 5023. A world saved by an older version is upgraded when it is opened, as 26.3 does: the file fixes (`FileFixerUpper`) and level.dat, then vanilla's DataFixers over every chunk, entity chunk, POI chunk, player, saved data, advancements and statistics file (`horizon_world::datafix`; vanilla upgrades each file as it reads it, Horizon all of them on opening). `tools/test_datafix_parity.py` compares the result with vanilla's own upgrade over worlds written by older server jars. Worlds older than the ported fixes are refused with a message pointing at `tools/upgrade_world.py`, which runs vanilla's `--forceUpgrade` on a copy. `BlockRegistry::resolve` rejects invalid property descriptors. The separate
|
||||
Chunk access requires data version 5023. A world saved by an older version is upgraded when it is opened, as 26.3 does: the file fixes (`FileFixerUpper`) and level.dat, then vanilla's DataFixers over every chunk, entity chunk, POI chunk, player, saved data, advancements and statistics file (`horizon_world::datafix`; vanilla upgrades each file as it reads it, Horizon all of them on opening). `tools/test_datafix_parity.py` compares the result with vanilla's own upgrade over worlds written by older server jars. Every server data fix is ported, from the saves of 1.8 (no DataVersion) on; only the fixes of client files (options, hotbars) are not. `BlockRegistry::resolve` rejects invalid property descriptors. The separate
|
||||
[block-state JSON codec](block-state-codecs.md) reproduces vanilla property
|
||||
fallback for compact and full JSON forms.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user