Expand voxel gameplay, lighting, full-height streaming and world imports
MVP checks / mvp (push) Canceled after 0s
MVP checks / mvp (push) Canceled after 0s
Add shared Rust/WASM physics, worker meshing and diagnostics, 64-chunk full-height streaming, atlas texture support, and baseline world import. Document the current implementation and include the supplied in-game lobby screenshot.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use shacraft_compat::{
|
||||
Mode, export_anvil, export_schem, import_anvil, import_schem,
|
||||
Mode, export_anvil, export_schem, import_anvil, import_anvil_baseline, import_schem,
|
||||
nbt::{self, Tag},
|
||||
};
|
||||
use shacraft_core::{BlockChange, WorldStore};
|
||||
@@ -151,6 +151,56 @@ fn genuine_java_world_import_exact_roundtrip_edit_and_new_chunk() {
|
||||
assert_eq!(store.registry()[id as usize], "minecraft:stone");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn anvil_baseline_preserves_roundtrip_edits_snapshots_and_reset() {
|
||||
let t = tempfile::tempdir().unwrap();
|
||||
let path = t.path().join("baseline");
|
||||
let source = fixture("java26_2-world");
|
||||
let report = import_anvil_baseline(&source, &path, Mode::Exact).unwrap();
|
||||
assert_eq!(report.nonair_blocks, 3);
|
||||
assert_eq!(report.worlds["main"], 0);
|
||||
let exact = t.path().join("exact");
|
||||
export_anvil(&path, None, &exact, Mode::Exact).unwrap();
|
||||
assert_tree_equal(&source, &exact);
|
||||
let db = rusqlite::Connection::open(path.join("worlds.sqlite3")).unwrap();
|
||||
let history: i64 = db
|
||||
.query_row("SELECT count(*) FROM operation_changes", [], |r| r.get(0))
|
||||
.unwrap();
|
||||
assert_eq!(history, 0);
|
||||
drop(db);
|
||||
let mut store = WorldStore::open(&path, 2).unwrap();
|
||||
let pos = [-1, -1, 31];
|
||||
let original = store.get_block("main", pos).unwrap();
|
||||
assert_ne!(original, 0);
|
||||
store
|
||||
.edit("main", 0, "remove", vec![BlockChange { pos, block: 0 }])
|
||||
.unwrap();
|
||||
drop(store);
|
||||
assert!(export_anvil(&path, None, &t.path().join("rejected"), Mode::Exact).is_err());
|
||||
let edited = t.path().join("edited");
|
||||
export_anvil(&path, None, &edited, Mode::BestEffort).unwrap();
|
||||
let reimport = t.path().join("reimport");
|
||||
import_anvil_baseline(&edited, &reimport, Mode::Exact).unwrap();
|
||||
assert_eq!(
|
||||
WorldStore::open(&reimport, 2)
|
||||
.unwrap()
|
||||
.get_block("main", pos)
|
||||
.unwrap(),
|
||||
0
|
||||
);
|
||||
let mut store = WorldStore::open(&path, 2).unwrap();
|
||||
store.reset_world("main", 1, "reset").unwrap();
|
||||
assert_eq!(store.get_block("main", pos).unwrap(), original);
|
||||
store.create_world("playable", Some("main")).unwrap();
|
||||
assert_eq!(store.get_block("playable", pos).unwrap(), original);
|
||||
assert!(
|
||||
store
|
||||
.read_section("playable", [-1, -1, 1])
|
||||
.unwrap()
|
||||
.is_some()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn native_new_world_export_and_schematic() {
|
||||
let t = tempfile::tempdir().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user