Fix critical structural issues: undo/redo, surface import, brush strength, i18n macro, level.dat export, GPU fallback, Nether/End support, dead code removal, dim serde, CPU perf, wasm-host, GPU constants, clippy warnings
- Replace OnceLock with Mutex<Option> for snapshot system in all 9 operations (undo/redo now works after redo) - Fix import surface detection: scan actual packed block data for highest solid block instead of always using +15 - Apply brush strength threshold (< 0.3) in PaintOperation for natural edge falloff - Remove broken t!() macro variant with variable substitution - Complete level.dat with RandomSeed, GameType, Difficulty, Spawn, Time, DataPacks, etc. - GPU viewport falls back to CPU renderer for multi-tile worlds - Export supports Nether (DIM-1/region) and End (DIM1/region) dimension subdirectories - Remove dead FloodOperation (duplicate of PaintOperation) - Add log::warn for malformed dimension tile keys in serde - Reduce CPU viewport base_size from 64 to 32 (4x fewer pixels) - Simplify wasm-host host_get_seed to direct cast - Add named constants for GPU buffer sizes - Fix unused import warning in cli/main.rs - cargo fmt
This commit is contained in:
parent
18613260a8
commit
2419b603c1
24 changed files with 339 additions and 271 deletions
|
|
@ -1,6 +1,6 @@
|
|||
use std::collections::HashMap;
|
||||
use std::sync::atomic::{AtomicU8, Ordering};
|
||||
use std::sync::LazyLock;
|
||||
use std::sync::atomic::{AtomicU8, Ordering};
|
||||
|
||||
mod lang;
|
||||
pub use lang::Language;
|
||||
|
|
@ -57,11 +57,6 @@ macro_rules! t {
|
|||
($key:expr) => {
|
||||
$crate::translate($key)
|
||||
};
|
||||
($key:expr, $($var:ident = $val:expr),+ $(,)?) => {{
|
||||
let vars: &[(&str, &str)] = &[$((stringify!($var), &$val as &dyn std::fmt::Display as &str)),+];
|
||||
// This won't work with runtime format. Use translate_with instead.
|
||||
$crate::translate_with($key, &[$((stringify!($var), &$val.as_ref() as &str)),+])
|
||||
}};
|
||||
}
|
||||
|
||||
/// Detect system language from environment variables (LANG, LANGUAGE, LC_ALL).
|
||||
|
|
@ -106,10 +101,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_translate_with_vars() {
|
||||
let result = translate_with("cli.new.created", &[
|
||||
("name", "test"),
|
||||
("tiles", "9"),
|
||||
]);
|
||||
let result = translate_with("cli.new.created", &[("name", "test"), ("tiles", "9")]);
|
||||
assert!(result.contains("test"));
|
||||
assert!(result.contains("9"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,11 +46,7 @@ fn host_log(mut caller: Caller<'_, WorldContext>, level: i32, ptr: i32, len: i32
|
|||
}
|
||||
|
||||
fn host_get_seed(caller: Caller<'_, WorldContext>) -> i64 {
|
||||
let (lo, hi) = (
|
||||
(caller.data().seed & 0xFFFF_FFFF) as i64,
|
||||
((caller.data().seed >> 32) & 0xFFFF_FFFF) as i64,
|
||||
);
|
||||
lo | (hi << 32)
|
||||
caller.data().seed as i64
|
||||
}
|
||||
|
||||
fn host_tile_size(_caller: Caller<'_, WorldContext>) -> i32 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue