From 3d4b63c19e0dde3e6aab138e056e2445dab0c42a Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Fri, 23 Oct 2026 15:25:10 +0200 Subject: [PATCH 001/107] wasmtime 48 LTS: one wasm-tools version for the runtime, packing and the SDK wasmtime 36 read WebAssembly with wasm-tools 0.236, wit-component (cargo horizon-mod, the sandbox tests) used 0.239 and the SDK's wit-bindgen 0.247: three copies of wasmparser, wasm-encoder, wit-parser and wasm-metadata. wasmtime 48, the next long-term-support line (fixes until August 2028), wit-component 0.254 and wit-bindgen 0.60 all use 0.254. No code change; horizon-mods now needs Rust 1.95. Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 541 +++++++++++++----------------- crates/horizon-mod-sdk/Cargo.toml | 2 +- crates/horizon-mods/Cargo.toml | 10 +- docs/mods.md | 8 +- 4 files changed, 241 insertions(+), 320 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2f832e248..420f2226c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -20,9 +20,9 @@ checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618" [[package]] name = "addr2line" -version = "0.25.1" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +checksum = "59317f77929f0e679d39364702289274de2f0f0b22cbf50b2b8cff2169a0b27a" dependencies = [ "gimli", ] @@ -155,7 +155,7 @@ dependencies = [ "objc2-foundation 0.3.2", "parking_lot", "percent-encoding", - "windows-sys 0.59.0", + "windows-sys 0.60.2", "wl-clipboard-rs", "x11rb", ] @@ -196,6 +196,17 @@ dependencies = [ "libloading", ] +[[package]] +name = "async-trait" +version = "0.1.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + [[package]] name = "atomic-waker" version = "1.1.2" @@ -572,7 +583,7 @@ dependencies = [ "jni 0.21.1", "js-sys", "libc", - "mach2", + "mach2 0.4.3", "ndk", "ndk-context", "num-derive", @@ -586,6 +597,15 @@ dependencies = [ "windows 0.54.0", ] +[[package]] +name = "cpp_demangle" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0667304c32ea56cb4cd6d2d7c0cfe9a2f8041229db8c033af7f8d69492429def" +dependencies = [ + "cfg-if", +] + [[package]] name = "cpufeatures" version = "0.2.17" @@ -597,46 +617,48 @@ dependencies = [ [[package]] name = "cranelift-assembler-x64" -version = "0.123.18" +version = "0.135.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e92993516bcc43fd4e511b31d2e0c0c24f6b7ac18bb39e32cac2bfc05ea378e" +checksum = "e6071a4f1df4837aa03d1e4d53067784acafe270ffc7dad66a7f39832204da3f" dependencies = [ "cranelift-assembler-x64-meta", ] [[package]] name = "cranelift-assembler-x64-meta" -version = "0.123.18" +version = "0.135.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97eeeb61b08ec484f274119faf3a8a1b80dd300b0208c0247d16d05982fc89fe" +checksum = "5e3b92a9cc90388fe70e63640af30b734387449445aef0176ab2028e9892d70e" dependencies = [ "cranelift-srcgen", ] [[package]] name = "cranelift-bforest" -version = "0.123.18" +version = "0.135.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "782eb44158681a105d157cb0ce63e3dc83f78ef5674266c12234f49da3f5c6e8" +checksum = "f45c85646c4425cc85b868effaf20c302b437a3fb79bb27a64513dd522f07411" dependencies = [ "cranelift-entity", + "wasmtime-internal-core", ] [[package]] name = "cranelift-bitset" -version = "0.123.18" +version = "0.135.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edd59af193204c4f025fb2c2d9ee0aeb1f60929edf000b0dfa3d45543a62f264" +checksum = "94f56b5c7d564cfa03aa269a6b98c916cab4d545196a391d31403a23ef39333a" dependencies = [ "serde", "serde_derive", + "wasmtime-internal-core", ] [[package]] name = "cranelift-codegen" -version = "0.123.18" +version = "0.135.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c29bd985057d790db25f6bc60b369b311aa2d75c2f496a7e9993585bfc7d60" +checksum = "2c073641ce6e382814a8220331cc1ea2c782a9ea5d5da6d0f7f7c0541192693e" dependencies = [ "bumpalo", "cranelift-assembler-x64", @@ -648,22 +670,26 @@ dependencies = [ "cranelift-entity", "cranelift-isle", "gimli", - "hashbrown 0.15.5", + "hashbrown 0.17.1", + "libm", "log", + "postcard", "pulley-interpreter", "regalloc2", "rustc-hash 2.1.3", "serde", + "serde_derive", + "sha2", "smallvec", "target-lexicon", - "wasmtime-internal-math", + "wasmtime-internal-core", ] [[package]] name = "cranelift-codegen-meta" -version = "0.123.18" +version = "0.135.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9ef8a8495f19212f92db8425f768ffc67000c5cb417a0664475a8d09596700f" +checksum = "db226fafea5194921de10dccf35ac2863500313990f770cbe8b26c51eebec4d4" dependencies = [ "cranelift-assembler-x64-meta", "cranelift-codegen-shared", @@ -674,37 +700,39 @@ dependencies = [ [[package]] name = "cranelift-codegen-shared" -version = "0.123.18" +version = "0.135.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3aa5099097666baf45bd68ef036327c8f29d8785fffaaa7db3b3b6b7e94bcc6" +checksum = "cf8ac46b2c8e328ca979810426ea635ef90ecc8c54fd3296bde31ab470a48a1d" [[package]] name = "cranelift-control" -version = "0.123.18" +version = "0.135.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26f67f4f4e92c2934f40c2ff4574400bd27326932aad937a438b7fb459f60a63" +checksum = "6754e0ab97915209ea6ce6549f6443b018e1338142ada4c856cec213ee82e4b8" dependencies = [ "arbitrary", ] [[package]] name = "cranelift-entity" -version = "0.123.18" +version = "0.135.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8393d09f0abaa504896069e79f4eb6f15eb1853e5645732b082dac1ed292aaa8" +checksum = "774d25e36df18696f63a284e9c4ea43455e2ebcca6308e0e02301f18c8e777e2" dependencies = [ "cranelift-bitset", "serde", "serde_derive", + "wasmtime-internal-core", ] [[package]] name = "cranelift-frontend" -version = "0.123.18" +version = "0.135.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "580cfaecbd11476dd82f6a393123dcbd9dfe583467df8d0c8441c641444d4985" +checksum = "69cfcb31405e2de2a48e5a6de8e07a3d8b77f35caa3e944d627780734b36c138" dependencies = [ "cranelift-codegen", + "hashbrown 0.17.1", "log", "smallvec", "target-lexicon", @@ -712,15 +740,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.123.18" +version = "0.135.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c044843adb7d94b1facebaad846c0a762f79a77953417e3f0182093bcbbdc38" +checksum = "2f5a26df22db546ab92be6feaf21835ae91082af0a32bbb398b277df3765412f" [[package]] name = "cranelift-native" -version = "0.123.18" +version = "0.135.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d4c1707214e53f2040e4d13430069ea22623287b2750ed6d62e40eba88d91a" +checksum = "19f258c08e590f90dcaf9904d25ba142ee2980c3aaeac4bb45f1452b1a407c2a" dependencies = [ "cranelift-codegen", "libc", @@ -729,9 +757,9 @@ dependencies = [ [[package]] name = "cranelift-srcgen" -version = "0.123.18" +version = "0.135.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d355a35edc49f628db7b793f3527eed31b560e77c3e8ed0e5258aad8df8a5249" +checksum = "67055b4f315e8f6af3e8eccec74ad38f7407f0fd854adbd49b4b3b27bdb2e3be" [[package]] name = "crc32fast" @@ -1003,12 +1031,6 @@ version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b5343afd4a8365a643ac588dab4cf234a190c7f6c88c9f6dd6ffe00837661b7" -[[package]] -name = "fallible-iterator" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" - [[package]] name = "fdeflate" version = "0.3.7" @@ -1101,12 +1123,48 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "futures" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a31d2a3fbaaeb2af2368bbdd904aa8e812d3c04a1ee10d3171f52d556e5d0a3" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" +dependencies = [ + "futures-core", + "futures-sink", +] + [[package]] name = "futures-core" version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" +[[package]] +name = "futures-io" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" + +[[package]] +name = "futures-sink" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" + [[package]] name = "futures-task" version = "0.3.34" @@ -1119,8 +1177,12 @@ version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" dependencies = [ + "futures-channel", "futures-core", + "futures-io", + "futures-sink", "futures-task", + "memchr", "pin-project-lite", "slab", ] @@ -1215,11 +1277,12 @@ dependencies = [ [[package]] name = "gimli" -version = "0.32.3" +version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" +checksum = "0bf7f043f89559805f8c7cacc432749b2fa0d0a0a9ee46ce47164ed5ba7f126c" dependencies = [ - "fallible-iterator", + "fnv", + "hashbrown 0.16.1", "indexmap", "stable_deref_trait", ] @@ -1315,7 +1378,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" dependencies = [ "foldhash 0.1.5", - "serde", ] [[package]] @@ -1336,6 +1398,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" dependencies = [ "foldhash 0.2.0", + "serde", + "serde_core", ] [[package]] @@ -1486,7 +1550,7 @@ dependencies = [ name = "horizon-mod-sdk" version = "0.1.0" dependencies = [ - "wit-bindgen", + "wit-bindgen 0.60.0", ] [[package]] @@ -1499,8 +1563,8 @@ dependencies = [ "serde_json", "toml", "wasmtime", - "wit-component 0.239.0", - "wit-parser 0.239.0", + "wit-component", + "wit-parser", "zip", ] @@ -2127,6 +2191,12 @@ dependencies = [ "libc", ] +[[package]] +name = "mach2" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dae608c151f68243f2b000364e1f7b186d9c29845f7d2d85bd31b9ad77ad552b" + [[package]] name = "memchr" version = "2.8.3" @@ -2662,12 +2732,12 @@ dependencies = [ [[package]] name = "object" -version = "0.37.3" +version = "0.39.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +checksum = "2e5a6c098c7a3b6547378093f5cc30bc54fd361ce711e05293a5cc589562739b" dependencies = [ "crc32fast", - "hashbrown 0.15.5", + "hashbrown 0.17.1", "indexmap", "memchr", ] @@ -2972,21 +3042,21 @@ checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5" [[package]] name = "pulley-interpreter" -version = "36.0.18" +version = "48.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "334ae8982dcf354e5f28e79fc6f935601e028b729cc174d3937eeeaa859057b8" +checksum = "2b8187c8e7db87d085865fc106502e7b34d5c25f8ce4c272945b21503371f6a0" dependencies = [ "cranelift-bitset", "log", "pulley-macros", - "wasmtime-internal-math", + "wasmtime-internal-core", ] [[package]] name = "pulley-macros" -version = "36.0.18" +version = "48.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cd207bca4bc5e46cb4fcea87196dcbd78befc628c64c67d11dc99fce5cd5369" +checksum = "7f98ce0e381d9e45e63ea1d20bba3cf131797086077f43af9203f1fb7de0ed6b" dependencies = [ "proc-macro2", "quote", @@ -3094,15 +3164,16 @@ dependencies = [ [[package]] name = "regalloc2" -version = "0.12.2" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5216b1837de2149f8bc8e6d5f88a9326b63b8c836ed58ce4a0a29ec736a59734" +checksum = "757712e8e61590d6d4f5d563483755538b5aa13467837a3b41cd9832509a7f85" dependencies = [ "allocator-api2", "bumpalo", - "hashbrown 0.15.5", + "hashbrown 0.17.1", "log", "rustc-hash 2.1.3", + "serde", "smallvec", ] @@ -3155,6 +3226,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rustc-demangle" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b74b56ffa8bb2830709a538c2cbcae9aa062db0d2a42563bfb09bdaae44020eb" + [[package]] name = "rustc-hash" version = "1.1.0" @@ -3995,7 +4072,7 @@ version = "1.0.4+wasi-0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" dependencies = [ - "wit-bindgen", + "wit-bindgen 0.57.1", ] [[package]] @@ -4056,124 +4133,66 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.236.1" +version = "0.254.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "724fccfd4f3c24b7e589d333fc0429c68042897a7e8a5f8694f31792471841e7" +checksum = "ebaca0b540bdb15d195ff34fb23074255948708b8916a11a339ba4513dc61906" dependencies = [ "leb128fmt", - "wasmparser 0.236.1", -] - -[[package]] -name = "wasm-encoder" -version = "0.239.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be00faa2b4950c76fe618c409d2c3ea5a3c9422013e079482d78544bb2d184c" -dependencies = [ - "leb128fmt", - "wasmparser 0.239.0", -] - -[[package]] -name = "wasm-encoder" -version = "0.247.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b6733b8b91d010a6ac5b0fb237dc46a19650bc4c67db66857e2e787d437204" -dependencies = [ - "leb128fmt", - "wasmparser 0.247.0", + "wasmparser", ] [[package]] name = "wasm-metadata" -version = "0.239.0" +version = "0.254.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20b3ec880a9ac69ccd92fbdbcf46ee833071cf09f82bb005b2327c7ae6025ae2" +checksum = "5d1880dd9a848aa68f387966256c34ad49abb4607e3cfa35720d2723d0591cd3" dependencies = [ "anyhow", "indexmap", - "wasm-encoder 0.239.0", - "wasmparser 0.239.0", -] - -[[package]] -name = "wasm-metadata" -version = "0.247.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "665fe59e56cc9b419ca6fcca56673e3421d1a5011e3b65caf6b726fd9e041d10" -dependencies = [ - "anyhow", - "indexmap", - "wasm-encoder 0.247.0", - "wasmparser 0.247.0", + "wasm-encoder", + "wasmparser", ] [[package]] name = "wasmparser" -version = "0.236.1" +version = "0.254.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9b1e81f3eb254cf7404a82cee6926a4a3ccc5aad80cc3d43608a070c67aa1d7" +checksum = "c5ff8685b587722894b6f25958fc608d315b93b8d23647bfb567664e7006d757" dependencies = [ "bitflags 2.13.2", - "hashbrown 0.15.5", + "hashbrown 0.17.1", "indexmap", "semver", "serde", ] -[[package]] -name = "wasmparser" -version = "0.239.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9d90bb93e764f6beabf1d02028c70a2156a6583e63ac4218dd07ef733368b0" -dependencies = [ - "bitflags 2.13.2", - "hashbrown 0.15.5", - "indexmap", - "semver", -] - -[[package]] -name = "wasmparser" -version = "0.247.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e6fb4c2bee46c5ea4d40f8cdb5c131725cd976718ec56f1c8e82fbde5fa2a80" -dependencies = [ - "bitflags 2.13.2", - "hashbrown 0.17.1", - "indexmap", - "semver", -] - [[package]] name = "wasmprinter" -version = "0.236.1" +version = "0.254.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2df225df06a6df15b46e3f73ca066ff92c2e023670969f7d50ce7d5e695abbb1" +checksum = "8b03c8f270f3f384f70f42869b5ff7f6253fe4f0aa8590f7edd332c1943e5f51" dependencies = [ "anyhow", "termcolor", - "wasmparser 0.236.1", + "wasmparser", ] [[package]] name = "wasmtime" -version = "36.0.18" +version = "48.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70095b9fe63cc2a87ed206729e11544610decc184c62898c5d201ff1d666d82e" +checksum = "12300d040e8bea7e7ccde75b9919d27ebba47a217a64b09ba058ae8d3b4290b6" dependencies = [ "addr2line", - "anyhow", + "async-trait", "bitflags 2.13.2", "bumpalo", "cc", - "cfg-if", "encoding_rs", - "hashbrown 0.15.5", - "indexmap", + "futures", "libc", "log", - "mach2", + "mach2 0.6.0", "memfd", "object", "once_cell", @@ -4185,62 +4204,56 @@ dependencies = [ "serde_derive", "smallvec", "target-lexicon", - "wasmparser 0.236.1", + "wasmparser", "wasmtime-environ", - "wasmtime-internal-asm-macros", "wasmtime-internal-component-macro", "wasmtime-internal-component-util", + "wasmtime-internal-core", "wasmtime-internal-cranelift", "wasmtime-internal-fiber", "wasmtime-internal-jit-debug", "wasmtime-internal-jit-icache-coherence", - "wasmtime-internal-math", - "wasmtime-internal-slab", "wasmtime-internal-unwinder", "wasmtime-internal-versioned-export-macros", - "wasmtime-internal-winch", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] name = "wasmtime-environ" -version = "36.0.18" +version = "48.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a67ea8904b6e369e2218780bd1f9186f1980cb616445eb2c1f3c4e45c8397865" +checksum = "805d6554eb6dd6e62891061a31383a89d69fd891f785e5ae68f0835a554b7a2a" dependencies = [ "anyhow", + "cpp_demangle", + "cranelift-bforest", "cranelift-bitset", "cranelift-entity", "gimli", + "hashbrown 0.17.1", "indexmap", "log", "object", "postcard", + "rustc-demangle", "semver", "serde", "serde_derive", + "sha2", "smallvec", "target-lexicon", - "wasm-encoder 0.236.1", - "wasmparser 0.236.1", + "wasm-encoder", + "wasmparser", "wasmprinter", "wasmtime-internal-component-util", -] - -[[package]] -name = "wasmtime-internal-asm-macros" -version = "36.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0488a52ae93e654baecb08ce04d15d478756eb2168c2bdab7915710109161ce" -dependencies = [ - "cfg-if", + "wasmtime-internal-core", ] [[package]] name = "wasmtime-internal-component-macro" -version = "36.0.18" +version = "48.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "377e406c3f8e7bea64db3cb3ee0d406c331e8fc09d8cb2e7bf9ad74cb5d3b31a" +checksum = "b832b80853365d9d3a741681044554be291a4f977aae074b318b55c7a4835f83" dependencies = [ "anyhow", "proc-macro2", @@ -4248,23 +4261,32 @@ dependencies = [ "syn 2.0.119", "wasmtime-internal-component-util", "wasmtime-internal-wit-bindgen", - "wit-parser 0.236.1", + "wit-parser", ] [[package]] name = "wasmtime-internal-component-util" -version = "36.0.18" +version = "48.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97c24503bb712afe2c797dc291b96e57556ee62c35fd951f87e96088324de37c" +checksum = "4c8a11aaf68d8945991429d45950f32490a30ddcdcdb56629816cb41a255d8fe" + +[[package]] +name = "wasmtime-internal-core" +version = "48.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea266d6cfb31c324c075c8432386654bcbb1559aa8d29be9d47eacf7dcc41012" +dependencies = [ + "hashbrown 0.17.1", + "libm", + "serde", +] [[package]] name = "wasmtime-internal-cranelift" -version = "36.0.18" +version = "48.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63ea7ee133de9109a4a1fc63dae3afc9ea32e92b8dada824fa4595dbf175f80" +checksum = "d427759553b07c296c8ed7bff8ac930a94b9ba99e6a79243ea79bcc51aa58d96" dependencies = [ - "anyhow", - "cfg-if", "cranelift-codegen", "cranelift-control", "cranelift-entity", @@ -4278,33 +4300,32 @@ dependencies = [ "smallvec", "target-lexicon", "thiserror 2.0.21", - "wasmparser 0.236.1", + "wasmparser", "wasmtime-environ", - "wasmtime-internal-math", + "wasmtime-internal-core", + "wasmtime-internal-unwinder", "wasmtime-internal-versioned-export-macros", ] [[package]] name = "wasmtime-internal-fiber" -version = "36.0.18" +version = "48.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69662a0a4dbe9784d1e8add9e3c5d2db0ca348085c624c27a70992dbe2eff4a3" +checksum = "b54c8c5b02ea985149a90f917e1761af99734c6c27e6d7fdd5b6f69fc1db3950" dependencies = [ - "anyhow", "cc", - "cfg-if", "libc", "rustix 1.1.5", - "wasmtime-internal-asm-macros", + "wasmtime-environ", "wasmtime-internal-versioned-export-macros", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] name = "wasmtime-internal-jit-debug" -version = "36.0.18" +version = "48.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00cb07d23903c0be359d6b920d94774ea322759c3f4d6721b61afa03602e4804" +checksum = "72bb10c94724f072b6eca515085033e61da9efae65d054545126df37a15530c3" dependencies = [ "cc", "wasmtime-internal-versioned-export-macros", @@ -4312,83 +4333,50 @@ dependencies = [ [[package]] name = "wasmtime-internal-jit-icache-coherence" -version = "36.0.18" +version = "48.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa2b47c37a6d026e2755fe2cf7ec5c1f4b0fba62e448ea910cdf6a07a4982c6a" +checksum = "1b781a27e8958fd07fd3135c0be216f77301efecd15cbf4f14ff210cdad5f169" dependencies = [ - "anyhow", - "cfg-if", "libc", - "windows-sys 0.60.2", + "wasmtime-internal-core", + "windows-sys 0.61.2", ] -[[package]] -name = "wasmtime-internal-math" -version = "36.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b269f0ba44102c57fd5f94f1bf4395ccd4fc2b84698fc78f627a6f2a47131a62" -dependencies = [ - "libm", -] - -[[package]] -name = "wasmtime-internal-slab" -version = "36.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e35ac9d503d503703cd24d532e53e2e93c86109b451df40a9801500045aee25" - [[package]] name = "wasmtime-internal-unwinder" -version = "36.0.18" +version = "48.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83ce1d0930da44ed375701e6b4f187b46249f7efe2b1d8c1c77229a4adc82de9" +checksum = "121188de1b2741b8e35530a9b0c8adf525b3aa5913a2ca3d4522509cfbc0494a" dependencies = [ - "anyhow", - "cfg-if", "cranelift-codegen", "log", "object", + "wasmtime-environ", ] [[package]] name = "wasmtime-internal-versioned-export-macros" -version = "36.0.18" +version = "48.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b6633be262400bd7abab4ff767a16e8b6a41ff117be54bf76dabecea9f96225" +checksum = "933f1990e4e5177547a4abd51dcfa5cb7616fe42b9fb6f0f2b7423627758223c" dependencies = [ "proc-macro2", "quote", "syn 2.0.119", ] -[[package]] -name = "wasmtime-internal-winch" -version = "36.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "509d1e1cf8e3b3306f291407c92bca8381d9294f8c54ad74b692538f1f5b23c7" -dependencies = [ - "anyhow", - "cranelift-codegen", - "gimli", - "object", - "target-lexicon", - "wasmparser 0.236.1", - "wasmtime-environ", - "wasmtime-internal-cranelift", - "winch-codegen", -] - [[package]] name = "wasmtime-internal-wit-bindgen" -version = "36.0.18" +version = "48.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6d9a5b51b3400b4df1055724c4536ad5aa58fafe83cea5ca94f88cc9eb97563" +checksum = "417ebd61d2581d86d65413517f3a41294a9ad105da26f0dc7039912a0d97e1ed" dependencies = [ "anyhow", "bitflags 2.13.2", "heck", "indexmap", - "wit-parser 0.236.1", + "wit-component", + "wit-parser", ] [[package]] @@ -4698,26 +4686,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "winch-codegen" -version = "36.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e470d7e674c41ad32dddc02d8d8a94983e0a4c516028bda60747e6dd862a567" -dependencies = [ - "anyhow", - "cranelift-assembler-x64", - "cranelift-codegen", - "gimli", - "regalloc2", - "smallvec", - "target-lexicon", - "thiserror 2.0.21", - "wasmparser 0.236.1", - "wasmtime-environ", - "wasmtime-internal-cranelift", - "wasmtime-internal-math", -] - [[package]] name = "windows" version = "0.54.0" @@ -5164,42 +5132,48 @@ name = "wit-bindgen" version = "0.57.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "wit-bindgen" +version = "0.60.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a301904d6657d6364c758d869e5389d05d393b16d5b65db60b4f03cbe71bb80d" dependencies = [ "wit-bindgen-rust-macro", ] [[package]] name = "wit-bindgen-core" -version = "0.57.1" +version = "0.60.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02dee27a2dc20d1008016c742ec9fc6ea498492994ba3750be7454cbc97ff04c" +checksum = "48521bb96e56cbb9e031ad306c80dc20e89e69e49ada02781ee06f60fbcb545f" dependencies = [ "anyhow", "heck", - "wit-parser 0.247.0", + "wit-parser", ] [[package]] name = "wit-bindgen-rust" -version = "0.57.1" +version = "0.60.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5007dae772945b7a5003d69d90a3a4a78929d41f19d004e980c4259a6af4484" +checksum = "3df3fe9b9a0066f82fd0c2f07f79d0ffc0f85c53fa5f998516d8722712479042" dependencies = [ "anyhow", "heck", "indexmap", "prettyplease", "syn 2.0.119", - "wasm-metadata 0.247.0", + "wasm-metadata", "wit-bindgen-core", - "wit-component 0.247.0", + "wit-component", ] [[package]] name = "wit-bindgen-rust-macro" -version = "0.57.1" +version = "0.60.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af9237d678e3513ad24e96fe98beacdc0db6405284ba2a2400418cf0d42caa89" +checksum = "d689c4bc9d6af067c651cfba444766343c9a4bdef15fad1e2efab95c0c277af0" dependencies = [ "anyhow", "prettyplease", @@ -5212,9 +5186,9 @@ dependencies = [ [[package]] name = "wit-component" -version = "0.239.0" +version = "0.254.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88a866b19dba2c94d706ec58c92a4c62ab63e482b4c935d2a085ac94caecb136" +checksum = "1c96b3cea6838dbea55173baa56991fcb087896c321b0a770db201e5a0bd3506" dependencies = [ "anyhow", "bitflags 2.13.2", @@ -5223,72 +5197,17 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "wasm-encoder 0.239.0", - "wasm-metadata 0.239.0", - "wasmparser 0.239.0", - "wit-parser 0.239.0", -] - -[[package]] -name = "wit-component" -version = "0.247.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d567162a6b9843080e5e0053f696623ff694bae8ae017c9ec536d1873bbe3d8" -dependencies = [ - "anyhow", - "bitflags 2.13.2", - "indexmap", - "log", - "serde", - "serde_derive", - "serde_json", - "wasm-encoder 0.247.0", - "wasm-metadata 0.247.0", - "wasmparser 0.247.0", - "wit-parser 0.247.0", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", ] [[package]] name = "wit-parser" -version = "0.236.1" +version = "0.254.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e4833a20cd6e85d6abfea0e63a399472d6f88c6262957c17f546879a80ba15" -dependencies = [ - "anyhow", - "id-arena", - "indexmap", - "log", - "semver", - "serde", - "serde_derive", - "serde_json", - "unicode-xid", - "wasmparser 0.236.1", -] - -[[package]] -name = "wit-parser" -version = "0.239.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55c92c939d667b7bf0c6bf2d1f67196529758f99a2a45a3355cc56964fd5315d" -dependencies = [ - "anyhow", - "id-arena", - "indexmap", - "log", - "semver", - "serde", - "serde_derive", - "serde_json", - "unicode-xid", - "wasmparser 0.239.0", -] - -[[package]] -name = "wit-parser" -version = "0.247.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ffe4064318cdf3c08cb99343b44c039fcefe61ccdf58aa9975285f13d74d1fc" +checksum = "22672d61bfb9df46a16b46ce38522293aee1cc4749fc84a3464ce4083b3d5fd6" dependencies = [ "anyhow", "hashbrown 0.17.1", @@ -5299,8 +5218,8 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "unicode-xid", - "wasmparser 0.247.0", + "unicode-ident", + "wasmparser", ] [[package]] diff --git a/crates/horizon-mod-sdk/Cargo.toml b/crates/horizon-mod-sdk/Cargo.toml index df223b28c..899fb555a 100644 --- a/crates/horizon-mod-sdk/Cargo.toml +++ b/crates/horizon-mod-sdk/Cargo.toml @@ -7,7 +7,7 @@ rust-version = "1.85" description = "Write Horizon mods in Rust: WebAssembly components for the horizon:mod world (docs/mods.md)" [dependencies] -wit-bindgen = { version = "0.57.1", default-features = false, features = ["macros", "realloc"] } +wit-bindgen = { version = "0.60.0", default-features = false, features = ["macros", "realloc"] } [lints] workspace = true diff --git a/crates/horizon-mods/Cargo.toml b/crates/horizon-mods/Cargo.toml index 8db24ac35..d44648691 100644 --- a/crates/horizon-mods/Cargo.toml +++ b/crates/horizon-mods/Cargo.toml @@ -3,7 +3,7 @@ name = "horizon-mods" version = "0.1.0" edition.workspace = true license.workspace = true -rust-version = "1.86" +rust-version = "1.95" description = "Horizon's mod runtime: sandboxed WebAssembly components (docs/mods.md)" [dependencies] @@ -12,11 +12,11 @@ serde_json = "1" toml = "1.1.6" zip = { version = "2", default-features = false, features = ["deflate"] } log = "0.4" -# The 36 LTS line: security fixes until August 2027, and it builds on the client's Rust. -wasmtime = { version = "36.0.18", default-features = false, features = ["runtime", "cranelift", "component-model", "std"], optional = true } +# The 48 LTS line: security fixes until August 2028, on the same wasm-tools (0.254) as wit-component and the SDK's wit-bindgen. +wasmtime = { version = "48.0.7", default-features = false, features = ["runtime", "cranelift", "component-model", "std"], optional = true } # Turns a mod's core module into a component (cargo horizon-mod build, the tests). -wit-component = { version = "0.239", optional = true } -wit-parser = { version = "0.239", optional = true } +wit-component = { version = "0.254", optional = true } +wit-parser = { version = "0.254", optional = true } [features] default = ["runtime"] diff --git a/docs/mods.md b/docs/mods.md index 4b356d336..6aef6295a 100644 --- a/docs/mods.md +++ b/docs/mods.md @@ -14,7 +14,7 @@ folder, loads no runtime and plays exactly like vanilla 26.3. | The contract (WIT) | `crates/horizon-mod-sdk/wit/horizon.wit` | 0.1: log, game-read, chat, hud, storage; tick, frame, chat and command hooks | | SDK for mod authors | `crates/horizon-mod-sdk` | 0.1 | | Example mod | `crates/horizon-mod-sdk/examples/coords-hud` | coordinates, facing and time HUD, `/where`, `/coords` | -| Runtime | `crates/horizon-mods` | wasmtime 36 LTS, component model | +| Runtime | `crates/horizon-mods` | wasmtime 48 LTS, component model | | Authoring tool | `crates/cargo-horizon-mod` | `cargo horizon-mod new / build / run` | | In the game | `crates/horizon-client/src/game/mods.rs`, Options > Mods | client mods | | Launcher mod browser (Modrinth, CurseForge with a key) | [mod-browser.md](mod-browser.md) | resource packs, shader packs, modpacks | @@ -130,8 +130,10 @@ There is no file, socket, process or raw-input interface, on purpose. | native `cdylib` plugins | none | no: per OS and arch, unstable Rust ABI | yes | none | unsafe for players | | an embedded JVM | none per mod | yes | Java | 100+ MB, seconds of startup | see the research | -wasmtime 36 is a long-term-support line (security fixes until August 2027) -that builds on the client's Rust 1.90. Only its `runtime`, `cranelift`, +wasmtime 48 is a long-term-support line (security fixes until August 2028) +and needs Rust 1.95. It reads WebAssembly with the same wasm-tools release +(0.254) as the `wit-component` that packs mods and the SDK's `wit-bindgen`, so +the build carries one copy of them. Only its `runtime`, `cranelift`, `component-model` and `std` features are on: no WASI, no async, no GC proposal, no profiling. Its cranelift backend generates native code for x86-64 and ARM64 on Windows, macOS and Linux, which is why one `.hmod` serves them From 1fa46979c84c216f3e5c0d10d0704160db705f12 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sun, 25 Oct 2026 02:57:26 +0200 Subject: [PATCH 002/107] Server clients: primed TNT falls and burns its fuse by itself between updates PrimedTnt keeps Entity's NO_OP InterpolationHandler and ticks on a client too: a position packet puts it there at once, its own tick moves it on (gravity, collisions, bounces, drag) and burns the fuse down, and a client discards it when the fuse runs out. Horizon interpolated it towards each update instead, so it trailed about two ticks behind the server. lan_e2e's falling check now drops primed TNT too and checks that the guest has it exactly where its fall from rest puts it for the fuse the server sent. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/game/remote.rs | 19 +++++--- .../src/game/remote_projectiles.rs | 19 ++++++-- crates/horizon-client/src/game/tnt.rs | 2 +- tools/lan_e2e.py | 44 +++++++++++++++---- 4 files changed, 64 insertions(+), 20 deletions(-) diff --git a/crates/horizon-client/src/game/remote.rs b/crates/horizon-client/src/game/remote.rs index 1c7e30abb..4a563f01c 100644 --- a/crates/horizon-client/src/game/remote.rs +++ b/crates/horizon-client/src/game/remote.rs @@ -1465,10 +1465,10 @@ impl Game<'_> { if let Some(p) = r.pending_items.get_mut(&id) { p.0 = position; } - // ItemEntity and FallingBlockEntity keep Entity's NO_OP - // InterpolationHandler: moveOrInterpolateTo puts them there at - // once, and their own tick moves them on between the server's - // updates (`tick_remote_entities`). + // ItemEntity, FallingBlockEntity and PrimedTnt keep Entity's + // NO_OP InterpolationHandler: moveOrInterpolateTo puts them there + // at once, and their own tick moves them on between the server's + // updates (`tick_remote_entities`, `tick_remote_projectiles`). let at = Vec3::new(position[0], position[1], position[2]); if let Some(d) = self.dropped.iter_mut().find(|d| d.id == id as u32) { d.position = at; @@ -1479,6 +1479,11 @@ impl Game<'_> { f.position = at; return; } + if let Some(t) = self.tnts.iter_mut().find(|t| t.id == id as u32) { + t.position = at; + t.on_ground = on_ground; + return; + } // AbstractInterpolationHandler.interpolateTo: without a rotation, // the one it was heading for. let rotation = rotation.or_else(|| r.lerps.get(&id).and_then(|l| l.rotation)); @@ -2974,14 +2979,16 @@ impl Game<'_> { }); } /// `Entity.lerpMotion` (and `recreateFromPacket`'s motion) for the - /// entities whose own tick moves them on a client: dropped items and - /// falling blocks. + /// entities whose own tick moves them on a client: dropped items, falling + /// blocks and primed TNT. fn remote_motion(&mut self, id: i32, velocity: [f64; 3]) { let v = Vec3::new(velocity[0], velocity[1], velocity[2]); if let Some(d) = self.dropped.iter_mut().find(|d| d.id == id as u32) { d.velocity = v; } else if let Some(f) = self.falling.iter_mut().find(|f| f.id == id as u32) { f.velocity = v; + } else if let Some(t) = self.tnts.iter_mut().find(|t| t.id == id as u32) { + t.velocity = v; } else if let Some(p) = self .remote .as_mut() diff --git a/crates/horizon-client/src/game/remote_projectiles.rs b/crates/horizon-client/src/game/remote_projectiles.rs index 33c69728b..5098e79da 100644 --- a/crates/horizon-client/src/game/remote_projectiles.rs +++ b/crates/horizon-client/src/game/remote_projectiles.rs @@ -181,10 +181,21 @@ impl Game<'_> { /// One tick of interpolation, as `tick_remote_objects`. pub(super) fn tick_remote_projectiles(&mut self, mut step: impl FnMut(u32, Vec3) -> Vec3) { - for t in &mut self.tnts { - t.previous = t.position; - t.position = step(t.id, t.position); - } + // PrimedTnt.tick runs on a client too: it falls, bounces and burns its + // fuse down (the swell and flash follow it) between the server's + // updates (every 10 ticks), and a client discards it when the fuse + // runs out; only the server explodes it. + let (world, collision, assets, facts) = ( + &self.world, + self.collision, + &self.pack.assets, + self.res.facts(), + ); + self.tnts.retain_mut(|t| { + // A fluid lookup that fails leaves it where its move put it. + let _ = t.tick(world, collision, assets, facts); + t.fuse > 0 + }); // FallingBlockEntity.tick runs on a client too: the block falls by // itself between the server's updates (every 20 ticks), then waits // where it lands for the server to place it and remove it. diff --git a/crates/horizon-client/src/game/tnt.rs b/crates/horizon-client/src/game/tnt.rs index fddc02125..6bd2ae956 100644 --- a/crates/horizon-client/src/game/tnt.rs +++ b/crates/horizon-client/src/game/tnt.rs @@ -33,7 +33,7 @@ impl PrimedTnt { ), ) } - fn tick( + pub(super) fn tick( &mut self, world: &horizon_client::world::World, collision: &horizon_world::block_collision::BlockCollisionRegistry<'_>, diff --git a/tools/lan_e2e.py b/tools/lan_e2e.py index a0fe0e181..fad55dfe8 100755 --- a/tools/lan_e2e.py +++ b/tools/lan_e2e.py @@ -228,9 +228,10 @@ address. The script then checks, from both sides, what a guest's game used to ge - villagers: the guest sees each villager's and zombie villager's type, profession and level as the host has them, and an unemployed villager that takes a composter becomes a farmer on the guest too (the guest used to draw every villager as an unemployed plains one). -- falling: an item and a falling block the host summons high up fall smoothly on the guest, a - little further every tick between the server's updates (every 20 ticks), as their own - client tick moves them (they used to hang, then jump down once a second, #1568). +- falling: an item, a falling block and primed TNT the host summons high up fall smoothly on the + guest, a little further every tick between the server's updates (every 20 ticks, 10 for + TNT), as their own client tick moves them (they used to hang, then jump down once a + second, #1568), and the TNT's fuse burns down on the guest too. Each check is reported on its own (a failing one doesn't stop the others) and the screenshots of both sides go to --out (host-*.png, guest-*.png). @@ -5500,10 +5501,11 @@ CHECK_FNS.update(villagers=check_villagers) def check_falling(host, guest, out): - """ItemEntity and FallingBlockEntity tick on a client too (gravity, collisions, drag), and their - position packets snap them (Entity's NO_OP InterpolationHandler). The server sends an item's - and a falling block's position every 20 ticks, so between two updates the guest's own tick is - what moves them: sampled every 2 ticks over the first 16, both are lower nearly every time.""" + """ItemEntity, FallingBlockEntity and PrimedTnt tick on a client too (gravity, collisions, drag), + and their position packets snap them (Entity's NO_OP InterpolationHandler). The server sends an + item's and a falling block's position every 20 ticks and TNT's every 10, so between two updates + the guest's own tick is what moves them: sampled every 2 ticks over the first 16, all three are + lower nearly every time. The TNT's fuse (sent once, at spawn) counts down on the guest too.""" x, y, z = (int(v // 1) for v in pos_of(guest)) top = y + 30 tag = 'falling_e2e' @@ -5512,7 +5514,10 @@ def check_falling(host, guest, out): f'{{Tags:["{tag}"],Item:{{id:"minecraft:diamond",count:1}},PickupDelay:32767}}') host('command', command=f'summon minecraft:falling_block {x + 2.5} {top} {z - 0.5} ' f'{{Tags:["{tag}"],BlockState:{{Name:"minecraft:sand"}},DropItem:0b}}') - heights = {'item': [], 'falling block': []} + # Horizon's selectors don't see primed TNT yet: its fuse ends it in the air, 19 blocks down. + host('command', command=f'summon minecraft:tnt {x + 4.5} {top} {z + 0.5} {{fuse:34s}}') + heights = {'item': [], 'falling block': [], 'primed tnt': []} + fuses = [] try: for _ in range(8): items = [e['pos'][1] for e in guest.raw('entities', 48, 'minecraft:item')['entities'] @@ -5520,8 +5525,12 @@ def check_falling(host, guest, out): blocks = [o['position'][1] for o in guest('status')['projectiles'] if o.get('kind') == 'minecraft:falling_block' and abs(o['position'][0] - x - 2.5) < 0.5 and abs(o['position'][2] - z + 0.5) < 0.5] + tnts = [o for o in guest('status')['projectiles'] if o.get('kind') == 'minecraft:tnt' + and abs(o['position'][0] - x - 4.5) < 0.5 and abs(o['position'][2] - z - 0.5) < 0.5] heights['item'].append(items[0] if items else None) heights['falling block'].append(blocks[0] if blocks else None) + heights['primed tnt'].append(tnts[0]['position'][1] if tnts else None) + fuses.append(tnts[0]['fuse'] if tnts else None) guest.wait(2) guest.shot(out, 'falling') finally: @@ -5533,7 +5542,24 @@ def check_falling(host, guest, out): drops = sum(b < a for a, b in zip(seen, seen[1:])) # A tick or two can pass between two samples with no move; never most of them. assert drops >= len(seen) - 2, f'the {name} fell in {drops} of {len(seen) - 1} samples: {heights}' - return heights + # The server sends the TNT's fuse with each move, so each sample says how many ticks it has + # fallen from rest: snapped to the server's place and ticking on, the guest has it exactly + # there (it used to trail two ticks behind, interpolating towards each update). + fell = [(h, 34 - f) for h, f in zip(heights['primed tnt'], fuses) if f is not None] + assert fell and fell[-1][1] > fell[0][1], f'the TNT\'s fuse on the guest: {fuses}' + off = max(abs(h - tnt_fall(top, n)) for h, n in fell) + assert off < 0.01, f'the guest\'s TNT is {off:.3f} off its fall (height, ticks): {fell}' + return {**heights, 'fuse': fuses} + + +def tnt_fall(top, ticks): + """PrimedTnt.tick in open air from rest: its height after `ticks` ticks.""" + y, v = top, 0.0 + for _ in range(ticks): + v -= 0.04 + y += v + v *= 0.98 + return y CHECKS += ['falling'] From 1d90d72a64418071f943e404166fa39b09f50981 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sun, 25 Oct 2026 02:14:59 +0100 Subject: [PATCH 003/107] Server dialogs: the packets and the dialog model show_dialog and clear_dialog in configuration and play, and custom_click_action, the answer, in both. Dialog.DIRECT_CODEC as horizon_client::dialog: the five dialog types, their bodies, inputs and actions with vanilla's defaults, the values inputs hold, and Action.createAction (a command template's $(key) substitution with escapeWithoutQuotes, a custom action's payload of every input's tag). Nothing uses them yet: the screen comes next. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/dialog.rs | 794 ++++++++++++++++++ crates/horizon-client/src/lib.rs | 1 + .../src/packets/configuration.rs | 52 ++ crates/horizon-protocol/src/packets/play.rs | 60 +- 4 files changed, 905 insertions(+), 2 deletions(-) create mode 100644 crates/horizon-client/src/dialog.rs diff --git a/crates/horizon-client/src/dialog.rs b/crates/horizon-client/src/dialog.rs new file mode 100644 index 000000000..7acd3e86a --- /dev/null +++ b/crates/horizon-client/src/dialog.rs @@ -0,0 +1,794 @@ +//! Server dialogs (`net.minecraft.server.dialog`): what `Dialog.DIRECT_CODEC` +//! decodes from a `show_dialog` packet, the values its inputs hold, and the +//! click event an action makes of them (`Action.createAction`). +use crate::text::Text; +use horizon_world::nbt::Tag; +use serde_json::{Value, json}; + +/// `CommonDialogData` and the type's own fields. +#[derive(Clone, Debug)] +pub struct Dialog { + pub kind: Kind, + pub title: Text, + pub external_title: Option, + pub can_close_with_escape: bool, + pub pause: bool, + pub after_action: AfterAction, + pub body: Vec, + pub inputs: Vec, +} + +/// The dialog types (`DialogTypes`). +#[derive(Clone, Debug)] +pub enum Kind { + /// `NoticeDialog`: one button, "OK" when the server names none. + Notice(Button), + Confirmation { + yes: Button, + no: Button, + }, + MultiAction { + actions: Vec