Expand voxel gameplay, lighting, full-height streaming and world imports
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:
Emil
2026-09-17 02:10:53 +03:00
parent 26748912c6
commit c7e86663d8
111 changed files with 24257 additions and 598 deletions
+28
View File
@@ -407,6 +407,21 @@ fn world_name(dimension: &str) -> String {
}
pub fn import_anvil(source: &Path, destination: &Path, mode: Mode) -> Result<Report> {
import_anvil_impl(source, destination, mode, false)
}
/// Load source sections as an immutable baseline, without per-block edit history.
/// Subsequent edits remain journaled; resetting them restores the imported map.
pub fn import_anvil_baseline(source: &Path, destination: &Path, mode: Mode) -> Result<Report> {
import_anvil_impl(source, destination, mode, true)
}
fn import_anvil_impl(
source: &Path,
destination: &Path,
mode: Mode,
baseline: bool,
) -> Result<Report> {
let stage = io::stage(destination)?;
ensure!(
!stage
@@ -475,6 +490,16 @@ pub fn import_anvil(source: &Path, destination: &Path, mode: Mode) -> Result<Rep
.iter()
.map(|s| store.register_block(s))
.collect::<Result<Vec<_>>>()?;
if baseline {
let cells = Box::new(std::array::from_fn(|i| registry[indices[i]]));
let nonair = cells.iter().filter(|&&block| block != 0).count();
report.nonair_blocks += nonair as u64;
report.sections += 1;
if nonair > 0 {
store.materialize_section(&world, [x, y, z], &cells)?;
}
continue;
}
let mut changes = Vec::new();
for (index, pid) in indices.into_iter().enumerate() {
let block = registry[pid];
@@ -512,6 +537,9 @@ pub fn import_anvil(source: &Path, destination: &Path, mode: Mode) -> Result<Rep
}
store.flush()?;
drop(store);
if baseline {
report.issue("import_baseline", "preserved", "WorldStore", "Source blocks stored as immutable section baselines without per-block edit history. Later edits are journaled; reset restores the imported baseline.");
}
report.issue("opaque_world_data","preserved","compat/original","All source files retained with SHA256: level.dat, entities, biomes, block entities, POI, datapacks, playerdata, unknown files. Native simulation edits blocks only; no entity/biome migration.");
let mut provenance = Provenance {
schema_version: 1,
+1 -1
View File
@@ -5,7 +5,7 @@ mod entities;
mod io;
pub mod nbt;
mod schem;
pub use anvil::{export_anvil, import_anvil};
pub use anvil::{export_anvil, import_anvil, import_anvil_baseline};
use anyhow::{Result, ensure};
pub use schem::{export_schem, import_schem};
use serde::{Deserialize, Serialize};
+14 -2
View File
@@ -1,6 +1,8 @@
use anyhow::Result;
use clap::{Parser, Subcommand};
use shacraft_compat::{Mode, export_anvil, export_schem, import_anvil, import_schem};
use shacraft_compat::{
Mode, export_anvil, export_schem, import_anvil, import_anvil_baseline, import_schem,
};
use std::path::PathBuf;
#[derive(Parser)]
#[command(about = "Offline bounded Java26.2 world converter; every destination must be new")]
@@ -13,6 +15,9 @@ enum Command {
ImportAnvil {
source: PathBuf,
destination: PathBuf,
/// Store source sections without creating per-block edit history.
#[arg(long)]
baseline: bool,
#[arg(long, value_enum, default_value = "exact")]
mode: Mode,
},
@@ -61,7 +66,14 @@ fn run() -> Result<()> {
source,
destination,
mode,
} => import_anvil(&source, &destination, mode)?,
baseline,
} => {
if baseline {
import_anvil_baseline(&source, &destination, mode)?
} else {
import_anvil(&source, &destination, mode)?
}
}
Command::ExportAnvil {
store,
destination,
+51 -1
View File
@@ -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();