diff --git a/Cargo.lock b/Cargo.lock index 0b4381092..16153c865 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,7 +8,7 @@ version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" dependencies = [ - "gimli 0.26.1", + "gimli", ] [[package]] @@ -44,7 +44,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.4", + "getrandom 0.2.7", "once_cell", "version_check", ] @@ -60,9 +60,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.53" +version = "1.0.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94a45b455c14666b85fc40a019e8ab9eb75e3a124e05494f5397122bc9eb06e0" +checksum = "1485d4d2cc45e7b201ee3767015c96faa5904387c9d87c6efdd0fb511f12d305" [[package]] name = "approx" @@ -84,9 +84,9 @@ dependencies = [ [[package]] name = "argh" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb41d85d92dfab96cb95ab023c265c5e4261bb956c0fb49ca06d90c570f1958" +checksum = "a7e7e4aa7e40747e023c0761dafcb42333a9517575bbf1241747f68dd3177a62" dependencies = [ "argh_derive", "argh_shared", @@ -94,9 +94,9 @@ dependencies = [ [[package]] name = "argh_derive" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be69f70ef5497dd6ab331a50bd95c6ac6b8f7f17a7967838332743fbd58dc3b5" +checksum = "69f2bd7ff6ed6414f4e5521bd509bae46454bbd513801767ced3f21a751ab4bc" dependencies = [ "argh_shared", "heck 0.3.3", @@ -107,9 +107,9 @@ dependencies = [ [[package]] name = "argh_shared" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6f8c380fa28aa1b36107cd97f0196474bb7241bb95a453c5c01a15ac74b2eac" +checksum = "47253b98986dafc7a3e1cf3259194f1f47ac61abb57a57f46ec09e48d004ecda" [[package]] name = "arrayvec" @@ -139,36 +139,39 @@ dependencies = [ [[package]] name = "autocfg" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" +checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78" +dependencies = [ + "autocfg 1.1.0", +] [[package]] name = "autocfg" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.63" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "321629d8ba6513061f26707241fa9bc89524ff1cd7a915a97ef0c62c666ce1b6" +checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" dependencies = [ "addr2line", "cc", "cfg-if 1.0.0", "libc", "miniz_oxide", - "object", + "object 0.29.0", "rustc-demangle", ] [[package]] name = "base-x" -version = "0.2.8" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b" +checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" [[package]] name = "base64" @@ -178,9 +181,9 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" [[package]] name = "base64ct" -version = "1.3.3" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "874f8444adcb4952a8bc51305c8be95c8ec8237bb0d2e78d2e039f771f8828a0" +checksum = "e6b4d9b1225d28d360ec6a231d65af1fd99a2a095154c8040689617290569c5c" [[package]] name = "bincode" @@ -234,15 +237,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.9.1" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" +checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d" [[package]] name = "bytecheck" -version = "0.6.7" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "314889ea31cda264cb7c3d6e6e5c9415a987ecb0e72c17c00d36fbb881d34abe" +checksum = "d11cac2c12b5adc6570dad2ee1b87eff4955dac476fe12d81e5fdd352e52406f" dependencies = [ "bytecheck_derive", "ptr_meta", @@ -250,9 +253,9 @@ dependencies = [ [[package]] name = "bytecheck_derive" -version = "0.6.7" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a2b3b92c135dae665a6f760205b89187638e83bed17ef3e44e83c712cf30600" +checksum = "13e576ebe98e605500b3c8041bb888e966653577172df6dd97398714eb30b9bf" dependencies = [ "proc-macro2", "quote", @@ -261,24 +264,24 @@ dependencies = [ [[package]] name = "bytecount" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72feb31ffc86498dacdbd0fcebb56138e7177a8cc5cea4516031d15ae85a742e" +checksum = "2c676a478f63e9fa2dd5368a42f28bba0d6c560b775f38583c8bbaa7fcd67c9c" [[package]] name = "bytemuck" -version = "1.7.3" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439989e6b8c38d1b6570a384ef1e49c8848128f5a97f3914baef02920842712f" +checksum = "2f5715e491b5a1598fc2bef5a606847b5dc1d48ea625bd3c02c00de8285591da" dependencies = [ "bytemuck_derive", ] [[package]] name = "bytemuck_derive" -version = "1.0.1" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e215f8c2f9f79cb53c8335e687ffd07d5bfcb6fe5fc80723762d0be46e7cc54" +checksum = "1b9e1f5fa78f69496407a27ae9ed989e3c3b072310286f5ef385525e4cbc24a9" dependencies = [ "proc-macro2", "quote", @@ -299,9 +302,9 @@ checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" [[package]] name = "bytes" -version = "1.1.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" +checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" [[package]] name = "bzip2" @@ -359,9 +362,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.72" +version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" [[package]] name = "cesu8" @@ -407,16 +410,16 @@ dependencies = [ [[package]] name = "clap" -version = "3.0.10" +version = "3.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a30c3bf9ff12dfe5dae53f0a96e0febcd18420d1c0e7fad77796d9d5c4b5375" +checksum = "b15f2ea93df33549dbe2e8eecd1ca55269d63ae0b3ba1f55db030817d1c2867f" dependencies = [ "atty", "bitflags", "clap_derive", + "clap_lex", "indexmap", - "lazy_static", - "os_str_bytes", + "once_cell", "strsim", "termcolor", "textwrap", @@ -424,9 +427,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "3.0.6" +version = "3.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "517358c28fcef6607bf6f76108e02afad7e82297d132a6b846dcc1fc3efcd153" +checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65" dependencies = [ "heck 0.4.0", "proc-macro-error", @@ -435,6 +438,15 @@ dependencies = [ "syn", ] +[[package]] +name = "clap_lex" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +dependencies = [ + "os_str_bytes", +] + [[package]] name = "cmake" version = "0.1.48" @@ -477,7 +489,7 @@ version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "615f6e27d000a2bffbc7f2f6a8669179378fa27ee4d0a509e985dfc0a7defb40" dependencies = [ - "getrandom 0.2.4", + "getrandom 0.2.7", "lazy_static", "proc-macro-hack", "tiny-keccak", @@ -495,89 +507,101 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" +[[package]] +name = "corosensei" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9847f90f32a50b0dcbd68bc23ff242798b13080b97b0569f6ed96a45ce4cf2cd" +dependencies = [ + "autocfg 1.1.0", + "cfg-if 1.0.0", + "libc", + "scopeguard", + "windows-sys 0.33.0", +] + [[package]] name = "cpufeatures" -version = "0.2.1" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469" +checksum = "dc948ebb96241bb40ab73effeb80d9f93afaad49359d159a5e61be51619fe813" dependencies = [ "libc", ] [[package]] name = "cranelift-bforest" -version = "0.76.0" +version = "0.82.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e6bea67967505247f54fa2c85cf4f6e0e31c4e5692c9b70e4ae58e339067333" +checksum = "38faa2a16616c8e78a18d37b4726b98bfd2de192f2fdc8a39ddf568a408a0f75" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.76.0" +version = "0.82.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48194035d2752bdd5bdae429e3ab88676e95f52a2b1355a5d4e809f9e39b1d74" +checksum = "26f192472a3ba23860afd07d2b0217dc628f21fcc72617aa1336d98e1671f33b" dependencies = [ "cranelift-bforest", "cranelift-codegen-meta", "cranelift-codegen-shared", "cranelift-entity", - "gimli 0.25.0", + "gimli", "log", "regalloc", "smallvec", - "target-lexicon 0.12.2", + "target-lexicon 0.12.4", ] [[package]] name = "cranelift-codegen-meta" -version = "0.76.0" +version = "0.82.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "976efb22fcab4f2cd6bd4e9913764616a54d895c1a23530128d04e03633c555f" +checksum = "0f32ddb89e9b89d3d9b36a5b7d7ea3261c98235a76ac95ba46826b8ec40b1a24" dependencies = [ "cranelift-codegen-shared", - "cranelift-entity", ] [[package]] name = "cranelift-codegen-shared" -version = "0.76.0" +version = "0.82.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dabb5fe66e04d4652e434195b45ae65b5c8172d520247b8f66d8df42b2b45dc" +checksum = "01fd0d9f288cc1b42d9333b7a776b17e278fc888c28e6a0f09b5573d45a150bc" [[package]] name = "cranelift-entity" -version = "0.76.0" +version = "0.82.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3329733e4d4b8e91c809efcaa4faee80bf66f20164e3dd16d707346bd3494799" +checksum = "9e3bfe172b83167604601faf9dc60453e0d0a93415b57a9c4d1a7ae6849185cf" [[package]] name = "cranelift-frontend" -version = "0.76.0" +version = "0.82.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "279afcc0d3e651b773f94837c3d581177b348c8d69e928104b2e9fccb226f921" +checksum = "a006e3e32d80ce0e4ba7f1f9ddf66066d052a8c884a110b91d05404d6ce26dce" dependencies = [ "cranelift-codegen", "log", "smallvec", - "target-lexicon 0.12.2", + "target-lexicon 0.12.4", ] [[package]] name = "crc32fast" -version = "1.3.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2209c310e29876f7f0b2721e7e26b84aff178aa3da5d091f9bfbf47669e60e3" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ "cfg-if 1.0.0", ] [[package]] name = "crossbeam-channel" -version = "0.5.2" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e54ea8bc3fb1ee042f5aace6e3c6e025d3874866da222930f70ce62aceba0bfa" +checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" dependencies = [ "cfg-if 1.0.0", "crossbeam-utils", @@ -585,9 +609,9 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" +checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" dependencies = [ "cfg-if 1.0.0", "crossbeam-epoch", @@ -596,25 +620,26 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.6" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97242a70df9b89a65d0b6df3c4bf5b9ce03c5b7309019777fbde37e7537f8762" +checksum = "045ebe27666471bb549370b4b0b3e51b07f56325befa4284db65fc89c02511b1" dependencies = [ + "autocfg 1.1.0", "cfg-if 1.0.0", "crossbeam-utils", - "lazy_static", "memoffset", + "once_cell", "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.6" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcae03edb34f947e64acdb1c33ec169824e20657e9ecb61cef6c8c74dcb8120" +checksum = "51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc" dependencies = [ "cfg-if 1.0.0", - "lazy_static", + "once_cell", ] [[package]] @@ -636,9 +661,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.13.1" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0d720b8683f8dd83c65155f0530560cba68cd2bf395f6513a483caee57ff7f4" +checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" dependencies = [ "darling_core", "darling_macro", @@ -646,9 +671,9 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.13.1" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a340f241d2ceed1deb47ae36c4144b2707ec7dd0b649f894cb39bb595986324" +checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" dependencies = [ "fnv", "ident_case", @@ -660,9 +685,9 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.13.1" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72c41b3b7352feb3211a0d743dc5700a4e3b60f51bd2b368892d1e0f9a95f44b" +checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" dependencies = [ "darling_core", "quote", @@ -709,24 +734,44 @@ checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" [[package]] name = "either" -version = "1.6.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" + +[[package]] +name = "enum-iterator" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4eeac5c5edb79e4e39fe8439ef35207780a11f69c52cbe424ce3dfad4cb78de6" +dependencies = [ + "enum-iterator-derive", +] + +[[package]] +name = "enum-iterator-derive" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c134c37760b27a871ba422106eedbb8247da973a09e82558bf26d619c882b159" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] [[package]] name = "enumset" -version = "1.0.8" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6216d2c19a6fb5f29d1ada1dc7bc4367a8cbf0fa4af5cf12e07b5bbdde6b5b2c" +checksum = "4799cdb24d48f1f8a7a98d06b7fde65a85a2d1e42b25a889f5406aa1fbefe074" dependencies = [ "enumset_derive", ] [[package]] name = "enumset_derive" -version = "0.5.5" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6451128aa6655d880755345d085494cf7561a6bee7c8dc821e5d77e6d267ecd4" +checksum = "ea83a3fbdc1d999ccfbcbee717eab36f8edf2d71693a23ce0d7cca19e085304c" dependencies = [ "darling", "proc-macro2", @@ -742,9 +787,9 @@ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] name = "fastrand" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" +checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" dependencies = [ "instant", ] @@ -772,9 +817,9 @@ dependencies = [ "nom_locate", "num-derive", "num-traits", - "parking_lot", + "parking_lot 0.11.2", "quill-common", - "rand 0.8.4", + "rand 0.8.5", "rand_pcg", "serde", "serde_json", @@ -834,12 +879,13 @@ dependencies = [ "libcraft-inventory", "libcraft-items", "log", - "parking_lot", + "parking_lot 0.11.2", "quill-common", - "rand 0.8.4", + "rand 0.8.5", "rayon", "smartstring", "uuid", + "vek", ] [[package]] @@ -884,7 +930,7 @@ dependencies = [ "feather-plugin-host-macros", "libloading", "log", - "paste 1.0.6", + "paste 1.0.8", "quill-common", "quill-plugin-format", "serde", @@ -922,7 +968,7 @@ dependencies = [ "libcraft-core", "libcraft-items", "num-traits", - "parking_lot", + "parking_lot 0.11.2", "quill-common", "serde", "thiserror", @@ -942,7 +988,6 @@ dependencies = [ "feather-base", "feather-common", "feather-ecs", - "feather-plugin-host", "feather-protocol", "feather-utils", "feather-worldgen", @@ -958,9 +1003,9 @@ dependencies = [ "num-bigint", "num-traits", "once_cell", - "parking_lot", + "parking_lot 0.11.2", "quill-common", - "rand 0.8.4", + "rand 0.8.5", "ring", "rsa", "rsa-der", @@ -968,7 +1013,7 @@ dependencies = [ "serde_json", "sha-1", "slab", - "time 0.3.6", + "time 0.3.14", "tokio", "toml", "ureq", @@ -998,49 +1043,47 @@ dependencies = [ [[package]] name = "fern" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9a4820f0ccc8a7afd67c39a0f1a0f4b07ca1725164271a64939d7aeb9af065" +checksum = "3bdd7b0849075e79ee9a1836df22c717d1eba30451796fdc631b04565dd11e2a" dependencies = [ "log", ] [[package]] name = "filetime" -version = "0.2.15" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "975ccf83d8d9d0d84682850a38c8169027be83368805971cc4f238c2b245bc98" +checksum = "e94a7bbaa59354bc20dd75b67f23e2797b4490e9d6928203fb105c79e448c86c" dependencies = [ "cfg-if 1.0.0", "libc", "redox_syscall", - "winapi", + "windows-sys 0.36.1", ] [[package]] name = "flate2" -version = "1.0.22" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e6988e897c1c9c485f43b47a529cef42fde0547f9d8d41a7062518f1d8fc53f" +checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" dependencies = [ - "cfg-if 1.0.0", "crc32fast", - "libc", "libz-sys", "miniz_oxide", ] [[package]] name = "flume" -version = "0.10.10" +version = "0.10.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d04dafd11240188e146b6f6476a898004cace3be31d4ec5e08e216bf4947ac0" +checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" dependencies = [ "futures-core", "futures-sink", "nanorand", "pin-project", - "spin 0.9.2", + "spin 0.9.4", ] [[package]] @@ -1067,15 +1110,15 @@ checksum = "1847abb9cb65d566acd5942e94aea9c8f547ad02c98e1649326fc0e8910b8b1e" [[package]] name = "futures-core" -version = "0.3.19" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c8ff0461b82559810cdccfde3215c3f373807f5e5232b71479bff7bb2583d7" +checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf" [[package]] name = "futures-io" -version = "0.3.19" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f9d34af5a1aac6fb380f735fe510746c38067c5bf16c7fd250280503c971b2" +checksum = "bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68" [[package]] name = "futures-lite" @@ -1094,9 +1137,9 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.19" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3055baccb68d74ff6480350f8d6eb8fcfa3aa11bdc1a1ae3afdd0514617d508" +checksum = "21b20ba5a92e727ba30e72834706623d94ac93a725410b6a6b6fbc1b07f7ba56" [[package]] name = "generational-arena" @@ -1109,9 +1152,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.5" +version = "0.14.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" +checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" dependencies = [ "typenum", "version_check", @@ -1130,34 +1173,28 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.4" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418d37c8b1d42553c93648be529cb70f920d3baf8ef469b74b9638df426e0b4c" +checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" dependencies = [ "cfg-if 1.0.0", "js-sys", "libc", - "wasi 0.10.0+wasi-snapshot-preview1", + "wasi 0.11.0+wasi-snapshot-preview1", "wasm-bindgen", ] [[package]] name = "gimli" -version = "0.25.0" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0a01e0497841a3b2db4f8afa483cce65f7e96a3498bd6c541734792aeac8fe7" +checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" dependencies = [ "fallible-iterator", "indexmap", "stable_deref_trait", ] -[[package]] -name = "gimli" -version = "0.26.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" - [[package]] name = "hashbrown" version = "0.9.1" @@ -1176,6 +1213,15 @@ dependencies = [ "ahash 0.7.6", ] +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash 0.7.6", +] + [[package]] name = "heck" version = "0.3.3" @@ -1238,12 +1284,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.8.0" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223" +checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" dependencies = [ - "autocfg 1.0.1", - "hashbrown 0.11.2", + "autocfg 1.1.0", + "hashbrown 0.12.3", "serde", ] @@ -1258,7 +1304,7 @@ dependencies = [ "libc", "llvm-sys", "once_cell", - "parking_lot", + "parking_lot 0.11.2", "regex", ] @@ -1293,15 +1339,15 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.1" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" +checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" [[package]] name = "js-sys" -version = "0.3.56" +version = "0.3.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38fc24e30fd564ce974c02bf1d337caddff65be6cc4735a1f7eab22a7440f04" +checksum = "258451ab10b34f8af53416d1fdab72c22e805f0c92a1136d59470ec0b11138b2" dependencies = [ "wasm-bindgen", ] @@ -1336,9 +1382,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.113" +version = "0.2.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eef78b64d87775463c549fbd80e19249ef436ea3bf1de2a1eb7e717ec7fab1e9" +checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" [[package]] name = "libcraft-blocks" @@ -1388,7 +1434,7 @@ name = "libcraft-inventory" version = "0.1.0" dependencies = [ "libcraft-items", - "parking_lot", + "parking_lot 0.11.2", ] [[package]] @@ -1446,15 +1492,15 @@ dependencies = [ [[package]] name = "libm" -version = "0.2.1" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" +checksum = "292a948cd991e376cf75541fe5b97a1081d713c618b4f1b9500f8844e49eb565" [[package]] name = "libz-sys" -version = "1.1.3" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de5435b8549c16d423ed0c03dbaafe57cf6c3344744f1242520d59c9d8ecec66" +checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" dependencies = [ "cc", "cmake", @@ -1465,9 +1511,9 @@ dependencies = [ [[package]] name = "llvm-sys" -version = "120.2.2" +version = "120.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4897352ffc39e1b2b3f7078b632222939044b76d3a99d36666c1c47203c104cc" +checksum = "09b716322964966a62377cf86e64f00ca7043505fdf27bd2ec7d41ae6682d1e7" dependencies = [ "cc", "lazy_static", @@ -1478,18 +1524,19 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.4.5" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109" +checksum = "9f80bf5aacaf25cbfc8210d1cfb718f2bf3b11c4c54e5afe36c236853a8ec390" dependencies = [ + "autocfg 1.1.0", "scopeguard", ] [[package]] name = "log" -version = "0.4.14" +version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ "cfg-if 1.0.0", ] @@ -1549,15 +1596,15 @@ dependencies = [ [[package]] name = "memchr" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memmap2" -version = "0.5.2" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe3179b85e1fd8b14447cbebadb75e45a1002f541b925f0bfec366d56a81c56d" +checksum = "95af15f345b17af2efc8ead6080fb8bc376f8cec1b35277b935637595fe77498" dependencies = [ "libc", ] @@ -1568,39 +1615,28 @@ version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" dependencies = [ - "autocfg 1.0.1", + "autocfg 1.1.0", ] [[package]] name = "miniz_oxide" -version = "0.4.4" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" +checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc" dependencies = [ "adler", - "autocfg 1.0.1", ] [[package]] name = "mio" -version = "0.7.14" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc" +checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" dependencies = [ "libc", "log", - "miow", - "ntapi", - "winapi", -] - -[[package]] -name = "miow" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" -dependencies = [ - "winapi", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.36.1", ] [[package]] @@ -1611,11 +1647,11 @@ checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389" [[package]] name = "nanorand" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "729eb334247daa1803e0a094d0a5c55711b85571179f5ec6e53eccfdf7008958" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" dependencies = [ - "getrandom 0.2.4", + "getrandom 0.2.7", ] [[package]] @@ -1640,22 +1676,13 @@ dependencies = [ "nom", ] -[[package]] -name = "ntapi" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" -dependencies = [ - "winapi", -] - [[package]] name = "num-bigint" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" dependencies = [ - "autocfg 1.0.1", + "autocfg 1.1.0", "num-integer", "num-traits", ] @@ -1666,14 +1693,14 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4547ee5541c18742396ae2c895d0717d0f886d8823b8399cdaf7b07d63ad0480" dependencies = [ - "autocfg 0.1.7", + "autocfg 0.1.8", "byteorder", "lazy_static", "libm", "num-integer", "num-iter", "num-traits", - "rand 0.8.4", + "rand 0.8.5", "smallvec", "zeroize", ] @@ -1691,32 +1718,32 @@ dependencies = [ [[package]] name = "num-integer" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ - "autocfg 1.0.1", + "autocfg 1.1.0", "num-traits", ] [[package]] name = "num-iter" -version = "0.1.42" +version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2021c8337a54d21aca0d59a92577a029af9431cb59b909b03252b9c164fad59" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" dependencies = [ - "autocfg 1.0.1", + "autocfg 1.1.0", "num-integer", "num-traits", ] [[package]] name = "num-traits" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ - "autocfg 1.0.1", + "autocfg 1.1.0", "libm", ] @@ -1732,24 +1759,34 @@ dependencies = [ [[package]] name = "num_threads" -version = "0.1.2" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71a1eb3a36534514077c1e079ada2fb170ef30c47d203aa6916138cf882ecd52" +checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" dependencies = [ "libc", ] [[package]] name = "object" -version = "0.27.1" +version = "0.28.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ac1d3f9a1d3616fd9a60c8d74296f22406a238b6a72f5cc1e6f314df4ffbf9" +checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424" dependencies = [ "crc32fast", + "hashbrown 0.11.2", "indexmap", "memchr", ] +[[package]] +name = "object" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" +dependencies = [ + "memchr", +] + [[package]] name = "observe-creativemode-flight-event" version = "0.1.0" @@ -1759,9 +1796,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.9.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" +checksum = "074864da206b4973b84eb91683020dbefd6a8c3f0f38e054d93954e891935e4e" [[package]] name = "opaque-debug" @@ -1783,12 +1820,9 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "6.0.0" +version = "6.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" -dependencies = [ - "memchr", -] +checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff" [[package]] name = "parking" @@ -1804,7 +1838,17 @@ checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", "lock_api", - "parking_lot_core", + "parking_lot_core 0.8.5", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core 0.9.3", ] [[package]] @@ -1821,6 +1865,19 @@ dependencies = [ "winapi", ] +[[package]] +name = "parking_lot_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "redox_syscall", + "smallvec", + "windows-sys 0.36.1", +] + [[package]] name = "particle-example" version = "0.1.0" @@ -1840,9 +1897,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0744126afe1a6dd7f394cb50a716dbe086cb06e255e53d8d0185d82828358fb5" +checksum = "9423e2b32f7a043629287a536f21951e8c6a82482d0acb1eeebfc90bc2225b22" [[package]] name = "paste-impl" @@ -1855,9 +1912,9 @@ dependencies = [ [[package]] name = "pem-rfc7468" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f22eb0e3c593294a99e9ff4b24cf6b752d43f193aa4415fe5077c159996d497" +checksum = "84e93a3b1cc0510b03020f33f21e62acdde3dcaef432edc95bea377fbd4c2cd4" dependencies = [ "base64ct", ] @@ -1870,27 +1927,28 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] name = "pest" -version = "2.1.3" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" +checksum = "4b0560d531d1febc25a3c9398a62a71256c0178f2e3443baedd9ad4bb8c9deb4" dependencies = [ + "thiserror", "ucd-trie", ] [[package]] name = "pin-project" -version = "1.0.10" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58ad3879ad3baf4e44784bc6a718a8698867bb991f8ce24d1bcbe2cfb4c3a75e" +checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.10" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "744b6f092ba29c3650faf274db506afd39944f48420f6c86b17cfe0ee1cb36bb" +checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" dependencies = [ "proc-macro2", "quote", @@ -1899,9 +1957,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" [[package]] name = "pkcs1" @@ -1929,9 +1987,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" +checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" [[package]] name = "plugin-macro" @@ -1992,11 +2050,11 @@ checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro2" -version = "1.0.36" +version = "1.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" +checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab" dependencies = [ - "unicode-xid", + "unicode-ident", ] [[package]] @@ -2010,7 +2068,7 @@ dependencies = [ "fern", "log", "pretty-hex", - "time 0.3.6", + "time 0.3.14", ] [[package]] @@ -2038,16 +2096,7 @@ name = "query-entities" version = "0.1.0" dependencies = [ "quill", - "rand 0.8.4", -] - -[[package]] -name = "quickcheck" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "588f6378e4dd99458b60ec275b4477add41ce4fa9f64dcba6f15adccb19b50d6" -dependencies = [ - "rand 0.8.4", + "rand 0.8.5", ] [[package]] @@ -2117,9 +2166,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.15" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145" +checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" dependencies = [ "proc-macro2", ] @@ -2140,19 +2189,18 @@ dependencies = [ "libc", "rand_chacha 0.2.2", "rand_core 0.5.1", - "rand_hc 0.2.0", + "rand_hc", ] [[package]] name = "rand" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha 0.3.1", "rand_core 0.6.3", - "rand_hc 0.3.1", ] [[package]] @@ -2190,7 +2238,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" dependencies = [ - "getrandom 0.2.4", + "getrandom 0.2.7", ] [[package]] @@ -2202,15 +2250,6 @@ dependencies = [ "rand_core 0.5.1", ] -[[package]] -name = "rand_hc" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" -dependencies = [ - "rand_core 0.6.3", -] - [[package]] name = "rand_pcg" version = "0.3.1" @@ -2231,11 +2270,11 @@ dependencies = [ [[package]] name = "rayon" -version = "1.5.1" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" +checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" dependencies = [ - "autocfg 1.0.1", + "autocfg 1.1.0", "crossbeam-deque", "either", "rayon-core", @@ -2243,31 +2282,30 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.9.1" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" +checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" dependencies = [ "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "lazy_static", "num_cpus", ] [[package]] name = "redox_syscall" -version = "0.2.10" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ "bitflags", ] [[package]] name = "regalloc" -version = "0.0.31" +version = "0.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571f7f397d61c4755285cd37853fe8e03271c243424a907415909379659381c5" +checksum = "62446b1d3ebf980bdc68837700af1d77b37bc430e524bf95319c6eada2a4cc02" dependencies = [ "log", "rustc-hash", @@ -2276,9 +2314,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.5.4" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" dependencies = [ "aho-corasick", "memchr", @@ -2287,9 +2325,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.25" +version = "0.6.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" [[package]] name = "region" @@ -2338,12 +2376,12 @@ dependencies = [ [[package]] name = "rkyv" -version = "0.7.29" +version = "0.7.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49a37de5dfc60bae2d94961dacd03c7b80e426b66a99fa1b17799570dbdd8f96" +checksum = "cec2b3485b07d96ddfd3134767b8a447b45ea4eb91448d0a35180ec0ffd5ed15" dependencies = [ "bytecheck", - "hashbrown 0.11.2", + "hashbrown 0.12.3", "ptr_meta", "rend", "rkyv_derive", @@ -2352,9 +2390,9 @@ dependencies = [ [[package]] name = "rkyv_derive" -version = "0.7.29" +version = "0.7.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719d447dd0e84b23cee6cb5b32d97e21efb112a3e3c636c8da36647b938475a1" +checksum = "6eaedadc88b53e36dd32d940ed21ae4d850d5916f2581526921f553a72ac34c4" dependencies = [ "proc-macro2", "quote", @@ -2376,7 +2414,7 @@ dependencies = [ "num-traits", "pkcs1", "pkcs8", - "rand 0.8.4", + "rand 0.8.5", "subtle", "zeroize", ] @@ -2417,14 +2455,14 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.4", + "semver 1.0.13", ] [[package]] name = "rustls" -version = "0.20.2" +version = "0.20.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d37e5e2290f3e040b594b1a9e04377c2c671f1a1cfd9bfdef82106ac1c113f84" +checksum = "5aab8ee6c7097ed6057f43c187a62418d0c05a4bd5f18b3571db50ee0f9ce033" dependencies = [ "log", "ring", @@ -2434,15 +2472,15 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f" +checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" [[package]] name = "ryu" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" +checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" [[package]] name = "scopeguard" @@ -2487,9 +2525,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.4" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "568a8e6258aa33c13358f81fd834adb854c6f7c9468520910a9b1e8fac068012" +checksum = "93f6841e709003d68bb2deee8c343572bf446003ec20a583e76f7b15cebf3711" [[package]] name = "semver-parser" @@ -2508,27 +2546,27 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.134" +version = "1.0.144" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96b3c34c1690edf8174f5b289a336ab03f568a4460d8c6df75f2f3a692b3bc6a" +checksum = "0f747710de3dcd43b88c9168773254e809d8ddbdf9653b84e2554ab219f17860" dependencies = [ "serde_derive", ] [[package]] name = "serde_bytes" -version = "0.11.5" +version = "0.11.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ae07dd2f88a366f15bd0632ba725227018c69a1c8550a927324f8eb8368bb9" +checksum = "cfc50e8183eeeb6178dcb167ae34a8051d63535023ae38b5d8d12beae193d37b" dependencies = [ "serde", ] [[package]] name = "serde_derive" -version = "1.0.134" +version = "1.0.144" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784ed1fbfa13fe191077537b0d70ec8ad1e903cfe04831da608aa36457cb653d" +checksum = "94ed3a816fb1d101812f83e789f888322c34e291f894f19590dc310963e87a00" dependencies = [ "proc-macro2", "quote", @@ -2537,9 +2575,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.77" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "651bca88044a8a5166bd0fd984a7ca558301079cf08365ca6287b2bb608cca3e" +checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44" dependencies = [ "itoa", "ryu", @@ -2548,29 +2586,28 @@ dependencies = [ [[package]] name = "serde_test" -version = "1.0.134" +version = "1.0.144" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2616dbe01183e562d89c3614f03818b0ae90c218ad149034d957436fb5cba3f4" +checksum = "6c7f3621491f256177206a7c2152c17f322c0d0b30af05359088172437d29e25" dependencies = [ "serde", ] [[package]] name = "serde_with" -version = "1.11.0" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad6056b4cb69b6e43e3a0f055def223380baecc99da683884f205bf347f7c4b3" +checksum = "678b5a069e50bf00ecd22d0cd8ddf7c236f68581b03db652061ed5eb13a312ff" dependencies = [ - "rustversion", "serde", "serde_with_macros", ] [[package]] name = "serde_with_macros" -version = "1.5.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12e47be9471c72889ebafb5e14d5ff930d89ae7a67bbdb5f8abb564f845a927e" +checksum = "e182d6ec6f05393cc0e5ed1bf81ad6db3a8feedf8ee515ecdd369809bcce8082" dependencies = [ "darling", "proc-macro2", @@ -2638,43 +2675,56 @@ name = "simple-plugin" version = "0.1.0" dependencies = [ "quill", - "rand 0.8.4", + "rand 0.8.5", ] [[package]] name = "simple_asn1" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a762b1c38b9b990c694b9c2f8abe3372ce6a9ceaae6bca39cfc46e054f45745" +checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" dependencies = [ "num-bigint", "num-traits", "thiserror", - "time 0.3.6", + "time 0.3.14", ] [[package]] name = "slab" -version = "0.4.5" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5" +checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +dependencies = [ + "autocfg 1.1.0", +] [[package]] name = "smallvec" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" +checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" [[package]] name = "smartstring" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31aa6a31c0c2b21327ce875f7e8952322acfcfd0c27569a6e18a647281352c9b" +checksum = "e714dff2b33f2321fdcd475b71cec79781a692d846f37f415fb395a1d2bcd48e" dependencies = [ "serde", "static_assertions", ] +[[package]] +name = "socket2" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10c98bba371b9b22a71a9414e420f92ddeb2369239af08200816169d5e2dd7aa" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "spin" version = "0.5.2" @@ -2683,9 +2733,9 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "spin" -version = "0.9.2" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "511254be0c5bcf062b019a6c89c01a664aa359ded62f78aa72c6fc137c0590e5" +checksum = "7f6002a767bff9e83f8eeecf883ecb8011875a21ae8da43bffb817a57e78cc09" dependencies = [ "lock_api", ] @@ -2801,13 +2851,13 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.86" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a65b3f4ffa0092e9887669db0eae07941f023991ab58ea44da8fe8e2d511c6b" +checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13" dependencies = [ "proc-macro2", "quote", - "unicode-xid", + "unicode-ident", ] [[package]] @@ -2847,9 +2897,9 @@ checksum = "422045212ea98508ae3d28025bc5aaa2bd4a9cdaecd442a08da2ee620ee9ea95" [[package]] name = "target-lexicon" -version = "0.12.2" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9bffcddbc2458fa3e6058414599e3c838a022abae82e5c67b4f7f80298d5bff" +checksum = "c02424087780c9b71cc96799eaeddff35af2bc513278cda5c99fc1f5d026d3c1" [[package]] name = "tempfile" @@ -2867,33 +2917,33 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" dependencies = [ "winapi-util", ] [[package]] name = "textwrap" -version = "0.14.2" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80" +checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" [[package]] name = "thiserror" -version = "1.0.30" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417" +checksum = "f5f6586b7f764adc0231f4c79be7b920e766bb2f3e51b3661cdb263828f19994" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.30" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" +checksum = "12bafc5b54507e0149cdf1b145a5d80ab80a90bcd9275df43d4fff68460f6c21" dependencies = [ "proc-macro2", "quote", @@ -2917,15 +2967,14 @@ dependencies = [ [[package]] name = "time" -version = "0.3.6" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8d54b9298e05179c335de2b9645d061255bcd5155f843b3e328d2cfe0a5b413" +checksum = "3c3f9a28b618c3a6b9251b6908e9c99e04b9e5c02e6581ccbb67d59c34ef7f9b" dependencies = [ "itoa", "libc", "num_threads", - "quickcheck", - "time-macros 0.2.3", + "time-macros 0.2.4", ] [[package]] @@ -2940,9 +2989,9 @@ dependencies = [ [[package]] name = "time-macros" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25eb0ca3468fc0acc11828786797f6ef9aa1555e4a211a60d64cc8e4d1be47d6" +checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792" [[package]] name = "time-macros-impl" @@ -2968,9 +3017,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.5.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" dependencies = [ "tinyvec_macros", ] @@ -2990,28 +3039,30 @@ dependencies = [ [[package]] name = "tokio" -version = "1.15.0" +version = "1.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbbf1c778ec206785635ce8ad57fe52b3009ae9e0c9f574a728f3049d3e55838" +checksum = "7a8325f63a7d4774dd041e363b2409ed1c5cbbd0f867795e661df066b2b0a581" dependencies = [ - "bytes 1.1.0", + "autocfg 1.1.0", + "bytes 1.2.1", "libc", "memchr", "mio", "num_cpus", "once_cell", - "parking_lot", + "parking_lot 0.12.1", "pin-project-lite", "signal-hook-registry", + "socket2", "tokio-macros", "winapi", ] [[package]] name = "tokio-macros" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" +checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" dependencies = [ "proc-macro2", "quote", @@ -3020,18 +3071,18 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.8" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" dependencies = [ "serde", ] [[package]] name = "tracing" -version = "0.1.29" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "375a639232caf30edfc78e8d89b2d4c375515393e7af7e16f01cd96917fb2105" +checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307" dependencies = [ "cfg-if 1.0.0", "log", @@ -3042,9 +3093,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.18" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f480b8f81512e825f337ad51e94c1eb5d3bbdf2b363dcd01e2b19a9ffe3f8e" +checksum = "11c75893af559bc8e10716548bdef5cb2b983f8e637db9d0e15126b61b484ee2" dependencies = [ "proc-macro2", "quote", @@ -3053,11 +3104,11 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.21" +version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4ed65637b8390770814083d20756f87bfa2c21bf2f110babdc5438351746e4" +checksum = "5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7" dependencies = [ - "lazy_static", + "once_cell", ] [[package]] @@ -3068,36 +3119,42 @@ checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" [[package]] name = "ucd-trie" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" +checksum = "89570599c4fe5585de2b388aab47e99f7fa4e9238a1399f707a02e356058141c" [[package]] name = "unicode-bidi" -version = "0.3.7" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" + +[[package]] +name = "unicode-ident" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" +checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf" [[package]] name = "unicode-normalization" -version = "0.1.19" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" +checksum = "854cbdc4f7bc6ae19c820d44abdc3277ac3e1b2b93db20a636825d9322fb60e6" dependencies = [ "tinyvec", ] [[package]] name = "unicode-segmentation" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" +checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" [[package]] name = "unicode-xid" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" +checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" [[package]] name = "untrusted" @@ -3107,9 +3164,9 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "ureq" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9399fa2f927a3d327187cbd201480cee55bee6ac5d3c77dd27f0c6814cff16d5" +checksum = "b97acb4c28a254fd7a4aeec976c46a7fa404eac4d7c134b30c75144846d7cb8f" dependencies = [ "base64", "chunked_transfer", @@ -3142,7 +3199,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" dependencies = [ - "getrandom 0.2.4", + "getrandom 0.2.7", "serde", ] @@ -3192,15 +3249,15 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.79" +version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06" +checksum = "fc7652e3f6c4706c8d9cd54832c4a4ccb9b5336e2c3bd154d5cccfbf1c1f5f7d" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -3208,13 +3265,13 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.79" +version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b21c0df030f5a177f3cba22e9bc4322695ec43e7257d865302900290bcdedca" +checksum = "662cd44805586bd52971b9586b1df85cdbbd9112e4ef4d8f41559c334dc6ac3f" dependencies = [ "bumpalo", - "lazy_static", "log", + "once_cell", "proc-macro2", "quote", "syn", @@ -3223,9 +3280,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.79" +version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01" +checksum = "b260f13d3012071dfb1512849c033b1925038373aea48ced3012c09df952c602" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3233,9 +3290,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.79" +version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc" +checksum = "5be8e654bdd9b79216c2929ab90721aa82faf65c48cdf08bdc4e7f51357b80da" dependencies = [ "proc-macro2", "quote", @@ -3246,24 +3303,25 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.79" +version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2" +checksum = "6598dd0bd3c7d51095ff6531a5b23e02acdc81804e30d8f07afb77b7215a140a" [[package]] name = "wasmer" -version = "2.1.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23f0188c23fc1b7de9bd7f8b834d0b1cd5edbe66e287452e8ce36d24418114f7" +checksum = "ea8d8361c9d006ea3d7797de7bd6b1492ffd0f91a22430cfda6c1658ad57bedf" dependencies = [ "cfg-if 1.0.0", "indexmap", "js-sys", "loupe", "more-asserts", - "target-lexicon 0.12.2", + "target-lexicon 0.12.4", "thiserror", "wasm-bindgen", + "wasmer-artifact", "wasmer-compiler", "wasmer-compiler-cranelift", "wasmer-compiler-llvm", @@ -3276,11 +3334,24 @@ dependencies = [ "winapi", ] +[[package]] +name = "wasmer-artifact" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aaf9428c29c1d8ad2ac0e45889ba8a568a835e33fd058964e5e500f2f7ce325" +dependencies = [ + "enumset", + "loupe", + "thiserror", + "wasmer-compiler", + "wasmer-types", +] + [[package]] name = "wasmer-compiler" -version = "2.1.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88c51cc589772c5f90bd329244c2416976d6cb2ee00d59429aaa8f421d9fe447" +checksum = "e67a6cd866aed456656db2cfea96c18baabbd33f676578482b85c51e1ee19d2c" dependencies = [ "enumset", "loupe", @@ -3288,39 +3359,37 @@ dependencies = [ "serde", "serde_bytes", "smallvec", - "target-lexicon 0.12.2", + "target-lexicon 0.12.4", "thiserror", "wasmer-types", - "wasmer-vm", "wasmparser", ] [[package]] name = "wasmer-compiler-cranelift" -version = "2.1.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09691e3e323b4e1128d2127f60f9cd988b66ce49afc8184b071c2b5ab16793f2" +checksum = "48be2f9f6495f08649e4f8b946a2cbbe119faf5a654aa1457f9504a99d23dae0" dependencies = [ "cranelift-codegen", "cranelift-entity", "cranelift-frontend", - "gimli 0.25.0", + "gimli", "loupe", "more-asserts", "rayon", "smallvec", - "target-lexicon 0.12.2", + "target-lexicon 0.12.4", "tracing", "wasmer-compiler", "wasmer-types", - "wasmer-vm", ] [[package]] name = "wasmer-compiler-llvm" -version = "2.1.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0de51c7fcf88c86c1ba050dfe1dd8fe3613ad1072a58b07a8c50148145cee249" +checksum = "dd69f50825c69be2efb71e3059a3222de6e5d06552da51907cac761f701bde83" dependencies = [ "byteorder", "cc", @@ -3329,13 +3398,13 @@ dependencies = [ "lazy_static", "libc", "loupe", - "object", + "object 0.28.4", "rayon", "regex", "rustc_version 0.4.0", - "semver 1.0.4", + "semver 1.0.13", "smallvec", - "target-lexicon 0.12.2", + "target-lexicon 0.12.4", "wasmer-compiler", "wasmer-types", "wasmer-vm", @@ -3343,9 +3412,9 @@ dependencies = [ [[package]] name = "wasmer-derive" -version = "2.1.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f5cb7b09640e09f1215da95d6fb7477d2db572f064b803ff705f39ff079cc5" +checksum = "00e50405cc2a2f74ff574584710a5f2c1d5c93744acce2ca0866084739284b51" dependencies = [ "proc-macro-error", "proc-macro2", @@ -3355,9 +3424,9 @@ dependencies = [ [[package]] name = "wasmer-engine" -version = "2.1.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab20311c354fe2c12bc766417e0a1a45f399c1cd8ff262127d1dc86d0588971a" +checksum = "3f98f010978c244db431b392aeab0661df7ea0822343334f8f2a920763548e45" dependencies = [ "backtrace", "enumset", @@ -3368,8 +3437,9 @@ dependencies = [ "rustc-demangle", "serde", "serde_bytes", - "target-lexicon 0.12.2", + "target-lexicon 0.12.4", "thiserror", + "wasmer-artifact", "wasmer-compiler", "wasmer-types", "wasmer-vm", @@ -3377,19 +3447,22 @@ dependencies = [ [[package]] name = "wasmer-engine-dylib" -version = "2.1.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dd5b7a74731e1dcccaf10a8ff5f72216c82f12972ce17cc81c6caa1afff75ea" +checksum = "ad0358af9c154724587731175553805648d9acb8f6657880d165e378672b7e53" dependencies = [ "cfg-if 1.0.0", + "enum-iterator", "enumset", "leb128", "libloading", "loupe", + "object 0.28.4", "rkyv", "serde", "tempfile", "tracing", + "wasmer-artifact", "wasmer-compiler", "wasmer-engine", "wasmer-object", @@ -3400,9 +3473,9 @@ dependencies = [ [[package]] name = "wasmer-engine-universal" -version = "2.1.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfeae8d5b825ad7abcf9a34e66eb11e1507b21020efe7bbf9897e3dd8d7869e2" +checksum = "440dc3d93c9ca47865a4f4edd037ea81bf983b5796b59b3d712d844b32dbef15" dependencies = [ "cfg-if 1.0.0", "enumset", @@ -3412,18 +3485,35 @@ dependencies = [ "rkyv", "wasmer-compiler", "wasmer-engine", + "wasmer-engine-universal-artifact", "wasmer-types", "wasmer-vm", "winapi", ] +[[package]] +name = "wasmer-engine-universal-artifact" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f1db3f54152657eb6e86c44b66525ff7801dad8328fe677da48dd06af9ad41" +dependencies = [ + "enum-iterator", + "enumset", + "loupe", + "rkyv", + "thiserror", + "wasmer-artifact", + "wasmer-compiler", + "wasmer-types", +] + [[package]] name = "wasmer-object" -version = "2.1.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d4714e4f3bdc3b2157c24284417d19cd99de036da31d00ec5664712dcb72f7" +checksum = "8d831335ff3a44ecf451303f6f891175c642488036b92ceceb24ac8623a8fa8b" dependencies = [ - "object", + "object 0.28.4", "thiserror", "wasmer-compiler", "wasmer-types", @@ -3431,12 +3521,15 @@ dependencies = [ [[package]] name = "wasmer-types" -version = "2.1.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "434e1c0177da0a74ecca90b2aa7d5e86198260f07e8ba83be89feb5f0a4aeead" +checksum = "39df01ea05dc0a9bab67e054c7cb01521e53b35a7bb90bd02eca564ed0b2667f" dependencies = [ + "backtrace", + "enum-iterator", "indexmap", "loupe", + "more-asserts", "rkyv", "serde", "thiserror", @@ -3444,9 +3537,9 @@ dependencies = [ [[package]] name = "wasmer-vfs" -version = "2.1.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a3a58a3700781aa4f5344915ea082086e75ba7ebe294f60ae499614db92dd00" +checksum = "9302eae3edc53cb540c2d681e7f16d8274918c1ce207591f04fed351649e97c0" dependencies = [ "libc", "thiserror", @@ -3455,35 +3548,41 @@ dependencies = [ [[package]] name = "wasmer-vm" -version = "2.1.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc8f964ebba70d9f81340228b98a164782591f00239fc7f01e1b67afcf0e0156" +checksum = "30d965fa61f4dc4cdb35a54daaf7ecec3563fbb94154a6c35433f879466247dd" dependencies = [ "backtrace", "cc", "cfg-if 1.0.0", + "corosensei", + "enum-iterator", "indexmap", + "lazy_static", "libc", "loupe", + "mach", "memoffset", "more-asserts", "region", "rkyv", + "scopeguard", "serde", "thiserror", + "wasmer-artifact", "wasmer-types", "winapi", ] [[package]] name = "wasmer-wasi" -version = "2.1.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c2b1d981ad312dac6e74a41a35b9bca41a6d1157c3e6a575fb1041e4b516610" +checksum = "fadbe31e3c1b6f3e398ad172b169152ae1a743ae6efd5f9ffb34019983319d99" dependencies = [ "cfg-if 1.0.0", "generational-arena", - "getrandom 0.2.4", + "getrandom 0.2.7", "libc", "thiserror", "tracing", @@ -3496,9 +3595,9 @@ dependencies = [ [[package]] name = "wasmer-wasi-types" -version = "2.1.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7731240c0ae536623414beb73091dddf68d1a080f49086fc31ec916536b1af98" +checksum = "22dc83aadbdf97388de3211cb6f105374f245a3cf2a5c65a16776e7a087a8468" dependencies = [ "byteorder", "time 0.2.27", @@ -3507,15 +3606,15 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.78.2" +version = "0.83.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52144d4c78e5cf8b055ceab8e5fa22814ce4315d6002ad32cfd914f37c12fd65" +checksum = "718ed7c55c2add6548cca3ddd6383d738cd73b892df400e96b9aa876f0141d7a" [[package]] name = "web-sys" -version = "0.3.56" +version = "0.3.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c060b319f29dd25724f09a2ba1418f142f539b2be99fbf4d2d5a8f7330afb8eb" +checksum = "ed055ab27f941423197eb86b2035720b1a3ce40504df082cac2ecc6ed73335a1" dependencies = [ "js-sys", "wasm-bindgen", @@ -3533,18 +3632,18 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.22.2" +version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "552ceb903e957524388c4d3475725ff2c8b7960922063af6ce53c9a43da07449" +checksum = "f1c760f0d366a6c24a02ed7816e23e691f5d92291f94d15e836006fd11b04daf" dependencies = [ "webpki", ] [[package]] name = "which" -version = "4.2.2" +version = "4.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea187a8ef279bc014ec368c27a920da2024d2a711109bfbe3440585d5cf27ad9" +checksum = "5c4fb54e6113b6a8772ee41c3404fb0301ac79604489467e0a9ce1f3e97c24ae" dependencies = [ "either", "lazy_static", @@ -3582,6 +3681,92 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43dbb096663629518eb1dfa72d80243ca5a6aca764cae62a2df70af760a9be75" +dependencies = [ + "windows_aarch64_msvc 0.33.0", + "windows_i686_gnu 0.33.0", + "windows_i686_msvc 0.33.0", + "windows_x86_64_gnu 0.33.0", + "windows_x86_64_msvc 0.33.0", +] + +[[package]] +name = "windows-sys" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +dependencies = [ + "windows_aarch64_msvc 0.36.1", + "windows_i686_gnu 0.36.1", + "windows_i686_msvc 0.36.1", + "windows_x86_64_gnu 0.36.1", + "windows_x86_64_msvc 0.36.1", +] + +[[package]] +name = "windows_aarch64_msvc" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd761fd3eb9ab8cc1ed81e56e567f02dd82c4c837e48ac3b2181b9ffc5060807" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" + +[[package]] +name = "windows_i686_gnu" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab0cf703a96bab2dc0c02c0fa748491294bf9b7feb27e1f4f96340f208ada0e" + +[[package]] +name = "windows_i686_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" + +[[package]] +name = "windows_i686_msvc" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cfdbe89cc9ad7ce618ba34abc34bbb6c36d99e96cae2245b7943cd75ee773d0" + +[[package]] +name = "windows_i686_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4dd9b0c0e9ece7bb22e84d70d01b71c6d6248b81a3c60d11869451b4cb24784" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff1e4aa646495048ec7f3ffddc411e1d829c026a2ec62b39da15c1055e406eaa" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" + [[package]] name = "wyz" version = "0.2.0" @@ -3590,9 +3775,9 @@ checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" [[package]] name = "xattr" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" +checksum = "6d1526bbe5aaeb5eb06885f4d987bcdfa5e23187055de9b83fe00156a821fabc" dependencies = [ "libc", ] @@ -3608,9 +3793,9 @@ dependencies = [ [[package]] name = "zeroize_derive" -version = "1.3.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81e8f13fef10b63c06356d65d416b070798ddabcadc10d3ece0c5be9b3c7eddb" +checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index d133b40c5..4d1a0d5a4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,5 @@ [workspace] +resolver = "2" members = [ # libcraft "libcraft/core", diff --git a/feather/base/src/anvil/level.rs b/feather/base/src/anvil/level.rs index b312e5de3..5411093a4 100644 --- a/feather/base/src/anvil/level.rs +++ b/feather/base/src/anvil/level.rs @@ -149,7 +149,7 @@ pub struct SuperflatLayer { } /// The type of world generator for a level. -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub enum LevelGeneratorType { Default, Flat, diff --git a/feather/blocks/generator/src/lib.rs b/feather/blocks/generator/src/lib.rs index b5b8fbd84..bd48b2ff3 100644 --- a/feather/blocks/generator/src/lib.rs +++ b/feather/blocks/generator/src/lib.rs @@ -369,7 +369,8 @@ fn generate_block_fns(blocks: &Blocks) -> TokenStream { } for (name, value) in default_state { - doc.push_str(&format!("* `{}`: {}\n", name, value)); + use core::fmt::Write as _; + let _ = writeln!(doc, "* `{}`: {}", name, value); } fns.push(quote! { diff --git a/feather/blocks/generator/src/load.rs b/feather/blocks/generator/src/load.rs index 10bd98909..390e0bbee 100644 --- a/feather/blocks/generator/src/load.rs +++ b/feather/blocks/generator/src/load.rs @@ -133,7 +133,7 @@ impl PropertyStore { fn update_name(name: &str) -> &str { match NAME_OVERRIDES.get(&name) { - Some(x) => *x, + Some(x) => x, None => name, } } diff --git a/feather/common/Cargo.toml b/feather/common/Cargo.toml index a371549d5..43289cde8 100644 --- a/feather/common/Cargo.toml +++ b/feather/common/Cargo.toml @@ -23,4 +23,5 @@ libcraft-inventory = { path = "../../libcraft/inventory" } libcraft-items = { path = "../../libcraft/items" } rayon = "1.5" worldgen = { path = "../worldgen", package = "feather-worldgen" } -rand = "0.8" \ No newline at end of file +rand = "0.8" +vek = "0.14" \ No newline at end of file diff --git a/feather/common/src/block/mod.rs b/feather/common/src/block/mod.rs new file mode 100644 index 000000000..e37e26716 --- /dev/null +++ b/feather/common/src/block/mod.rs @@ -0,0 +1,13 @@ +use ecs::SystemExecutor; + +use crate::Game; + +pub mod placement; +pub mod update; +pub mod util; +pub mod wall; + +pub fn register(systems: &mut SystemExecutor) { + systems.add_system(placement::block_placement); + systems.add_system(update::block_update); +} diff --git a/feather/common/src/block/placement.rs b/feather/common/src/block/placement.rs new file mode 100644 index 000000000..e779e2327 --- /dev/null +++ b/feather/common/src/block/placement.rs @@ -0,0 +1,622 @@ +use std::convert::TryInto; + +use super::util::{is_door, AdjacentBlockHelper}; +use super::wall::update_wall_connections; +use crate::chunk::entities::ChunkEntities; +use crate::entities::player::HotbarSlot; +use crate::events::BlockChangeEvent; +use crate::{Game, World}; +use base::{ + Area, BlockId, BlockPosition, Face, FacingCardinal, FacingCardinalAndDown, FacingCubic, + Gamemode, HalfTopBottom, HalfUpperLower, Hinge, Inventory, Item, ItemStack, Position, + SimplifiedBlockKind, SlabKind, Vec3d, +}; +use blocks::BlockKind; +use ecs::{Ecs, SysResult}; +use libcraft_core::{BlockFace, EntityKind}; +use libcraft_items::InventorySlot; +use quill_common::components::CanBuild; +use quill_common::events::BlockPlacementEvent; +use utils::continue_on_none; +use vek::Rect3; +/// A system that handles block placement events. +pub fn block_placement(game: &mut Game) -> SysResult { + let mut events = vec![]; + for (_, (event, gamemode, inv, hotbar, player_pos, can_build)) in game + .ecs + .query::<( + &BlockPlacementEvent, + &Gamemode, + &mut Inventory, + &HotbarSlot, + &Position, + &CanBuild, + )>() + .iter() + { + // Get selected slot + let mut slot = match event.hand { + libcraft_core::Hand::Main => inv.item(Area::Hotbar, hotbar.get()), + libcraft_core::Hand::Offhand => inv.item(Area::Offhand, 0), + } + .unwrap(); + // Check that the player has an item in hand and can build + if !can_build.0 || slot.is_empty() { + continue; + } + let block = continue_on_none!(item_to_block(slot.item_kind().unwrap())); + continue_on_none!(place_block( + &mut game.world, + &game.chunk_entities, + &game.ecs, + *player_pos, + block, + event, + 0, + &mut events + )); + if matches!(*gamemode, Gamemode::Survival | Gamemode::Adventure) { + decrease_slot(&mut slot) + } + } + for e in events { + game.ecs.insert_event(e); + } + Ok(()) +} +/// Check if the block has a bed portion that can be placed placed in the world. `None` means that while the block has a head, it cannot be placed +fn should_place_bed_head( + world: &World, + block: BlockId, + placement_pos: BlockPosition, +) -> Option { + if bed_head(block).is_none() { + return Some(false); + } + if world + .adjacent_block_cardinal(placement_pos, block.facing_cardinal()?)? + .is_replaceable() + { + Some(true) + } else { + None + } +} +/// Check if the block has an upper half that can be placed in the world. `None` means that while the block has an upper half, it cannot be placed +fn should_place_upper_half( + world: &World, + block: BlockId, + placement_pos: BlockPosition, +) -> Option { + if top_half(block).is_none() { + return Some(false); + } + if world.block_at(placement_pos.up())?.is_replaceable() { + Some(true) + } else { + None + } +} +/// Check if the block collides with any entity. +/// This works but there is a discrepancy between when the place block event is fired and getting the entity location. +/// that makes it possible to place a block at the right exact moment and have the server believe it wasn't blocked. +fn entity_collisions_ok( + chunk_entities: &ChunkEntities, + ecs: &Ecs, + placement_pos: BlockPosition, +) -> bool { + !chunk_entities + .entities_in_chunk(placement_pos.chunk()) + .iter() + .any(|&entity| { + let entity_position = ecs.get::(entity).unwrap(); + let entity_kind = *ecs.get::(entity).unwrap(); + let block_rect: Rect3 = vek::Rect3 { + x: placement_pos.x.into(), + y: placement_pos.y.into(), + z: placement_pos.z.into(), + w: 1.0, + h: 1.0, + d: 1.0, + }; + + let mut entity_rect = entity_kind.bounding_box().into_rect3(); + entity_rect.x = entity_position.x - (entity_rect.w / 2.0); + entity_rect.y = entity_position.y; + entity_rect.z = entity_position.z - (entity_rect.d / 2.0); + + block_rect.collides_with_rect3(entity_rect) + }) +} +/// Place multiple blocks and generate corresponding events. +fn multi_place( + world: &mut World, + placements: &[(BlockId, BlockPosition)], + event_buffer: &mut Vec, +) { + for &(block, pos) in placements { + event_buffer.push(BlockChangeEvent::single( + pos.try_into().expect("valid block positions only"), + )); + assert!(world.set_block_at(pos, block), "block has to be loaded"); + } +} +/// Try placing the block by merging (=placing to the same position as the target block). Includes merging slabs, waterlogging and replacing blocks like grass. +/// Only one of the following conditions can be met at a time, so short-circuiting is ok. +/// The combinations include top slab & bottom slab, waterloggable block & water and any block & a replaceable block +fn basic_place(block: &mut BlockId, target_block: BlockId) -> bool { + merge_slabs_in_place(block, target_block) + || waterlog(block, target_block) + || can_replace(*block, target_block) +} +/// Check if `block` can replace `target`. +fn can_replace(block: BlockId, target: BlockId) -> bool { + (block.kind() != target.kind()) && target.is_replaceable() +} +/// Blocks get changed if they are getting waterlogged or when they are slabs turning into full blocks. +/// Blocks get replaced in-place when possible, while changing an adjacent block has a lower priority. +#[allow(clippy::too_many_arguments)] +fn place_block( + world: &mut World, + chunk_entities: &ChunkEntities, + ecs: &Ecs, + player_pos: Position, + mut block: BlockId, + placement: &BlockPlacementEvent, + light_level: u8, + event_buffer: &mut Vec, +) -> Option<()> { + let target1 = placement.location; + let target_block1 = world.block_at(target1)?; + let target2 = target1.adjacent(placement.face); + let target_block2 = world.block_at(target2); + // Cannot build on air + if target_block1.is_air() { + return None; + } + let player_dir_ordered = ordered_directions(player_pos.direction()); + slab_to_place(&mut block, target_block1, placement); + // Select where to place the block + let target = if basic_place(&mut block, target_block1) { + target1 + } else if basic_place(&mut block, target_block2?) { + target2 + } else { + // Cannot place block + return None; + }; + set_face(&mut block, &player_dir_ordered, placement); + rotate_8dir(&mut block, player_pos.yaw); + door_hinge(&mut block, target, &placement.cursor_position, world); + if !entity_collisions_ok(chunk_entities, ecs, target) + || !world.check_block_stability(block, target, light_level)? + { + return None; + } + let primary_placement = (block, target); + if should_place_upper_half(world, block, target)? { + let secondary_placement = ( + block.with_half_upper_lower(HalfUpperLower::Upper), + target.up(), + ); + multi_place( + world, + &[primary_placement, secondary_placement], + event_buffer, + ) + } else if should_place_bed_head(world, block, target)? { + let face = match block.facing_cardinal()? { + FacingCardinal::North => BlockFace::North, + FacingCardinal::South => BlockFace::South, + FacingCardinal::West => BlockFace::West, + FacingCardinal::East => BlockFace::East, + }; + let secondary_placement = (block.with_part(base::Part::Head), target.adjacent(face)); + multi_place( + world, + &[primary_placement, secondary_placement], + event_buffer, + ) + } else { + multi_place(world, &[primary_placement], event_buffer); + }; + update_wall_connections(world, target).unwrap(); + Some(()) +} +/// Sets the hinge position on a door block. The door attempts to connect to other doors first, then to solid blocks. Otherwise, the hinge position is determined by the click position. +#[allow(clippy::float_cmp)] +fn door_hinge( + block: &mut BlockId, + pos: BlockPosition, + cursor_pos: &[f32], + world: &World, +) -> Option<()> { + let cardinal = block.facing_cardinal()?; + let left = cardinal.left(); + let right = cardinal.right(); + let lb = world.adjacent_block_cardinal(pos, left)?; + let rb = world.adjacent_block_cardinal(pos, right)?; + if is_door(lb) && lb.kind() == block.kind() { + block.set_hinge(Hinge::Right); + return Some(()); + } + if is_door(rb) && rb.kind() == block.kind() { + block.set_hinge(Hinge::Left); + return Some(()); + } + let lt = world.adjacent_block_cardinal(pos.up(), left)?; + let rt = world.adjacent_block_cardinal(pos.up(), right)?; + let solid_left = is_block_solid(lb) || is_block_solid(lt); + let solid_right = is_block_solid(rb) || is_block_solid(rt); + if solid_left && !solid_right { + block.set_hinge(Hinge::Left); + return Some(()); + } + if solid_right && !solid_left { + block.set_hinge(Hinge::Right); + return Some(()); + } + let relevant_axis = match cardinal { + FacingCardinal::North => cursor_pos[0], + FacingCardinal::South => 1.0 - cursor_pos[0], + FacingCardinal::West => 1.0 - cursor_pos[2], + FacingCardinal::East => cursor_pos[2], + }; + let hinge = if relevant_axis < 0.5 { + Hinge::Left + } else { + Hinge::Right + }; + block.set_hinge(hinge); + Some(()) +} + +fn is_block_solid(block: BlockId) -> bool { + block.is_solid() + && !matches!( + block.slab_kind(), + Some(SlabKind::Bottom) | Some(SlabKind::Top) + ) +} + +/// Gets the top half of the block. Works with doors, flowers, tall grass etc. +fn top_half(block: BlockId) -> Option { + if block.has_half_upper_lower() { + Some(block.with_half_upper_lower(HalfUpperLower::Upper)) + } else { + None + } +} + +/// If applicable, this function returns a matching bed head to its foot part. +fn bed_head(block: BlockId) -> Option { + if block.has_part() { + Some(block.with_part(base::Part::Head)) + } else { + None + } +} + +/// If applicable, rotates 8-directional blocks like banners and signs. The yaw is a property of the placing entity. +fn rotate_8dir(block: &mut BlockId, yaw: f32) { + block.set_rotation(((yaw + 180.0) / 22.5).round() as i32); +} + +/// Orders all the cubic directions(`FacingCubic`) by how well they represent the direction. +pub fn ordered_directions(direction: Vec3d) -> [FacingCubic; 6] { + let x_dir = if direction[0] > 0.0 { + FacingCubic::East + } else { + FacingCubic::West + }; + let y_dir = if direction[1] > 0.0 { + FacingCubic::Up + } else { + FacingCubic::Down + }; + let z_dir = if direction[2] > 0.0 { + FacingCubic::South + } else { + FacingCubic::North + }; + let abs_x = direction[0].abs(); + let abs_y = direction[1].abs(); + let abs_z = direction[2].abs(); + let t = match (abs_x > abs_y, abs_y > abs_z, abs_z > abs_x) { + (true, true, true) => unreachable!(), + (true, true, false) => [x_dir, y_dir, z_dir], // 2 1 0 + (true, false, true) => [z_dir, x_dir, y_dir], // 1 0 2 + (true, false, false) => [x_dir, z_dir, y_dir], // 2 0 1 + (false, true, true) => [y_dir, z_dir, x_dir], // 0 2 1 + (false, true, false) => [y_dir, x_dir, z_dir], // 1 2 0 + (false, false, true) => [z_dir, y_dir, x_dir], // 0 1 2 + (false, false, false) => unreachable!(), + }; + [ + t[0], + t[1], + t[2], + t[2].opposite(), + t[1].opposite(), + t[0].opposite(), + ] +} + +// Attempts to merge the two blocks, in place. +fn merge_slabs_in_place(block: &mut BlockId, target: BlockId) -> bool { + if block.kind() != target.kind() { + return false; + } + let opt = match (block.slab_kind(), target.slab_kind()) { + (Some(slab1), Some(slab2)) => match (slab1, slab2) { + (SlabKind::Top, SlabKind::Bottom) | (SlabKind::Bottom, SlabKind::Top) => { + Some(block.with_slab_kind(SlabKind::Double)) + } + + _ => None, + }, + _ => None, + }; + *block = opt.unwrap_or(*block); + opt.is_some() +} +/// Determine what kind of slab to place. Returns `true` if the slab placed would be merged with the other slab. `try_merge_slabs` should always succeed if this function returns `true`. +#[allow(clippy::float_cmp)] +fn slab_to_place(block: &mut BlockId, target: BlockId, placement: &BlockPlacementEvent) -> bool { + let (slab_kind, place_adjacent) = match placement.cursor_position[1] { + y if y == 0.5 => { + if let Some(k) = target.slab_kind() { + if block.kind() != target.kind() { + match k { + SlabKind::Top => (SlabKind::Top, false), + SlabKind::Bottom => (SlabKind::Bottom, false), + SlabKind::Double => return false, + } + } else { + match k { + SlabKind::Top => (SlabKind::Bottom, true), + SlabKind::Bottom => (SlabKind::Top, true), + SlabKind::Double => return false, + } + } + } else { + return false; + } + } + y if y == 0.0 => (SlabKind::Top, false), + y if matches!(placement.face, BlockFace::Top) || y == 1.0 => (SlabKind::Bottom, false), + y if y < 0.5 => (SlabKind::Bottom, false), + y if y < 1.0 => (SlabKind::Top, false), + _ => return false, + }; + block.set_slab_kind(slab_kind); + place_adjacent +} + +/// This function determines the result of combining the 2 blocks. If one is water and the other is waterloggable, the target is waterlogged. Has no effect otherwise. +fn waterlog(target_block: &mut BlockId, to_place: BlockId) -> bool { + // Select the non-water block or return + let mut waterloggable = if matches!(target_block.kind(), BlockKind::Water) { + to_place + } else if matches!(to_place.kind(), BlockKind::Water) { + *target_block + } else { + return false; + }; + // Refuse to waterlog double slabs and blocks that are already waterlogged + if waterloggable + .slab_kind() + .map(|e| matches!(e, SlabKind::Double)) + .unwrap_or(false) + | waterloggable.waterlogged().unwrap_or(false) + { + return false; + } + + if waterloggable.set_waterlogged(true) { + *target_block = waterloggable; + // Campfires are extinguished when waterlogged + target_block.set_lit(false); + true + } else { + false + } +} + +/// Checks if the block facing is relative to the player. If this function returns `false`, the block facing is determined by the face of the block this one was placed on. +fn is_player_relative(kind: SimplifiedBlockKind) -> bool { + use SimplifiedBlockKind::*; + matches!( + kind, + Dispenser + | StickyPiston + | Piston + | CommandBlock + | Observer + | Dropper + | Furnace + | Smoker + | Chest + | TrappedChest + | BlastFurnace + | CarvedPumpkin + | JackOLantern + | BeeNest + | Beehive + | EndPortalFrame + | Anvil + | EnderChest + | Bed + | Loom + | Banner + | Sign + | FenceGate + | Repeater + | Comparator + | Lectern + | Rail + | PoweredRail + | ActivatorRail + | DetectorRail + | Stonecutter + | WoodenDoor + | IronDoor + | WarpedDoor + | CrimsonDoor + | Stairs + ) +} + +/// Checks if the block is to be placed with an opposite facing relative to the player. +fn is_reverse_placed(kind: SimplifiedBlockKind) -> bool { + use SimplifiedBlockKind::*; + matches!( + kind, + Observer | Bed | FenceGate | WoodenDoor | IronDoor | WarpedDoor | CrimsonDoor | Stairs + ) +} + +/// Changes the block facing as necessary. This includes calling `make_wall_block`, determining how the block is placed, setting its facing, cubic, cardinal, cardinal&down, top/bottom and the xyz axis. +/// Blocks have only one of these orientations. +fn set_face( + block: &mut BlockId, + player_directions: &[FacingCubic], + placement: &BlockPlacementEvent, +) { + if !matches!(placement.face, BlockFace::Top) { + make_wall_block(block); + } + let player_relative = is_player_relative(block.simplified_kind()); + let cubic_facing = match player_relative { + true => player_directions[0].opposite(), + false => match placement.face { + BlockFace::Bottom => FacingCubic::Down, + BlockFace::Top => FacingCubic::Up, + BlockFace::North => FacingCubic::North, + BlockFace::South => FacingCubic::South, + BlockFace::West => FacingCubic::West, + BlockFace::East => FacingCubic::East, + }, + }; + let cubic_facing = { + if is_reverse_placed(block.simplified_kind()) { + cubic_facing.opposite() + } else { + cubic_facing + } + }; + block.set_face(match placement.face { + BlockFace::Bottom => Face::Ceiling, + BlockFace::Top => Face::Floor, + BlockFace::North => Face::Wall, + BlockFace::South => Face::Wall, + BlockFace::West => Face::Wall, + BlockFace::East => Face::Wall, + }); + let cardinal = cubic_facing.to_facing_cardinal().unwrap_or_else(|| { + if player_relative { + if is_reverse_placed(block.simplified_kind()) { + player_directions[1] + } else { + player_directions[1].opposite() + } + .to_facing_cardinal() + .unwrap() + } else { + player_directions[0] + .to_facing_cardinal() + .unwrap_or_else(|| player_directions[1].to_facing_cardinal().unwrap()) + } + }); + block.set_facing_cardinal(match block.simplified_kind() { + SimplifiedBlockKind::Anvil => cardinal.left(), + _ => cardinal, + }); + block.set_axis_xyz(cubic_facing.axis()); + block.set_facing_cardinal_and_down( + cubic_facing + .opposite() + .to_facing_cardinal_and_down() + .unwrap_or(FacingCardinalAndDown::Down), + ); + block.set_facing_cubic(cubic_facing); + block.set_half_top_bottom(match placement.face { + BlockFace::Top => HalfTopBottom::Bottom, + BlockFace::Bottom => HalfTopBottom::Top, + _ => match placement.cursor_position[1] { + y if y <= 0.5 => HalfTopBottom::Bottom, + _ => HalfTopBottom::Top, + }, + }); +} + +/// If possible, turns a free standing block to its wall mounted counterpart, as they are considered different. This applies to torches, signs and banners. +fn make_wall_block(block: &mut BlockId) { + *block = match block.kind() { + BlockKind::Torch => BlockId::wall_torch(), + BlockKind::RedstoneTorch => BlockId::redstone_wall_torch(), + BlockKind::SoulTorch => BlockId::soul_wall_torch(), + BlockKind::OakSign => BlockId::oak_wall_sign(), + BlockKind::BirchSign => BlockId::birch_wall_sign(), + BlockKind::AcaciaSign => BlockId::acacia_wall_sign(), + BlockKind::JungleSign => BlockId::jungle_wall_sign(), + BlockKind::SpruceSign => BlockId::spruce_wall_sign(), + BlockKind::WarpedSign => BlockId::warped_wall_sign(), + BlockKind::CrimsonSign => BlockId::crimson_wall_sign(), + BlockKind::DarkOakSign => BlockId::dark_oak_wall_sign(), + BlockKind::RedBanner => BlockId::red_wall_banner(), + BlockKind::BlueBanner => BlockId::blue_wall_banner(), + BlockKind::CyanBanner => BlockId::cyan_wall_banner(), + BlockKind::GrayBanner => BlockId::gray_wall_banner(), + BlockKind::LimeBanner => BlockId::lime_wall_banner(), + BlockKind::PinkBanner => BlockId::pink_wall_banner(), + BlockKind::BlackBanner => BlockId::black_wall_banner(), + BlockKind::BrownBanner => BlockId::brown_wall_banner(), + BlockKind::GreenBanner => BlockId::green_wall_banner(), + BlockKind::WhiteBanner => BlockId::white_wall_banner(), + BlockKind::OrangeBanner => BlockId::orange_wall_banner(), + BlockKind::PurpleBanner => BlockId::purple_wall_banner(), + BlockKind::YellowBanner => BlockId::yellow_wall_banner(), + BlockKind::MagentaBanner => BlockId::magenta_wall_banner(), + BlockKind::LightBlueBanner => BlockId::light_blue_wall_banner(), + BlockKind::LightGrayBanner => BlockId::light_gray_wall_banner(), + _ => *block, + }; +} + +/// Attempts to convert an item to its placeable counterpart. Buckets to their respective contents, redstone dust to redstone wire and string to tripwire +fn item_to_block(item: Item) -> Option { + Some(match item { + Item::WaterBucket => BlockId::water(), + Item::LavaBucket => BlockId::lava(), + Item::Redstone => BlockId::redstone_wire(), + Item::FlintAndSteel => BlockId::fire(), + Item::String => BlockId::tripwire(), + i => { + let mut name = "minecraft:".to_owned(); + name.push_str(i.name()); + return BlockId::from_identifier(&name); + } + }) +} + +/// Reduces the amount of items in a slot. Full buckets are emptied instead. There are no checks if the item can be placed. +fn decrease_slot(slot: &mut InventorySlot) { + match slot.item_kind().unwrap() { + Item::WaterBucket | Item::LavaBucket => { + *slot = InventorySlot::Filled(ItemStack::new(Item::Bucket, 1).unwrap()) + } + Item::FlintAndSteel => { + if match slot { + InventorySlot::Filled(f) => f.damage(1), + InventorySlot::Empty => unreachable!(), + } { + *slot = InventorySlot::Empty + } + } + _ => { + // Can always take at least one + slot.try_take(1); + } + } +} diff --git a/feather/common/src/block/update.rs b/feather/common/src/block/update.rs new file mode 100644 index 000000000..088fbea89 --- /dev/null +++ b/feather/common/src/block/update.rs @@ -0,0 +1,30 @@ +use base::BlockPosition; +use ecs::SysResult; +use libcraft_core::BlockFace; +use utils::continue_on_none; + +use crate::{events::BlockChangeEvent, Game}; + +use super::wall::update_wall_connections; + +/// TODO: send updated blocks to player +pub fn block_update(game: &mut Game) -> SysResult { + for (_, event) in game.ecs.query::<&BlockChangeEvent>().iter() { + for pos in event.iter_changed_blocks().map(Into::::into) { + for adjacent in [ + BlockFace::East, + BlockFace::West, + BlockFace::North, + BlockFace::South, + BlockFace::Bottom, + ] + .iter() + .map(|&d| [pos.adjacent(d), pos.adjacent(BlockFace::Bottom).adjacent(d)]) + .flatten() + { + continue_on_none!(update_wall_connections(&mut game.world, adjacent)); + } + } + } + Ok(()) +} diff --git a/feather/common/src/block/util.rs b/feather/common/src/block/util.rs new file mode 100644 index 000000000..5b5e742d2 --- /dev/null +++ b/feather/common/src/block/util.rs @@ -0,0 +1,359 @@ +use std::convert::TryFrom; + +use crate::World; +use base::{ + categories::SupportType, BlockId, BlockKind, BlockPosition, EastNlt, FacingCardinal, + FacingCardinalAndDown, FacingCubic, NorthNlt, SouthNlt, WestNlt, +}; +use libcraft_core::BlockFace; +use std::convert::TryInto; + +/// Utility enum that represents `EastNlt`, `WestNlt`, `NorthNlt` and `SouthNlt`. These enums have identical discriminants and binary representations, making it safe to convert between them. +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] +#[repr(u16)] +pub enum Nlt { + None, + Low, + Tall, +} +impl TryFrom for Nlt { + type Error = anyhow::Error; + fn try_from(value: u16) -> anyhow::Result { + match value { + 0u16 => Ok(Nlt::None), + 1u16 => Ok(Nlt::Low), + 2u16 => Ok(Nlt::Tall), + x => Err(anyhow::anyhow!("invalid value {} for Nlt", x)), + } + } +} +macro_rules! impl_conversions { + ($ty:ident) => { + impl From for $ty { + fn from(nlt: Nlt) -> Self { + (nlt as u16).try_into().unwrap() + } + } + impl From<$ty> for Nlt { + fn from(other_nlt: $ty) -> Self { + (other_nlt as u16).try_into().unwrap() + } + } + }; + ($($ty:ident),+) => { + $( + impl_conversions!($ty); + )+ + } +} +impl_conversions!(EastNlt, WestNlt, NorthNlt, SouthNlt); + +/// Trait that implements helper function for adjacency. This is an extension to `World` that tries to keep this utility logic away from the main implementation +pub trait AdjacentBlockHelper { + fn adjacent_block(&self, pos: BlockPosition, face: BlockFace) -> Option; + + fn adjacent_block_cubic(&self, pos: BlockPosition, dir: FacingCubic) -> Option; + + fn adjacent_block_cardinal(&self, pos: BlockPosition, dir: FacingCardinal) -> Option; + + fn adjacent_block_cardinal_and_down( + &self, + pos: BlockPosition, + dir: FacingCardinalAndDown, + ) -> Option; + + fn get_facing_direction(&self, block: BlockId) -> Option; + + fn set_block_adjacent_cubic( + &self, + pos: BlockPosition, + block: BlockId, + dir: FacingCubic, + ) -> bool; + + fn set_block_adjacent_cardinal( + &self, + pos: BlockPosition, + block: BlockId, + dir: FacingCardinal, + ) -> bool; + + fn set_block_adjacent_cardinal_and_down( + &self, + pos: BlockPosition, + block: BlockId, + dir: FacingCardinalAndDown, + ) -> bool; + + fn check_block_stability( + &self, + block: BlockId, + pos: BlockPosition, + light_level: u8, + ) -> Option; +} +impl AdjacentBlockHelper for World { + fn adjacent_block(&self, pos: BlockPosition, face: BlockFace) -> Option { + self.block_at(pos.adjacent(face)) + } + + fn adjacent_block_cubic(&self, pos: BlockPosition, dir: FacingCubic) -> Option { + self.adjacent_block( + pos, + match dir { + FacingCubic::North => BlockFace::North, + FacingCubic::East => BlockFace::East, + FacingCubic::South => BlockFace::South, + FacingCubic::West => BlockFace::West, + FacingCubic::Up => BlockFace::Top, + FacingCubic::Down => BlockFace::Bottom, + }, + ) + } + + fn adjacent_block_cardinal(&self, pos: BlockPosition, dir: FacingCardinal) -> Option { + self.adjacent_block_cubic(pos, dir.to_facing_cubic()) + } + + fn adjacent_block_cardinal_and_down( + &self, + pos: BlockPosition, + dir: FacingCardinalAndDown, + ) -> Option { + self.adjacent_block_cubic(pos, dir.to_facing_cubic()) + } + + fn get_facing_direction(&self, block: BlockId) -> Option { + let dir = if block.has_facing_cardinal() { + block.facing_cardinal().unwrap().to_facing_cubic() + } else if block.has_facing_cardinal_and_down() { + block.facing_cardinal_and_down().unwrap().to_facing_cubic() + } else { + block.facing_cubic()? + }; + Some(dir.opposite()) + } + + fn set_block_adjacent_cubic( + &self, + pos: BlockPosition, + block: BlockId, + dir: FacingCubic, + ) -> bool { + self.set_block_at( + pos.adjacent(match dir { + FacingCubic::North => BlockFace::North, + FacingCubic::East => BlockFace::East, + FacingCubic::South => BlockFace::South, + FacingCubic::West => BlockFace::West, + FacingCubic::Up => BlockFace::Top, + FacingCubic::Down => BlockFace::Bottom, + }), + block, + ) + } + + fn set_block_adjacent_cardinal( + &self, + pos: BlockPosition, + block: BlockId, + dir: FacingCardinal, + ) -> bool { + self.set_block_adjacent_cubic(pos, block, dir.to_facing_cubic()) + } + + fn set_block_adjacent_cardinal_and_down( + &self, + pos: BlockPosition, + block: BlockId, + dir: FacingCardinalAndDown, + ) -> bool { + self.set_block_adjacent_cubic(pos, block, dir.to_facing_cubic()) + } + + fn check_block_stability( + &self, + block: BlockId, + pos: BlockPosition, + light_level: u8, + ) -> Option { + use blocks::SimplifiedBlockKind::*; + let support_type = block.support_type(); + if support_type.is_none() { + return Some(true); + } + let support_type = support_type.unwrap(); + let block_under = self.block_at(pos.down()); + let block_up = self.block_at(pos.up()); + let block_facing = self + .get_facing_direction(block) + .map(|f| self.adjacent_block_cubic(pos, f)) + .flatten(); + let is_supported = match support_type { + SupportType::OnSolid => block_under?.is_solid(), + SupportType::OnDesertBlocks => matches!( + block_under?.simplified_kind(), + Sand | RedSand | Dirt | CoarseDirt | Podzol + ), + SupportType::OnDirtBlocks => matches!( + block_under?.simplified_kind(), + Dirt | GrassBlock | CoarseDirt | Podzol | Farmland + ), + SupportType::OnFarmland => block_under?.simplified_kind() == Farmland, + SupportType::OnSoulSand => block_under?.simplified_kind() == SoulSand, + SupportType::OnWater => block_under?.simplified_kind() == Water, + SupportType::FacingSolid => block_facing?.is_solid(), + SupportType::FacingJungleWood => matches!( + block_facing?.kind(), + BlockKind::JungleLog + | BlockKind::StrippedJungleLog + | BlockKind::JungleWood + | BlockKind::StrippedJungleWood + ), + SupportType::OnOrFacingSolid => self + .block_at(pos.adjacent(match block.face()? { + base::Face::Floor => BlockFace::Bottom, + base::Face::Wall => match block.facing_cardinal()?.opposite() { + FacingCardinal::North => BlockFace::North, + FacingCardinal::South => BlockFace::South, + FacingCardinal::West => BlockFace::West, + FacingCardinal::East => BlockFace::East, + }, + base::Face::Ceiling => BlockFace::Top, + }))? + .is_full_block(), + SupportType::CactusLike => { + matches!(block_under?.simplified_kind(), Sand | RedSand | Cactus) && { + let mut ok = true; + for face in [ + BlockFace::North, + BlockFace::South, + BlockFace::West, + BlockFace::East, + ] { + let block = self.block_at(pos.adjacent(face))?; + ok &= !block.is_full_block() && block.simplified_kind() != Cactus + } + ok + } + } + SupportType::ChorusFlowerLike => { + let neighbours = [ + BlockFace::North, + BlockFace::South, + BlockFace::West, + BlockFace::East, + ] + .iter() + .filter_map(|&face| self.block_at(pos.adjacent(face))) + .map(BlockId::simplified_kind); + neighbours.clone().filter(|&e| e == Air).count() == 3 + && neighbours.filter(|&e| e == EndStone).count() == 1 + || matches!(block_under?.simplified_kind(), EndStone | ChorusPlant) + } + SupportType::ChorusPlantLike => { + let n = [ + BlockFace::North, + BlockFace::South, + BlockFace::West, + BlockFace::East, + ]; + let horizontal = n + .iter() + .filter_map(|&f| self.block_at(pos.adjacent(f))) + .map(BlockId::simplified_kind); + let horizontal_down = n + .iter() + .filter_map(|&f| self.block_at(pos.down().adjacent(f))) + .map(BlockId::simplified_kind); + if horizontal.clone().count() != 4 || horizontal_down.clone().count() != 4 { + return None; + } + let has_horizontal = horizontal.clone().any(|b| b == ChorusPlant); + let has_vertical = + matches!(block_up?.simplified_kind(), ChorusPlant | ChorusFlower); + let is_connected = horizontal + .zip(horizontal_down) + .any(|(h, hd)| h == ChorusPlant && matches!(hd, ChorusPlant | EndStone)); + is_connected && !(has_vertical && has_horizontal && !block_under?.is_air()) + } + SupportType::MushroomLike => block_under?.is_full_block() && light_level < 13, + SupportType::SnowLike => { + block_under?.is_full_block() + && !matches!(block_under?.simplified_kind(), Ice | PackedIce) + } + SupportType::SugarCaneLike => { + matches!( + block_under?.simplified_kind(), + Grass | Dirt | CoarseDirt | Podzol | Sand | RedSand | SugarCane + ) && { + let mut ok = false; + for face in [ + BlockFace::North, + BlockFace::South, + BlockFace::West, + BlockFace::East, + ] { + let block = self.block_at(pos.down().adjacent(face))?; + ok |= matches!(block.simplified_kind(), FrostedIce | Water); + ok |= block.waterlogged().unwrap_or(false); + } + ok + } + } + SupportType::TripwireHookLike => { + block_facing?.is_full_block() + && !matches!(block_facing?.simplified_kind(), RedstoneBlock | Observer) + } + SupportType::VineLike => { + matches!(self.block_at(pos.up())?.simplified_kind(), Vine) || { + let mut ok = false; + for face in [ + BlockFace::North, + BlockFace::South, + BlockFace::West, + BlockFace::East, + BlockFace::Top, + ] { + let block = self.block_at(pos.down().adjacent(face))?; + ok |= block.is_full_block(); + } + ok + } + } + }; + Some(is_supported) + } +} + +/// Checks if the block is a wall. `SimplifiedBlockKind` does not have a common type for walls at this time, making this function neccessary. +pub fn is_wall(block: BlockId) -> bool { + use base::SimplifiedBlockKind::*; + matches!( + block.simplified_kind(), + BrickWall + | PrismarineWall + | RedSandstoneWall + | MossyStoneBrickWall + | GraniteWall + | StoneBrickWall + | NetherBrickWall + | AndesiteWall + | RedNetherBrickWall + | SandstoneWall + | EndStoneBrickWall + | DioriteWall + | CobblestoneWall + | MossyCobblestoneWall + | BlackstoneWall + | PolishedBlackstoneBrickWall + | PolishedBlackstoneWall + ) +} +pub fn is_door(block: BlockId) -> bool { + use base::SimplifiedBlockKind::*; + matches!( + block.simplified_kind(), + WoodenDoor | IronDoor | WarpedDoor | CrimsonDoor + ) +} diff --git a/feather/common/src/block/wall.rs b/feather/common/src/block/wall.rs new file mode 100644 index 000000000..5a1b377cc --- /dev/null +++ b/feather/common/src/block/wall.rs @@ -0,0 +1,193 @@ +use base::{BlockId, BlockPosition, FacingCardinal, SimplifiedBlockKind}; +use libcraft_core::BlockFace; + +use crate::{ + block::util::{is_wall, AdjacentBlockHelper}, + World, +}; + +use super::util::Nlt; + +/// General function that connects all walls, fences, glass panes, iron bars and tripwires and then lowers fence gates to fit into walls. +pub fn update_wall_connections(world: &mut World, pos: BlockPosition) -> Option<()> { + lower_fence_gate(world, pos)?; + connect_neighbours_and_up(world, pos) +} + +/// Check if this block is a wall/iron bars/glass pane. If true, the block can connect to any other block that satisfies this predicate. +pub fn is_wall_compatible(block: BlockId) -> bool { + use base::SimplifiedBlockKind::*; + is_wall(block) || matches!(block.simplified_kind(), GlassPane | IronBars) +} +fn adjacent_or_default( + world: &World, + pos: BlockPosition, + face: BlockFace, + default: BlockId, +) -> BlockId { + world.adjacent_block(pos, face).unwrap_or(default) +} +/// Checks if this block is a `FenceGate` and has one of its connecting side on the given `BlockFace` +fn gate_connects_to_face(block: BlockId, face: BlockFace) -> bool { + use BlockFace::*; + block.simplified_kind() == SimplifiedBlockKind::FenceGate + && matches!( + (face, block.facing_cardinal().unwrap()), + (East | West, FacingCardinal::North | FacingCardinal::South) + | (North | South, FacingCardinal::East | FacingCardinal::West) + ) +} + +/// Uses the appropriate `BlockId::set_#####_connected` function, depending on the given `BlockFace` +fn set_face_connected(block: &mut BlockId, face: BlockFace, connected: bool) -> bool { + use BlockFace::*; + match face { + Bottom | Top => false, + East => block.set_east_connected(connected), + West => block.set_west_connected(connected), + North => block.set_north_connected(connected), + South => block.set_south_connected(connected), + } +} +/// Uses the appropriate `BlockId::set_#####_nlt` function, depending on the given `BlockFace`. The given `Nlt` is automatically converted. +fn set_face_nlt(block: &mut BlockId, face: BlockFace, nlt: Nlt) -> bool { + use BlockFace::*; + match face { + Bottom | Top => false, + East => block.set_east_nlt(nlt.into()), + West => block.set_west_nlt(nlt.into()), + North => block.set_north_nlt(nlt.into()), + South => block.set_south_nlt(nlt.into()), + } +} +/// Checks whether the block is a wall and connected to the given `BlockFace` +fn is_nlt_connected(block: BlockId, face: BlockFace) -> Option { + use BlockFace::*; + let f = |n: Nlt| matches!(n, Nlt::Low | Nlt::Tall); + match face { + Bottom | Top => None, + East => block.east_nlt().map(|n| f(n.into())), + West => block.west_nlt().map(|n| f(n.into())), + North => block.north_nlt().map(|n| f(n.into())), + South => block.south_nlt().map(|n| f(n.into())), + } +} +/// Checks if the block is connected to the given `BlockFace` +fn is_face_connected(block: BlockId, face: BlockFace) -> Option { + use BlockFace::*; + match face { + Bottom | Top => Some(false), + East => block.east_connected(), + West => block.west_connected(), + North => block.north_connected(), + South => block.south_connected(), + } +} + +/// If called on a position containing a `FenceGate`, checks whether the block connects to a wall. If true, this lowers the gate by setting its `in_wall` property to true. +pub fn lower_fence_gate(world: &mut World, pos: BlockPosition) -> Option<()> { + let mut block = world.block_at(pos)?; + if block.simplified_kind() != SimplifiedBlockKind::FenceGate { + return Some(()); + } + let left = block.facing_cardinal().unwrap().left(); + let right = left.opposite(); + // Check if neighbouring block is a wall + let predicate = |fc| { + is_wall( + world + .adjacent_block_cardinal(pos, fc) + .unwrap_or_else(BlockId::air), + ) + }; + // One wall is enough to lower the fence gate + block.set_in_wall(predicate(left) || predicate(right)); + world.set_block_at(pos, block); + Some(()) +} + +pub fn connect_neighbours_and_up(world: &mut World, pos: BlockPosition) -> Option<()> { + use base::SimplifiedBlockKind::*; + let mut block = world.block_at(pos)?; + let up = adjacent_or_default(world, pos, BlockFace::Top, BlockId::air()); + let (mut east_connected, mut west_connected, mut north_connected, mut south_connected) = + (false, false, false, false); + // Iterate over cardinal directions + for (block_face, connected_flag) in [ + (BlockFace::East, &mut east_connected), + (BlockFace::West, &mut west_connected), + (BlockFace::North, &mut north_connected), + (BlockFace::South, &mut south_connected), + ] { + let facing = adjacent_or_default(world, pos, block_face, BlockId::air()); + // Walls and fences connect to opaque blocks. + *connected_flag |= is_wall_compatible(block) && facing.is_opaque(); + *connected_flag |= block.simplified_kind() == Fence && facing.is_opaque(); + // Walls, glass panes and iron bars all connect to one another. + *connected_flag |= is_wall_compatible(block) && is_wall_compatible(facing); + // Walls and fences connect to fence gates. + *connected_flag |= is_wall(block) && gate_connects_to_face(facing, block_face); + *connected_flag |= + block.simplified_kind() == Fence && gate_connects_to_face(facing, block_face); + // Blocks connect to those of the same kind. This handles tripwires and fences. + *connected_flag |= facing.simplified_kind() == block.simplified_kind(); + + if is_wall(block) { + // Wall connections are `Tall` when the block above then is opaque or has a connection in the same direction + let tall_wall_connection = is_face_connected(up, block_face).unwrap_or(false) + || is_nlt_connected(up, block_face).unwrap_or(false) + || gate_connects_to_face(up, block_face) + || up.is_opaque(); + let connection_type = if *connected_flag && tall_wall_connection { + Nlt::Tall + } else if *connected_flag { + Nlt::Low + } else { + Nlt::None + }; + set_face_nlt(&mut block, block_face, connection_type); + } else { + set_face_connected(&mut block, block_face, *connected_flag); + } + } + if is_wall(block) { + // Wall crossings always have a tall post + let up_from_wall_cross = (east_connected ^ west_connected) + || (north_connected ^ south_connected) + || !(east_connected || west_connected || north_connected || south_connected); + // Tall wall posts propagate downward + let up_has_up = up.up().unwrap_or(false); + // Walls always have a tall post when ending + let this_ends = [ + (BlockFace::East, east_connected), + (BlockFace::West, west_connected), + (BlockFace::North, north_connected), + (BlockFace::South, south_connected), + ] + .iter() + .any(|&(f, con)| { + con && !is_nlt_connected(block, f) + .or_else(|| is_face_connected(block, f)) + .unwrap_or(true) + }); + + // Check if there is a wall/fence/etc ending above + let up_ends = [ + (BlockFace::East, east_connected), + (BlockFace::West, west_connected), + (BlockFace::North, north_connected), + (BlockFace::South, south_connected), + ] + .iter() + .any(|&(f, con)| { + con && !is_nlt_connected(up, f) + .or_else(|| is_face_connected(up, f)) + .unwrap_or(true) + }); + // TODO: Query this property at runtime because it is a tag. + let wall_post_override = false; + block.set_up(up_from_wall_cross || up_has_up || this_ends || up_ends || wall_post_override); + } + world.set_block_at(pos, block); + Some(()) +} diff --git a/feather/common/src/block_break.rs b/feather/common/src/block_break.rs new file mode 100644 index 000000000..4b6cf8362 --- /dev/null +++ b/feather/common/src/block_break.rs @@ -0,0 +1,167 @@ +use anyhow::Context; +use base::{inventory::SLOT_HOTBAR_OFFSET, BlockKind, ItemStack, ValidBlockPosition}; +use ecs::{Entity, SysResult, SystemExecutor}; +use libcraft_items::{EnchantmentKind}; +use quill_common::components::Instabreak; + +pub struct DestroyStateChange(pub ValidBlockPosition, pub u8); + +use crate::{entities::player::HotbarSlot, Game, Window, World}; + +pub const BREAK_THRESHOLD: f32 = 0.7; + +/// Handle a player's request to start digging the block at `position`. Adds an `ActiveBreaker` component to `player`. +pub fn start_digging( + game: &mut Game, + player: Entity, + position: ValidBlockPosition, +) -> anyhow::Result { + if game.ecs.get::(player)?.0 { + game.break_block(position); + } else { + let breaker = { + let window = game.ecs.get::(player)?; + let hotbar_slot = game.ecs.get::(player)?.get(); + let main_hand = window.item(SLOT_HOTBAR_OFFSET + hotbar_slot)?; + ActiveBreaker::new(&mut game.world, position, main_hand.option_ref()) + .context("Cannot mine this block")? + }; + game.ecs.insert(player, breaker)?; + } + Ok(true) +} +/// Handle a player's request to stop digging the block at `position`. Removes `ActiveBreaker` from `player`. +pub fn cancel_digging( + game: &mut Game, + player: Entity, + position: ValidBlockPosition, +) -> anyhow::Result { + if game.ecs.get::(player).is_err() { + return Ok(false); + } + game.ecs.remove::(player)?; + game.ecs + .insert_entity_event(player, DestroyStateChange(position, 10))?; + Ok(true) +} +/// Handle a player's request to finish digging the block at `position`. +/// This is called when the block breaking finishes at the player's side. +/// +/// Will return `false` if the system hasn't finished breaking the block yet. +pub fn finish_digging( + game: &mut Game, + player: Entity, + position: ValidBlockPosition, +) -> anyhow::Result { + if game.ecs.get::(player)?.0 { + return Ok(true); + } + let success = if let Ok(breaker) = game.ecs.get::(player) { + breaker.can_break() + } else { + false + }; + if success { + let pos = game.ecs.get::(player)?.position; + game.break_block(pos); // TODO: drop an item, damage tool + game.ecs.remove::(player)?; + } + game.ecs + .insert_entity_event(player, DestroyStateChange(position, 10))?; + Ok(success) +} +/// Main component for the block breaking system. +/// Tracks the position of the block being mined, whether it will drop an item and the current progress. +#[derive(Clone)] +pub struct ActiveBreaker { + pub position: ValidBlockPosition, + pub drop_item: bool, + pub progress: f32, + pub damage: f32, +} +impl ActiveBreaker { + /// Advance block breaking by one tick. + pub fn tick(&mut self) -> (bool, bool) { + let before = self.destroy_stage(); + self.progress += self.damage; + let after = self.destroy_stage(); + let break_block = self.can_break(); + let change_stage = break_block || before != after; + (break_block, change_stage) + } + /// Check if the block has been damaged enough to break. + pub fn can_break(&self) -> bool { + self.progress >= BREAK_THRESHOLD - self.damage / 2.0 + } + /// Start breaking a block. Returns an error if the block at `block_pos` is unloaded or not diggable. + pub fn new( + world: &mut World, + block_pos: ValidBlockPosition, + equipped_item: Option<&ItemStack>, + ) -> anyhow::Result { + // https://minecraft.fandom.com/wiki/Breaking + let block = world + .block_at(block_pos) + .context("Block is not loaded")? + .kind(); + if !block.diggable() || block == BlockKind::Air { + anyhow::bail!("Block is not diggable") + } + let harvestable = match (block.harvest_tools(), equipped_item) { + (None, None | Some(_)) => true, + (Some(_), None) => false, + (Some(valid_tools), Some(equipped)) => valid_tools.contains(&equipped.item()), + }; + let dig_multiplier = block // TODO: calculate with Haste effect + .dig_multipliers() + .iter() + .find_map(|(item, speed)| { + equipped_item.and_then(|e| bool::then_some(e.item() == *item, *speed)) + }) + .unwrap_or(1.0); + let effi_level = equipped_item + .and_then(ItemStack::metadata) + .and_then(|meta| meta.get_enchantment_level(EnchantmentKind::Efficiency)); + let effi_speed = effi_level.map(|level| level * level + 1).unwrap_or(0) as f32; + let damage = if harvestable { + (dig_multiplier + effi_speed) / block.hardness() / 30.0 + } else { + 1.0 / block.hardness() / 100.0 + }; + Ok(Self { + position: block_pos, + drop_item: harvestable, + progress: damage, + damage, + }) + } + /// Get the destroying progress. + pub fn destroy_stage(&self) -> u8 { + (self.progress * 9.0).round() as u8 + } + pub fn destroy_change_event(&self) -> DestroyStateChange { + DestroyStateChange(self.position, self.destroy_stage()) + } +} + +pub fn register(systems: &mut SystemExecutor) { + systems.add_system(process_block_breaking); +} + +fn process_block_breaking(game: &mut Game) -> SysResult { + let mut update_queue = vec![]; + for (entity, breaker) in game.ecs.query::<&mut ActiveBreaker>().iter() { + let (_, update_stage) = breaker.tick(); + if update_stage { + update_queue.push(entity); + } + } + for entity in update_queue { + let event = game + .ecs + .get_mut::(entity)? + .destroy_change_event(); + game.ecs.insert_entity_event(entity, event)?; + } + Ok(()) +} diff --git a/feather/common/src/events/block_change.rs b/feather/common/src/events/block_change.rs index bb92ba52d..ca3ededc3 100644 --- a/feather/common/src/events/block_change.rs +++ b/feather/common/src/events/block_change.rs @@ -24,6 +24,10 @@ impl BlockChangeEvent { } } + pub fn try_single>(pos: T) -> Result { + Ok(Self::single(pos.try_into()?)) + } + /// Creates an event corresponding to a block update /// that fills an entire chunk section with the same block. pub fn fill_chunk_section(chunk: ChunkPosition, section: u32) -> Self { diff --git a/feather/common/src/game.rs b/feather/common/src/game.rs index 64e6bf87d..0ab71fd95 100644 --- a/feather/common/src/game.rs +++ b/feather/common/src/game.rs @@ -1,11 +1,11 @@ use std::{cell::RefCell, mem, rc::Rc, sync::Arc}; -use base::{BlockId, ChunkPosition, Position, Text, Title, ValidBlockPosition}; +use base::{BlockId, ChunkPosition, Gamemode, Position, Text, Title, ValidBlockPosition}; use ecs::{ Ecs, Entity, EntityBuilder, HasEcs, HasResources, NoSuchEntity, Resources, SysResult, SystemExecutor, }; -use quill_common::events::{EntityCreateEvent, EntityRemoveEvent, PlayerJoinEvent}; +use quill_common::events::{EntityCreateEvent, EntityRemoveEvent, GamemodeEvent, PlayerJoinEvent}; use quill_common::{entities::Player, entity_init::EntityInit}; use crate::{ @@ -230,6 +230,11 @@ impl Game { pub fn break_block(&mut self, pos: ValidBlockPosition) -> bool { self.set_block(pos, BlockId::air()) } + + pub fn set_gamemode(&mut self, player: Entity, new: Gamemode) -> SysResult { + self.ecs.insert_entity_event(player, GamemodeEvent(new))?; + Ok(()) + } } impl HasResources for Game { diff --git a/feather/common/src/lib.rs b/feather/common/src/lib.rs index 9f9e7348a..459097cc4 100644 --- a/feather/common/src/lib.rs +++ b/feather/common/src/lib.rs @@ -32,12 +32,17 @@ pub mod entities; pub mod interactable; +pub mod block_break; +pub mod block; + /// Registers gameplay systems with the given `Game` and `SystemExecutor`. pub fn register(game: &mut Game, systems: &mut SystemExecutor) { view::register(game, systems); chunk::loading::register(game, systems); chunk::entities::register(systems); interactable::register(game); + block_break::register(systems); + block::register(systems); game.add_entity_spawn_callback(entities::add_entity_components); } diff --git a/feather/common/src/world.rs b/feather/common/src/world.rs index f82ffc427..589f596ff 100644 --- a/feather/common/src/world.rs +++ b/feather/common/src/world.rs @@ -1,3 +1,4 @@ +use std::convert::TryInto; use std::{path::PathBuf, sync::Arc}; use ahash::{AHashMap, AHashSet}; @@ -137,16 +138,20 @@ impl World { /// if its chunk was not loaded or the coordinates /// are out of bounds and thus no operation /// was performed. - pub fn set_block_at(&self, pos: ValidBlockPosition, block: BlockId) -> bool { - self.chunk_map.set_block_at(pos, block) + pub fn set_block_at(&self, pos: impl TryInto, block: BlockId) -> bool { + let valid_pos = match pos.try_into() { + Ok(valid) => valid, + Err(_) => return false, + }; + self.chunk_map.set_block_at(valid_pos, block) } /// Retrieves the block at the specified /// location. If the chunk in which the block /// exists is not loaded or the coordinates /// are out of bounds, `None` is returned. - pub fn block_at(&self, pos: ValidBlockPosition) -> Option { - self.chunk_map.block_at(pos) + pub fn block_at(&self, pos: impl TryInto) -> Option { + self.chunk_map.block_at(pos.try_into().ok()?) } /// Returns the chunk map. @@ -262,8 +267,6 @@ fn chunk_relative_pos(block_pos: BlockPosition) -> (usize, usize, usize) { #[cfg(test)] mod tests { - use std::convert::TryInto; - use super::*; #[test] @@ -273,11 +276,7 @@ mod tests { .chunk_map_mut() .insert_chunk(Chunk::new(ChunkPosition::new(0, 0))); - assert!(world - .block_at(BlockPosition::new(0, -1, 0).try_into().unwrap()) - .is_none()); - assert!(world - .block_at(BlockPosition::new(0, 0, 0).try_into().unwrap()) - .is_some()); + assert!(world.block_at(BlockPosition::new(0, -1, 0)).is_none()); + assert!(world.block_at(BlockPosition::new(0, 0, 0)).is_some()); } } diff --git a/feather/datapacks/src/id.rs b/feather/datapacks/src/id.rs index e0e9beebb..7f6213385 100644 --- a/feather/datapacks/src/id.rs +++ b/feather/datapacks/src/id.rs @@ -32,7 +32,7 @@ impl NamespacedId { } /// Error returned when a namespaced ID was formatted incorrectly. -#[derive(Debug, thiserror::Error, PartialEq)] +#[derive(Debug, thiserror::Error, PartialEq, Eq)] pub enum ParseError { #[error("'{0}' is not a valid character for namespaces")] InvalidNamespaceChar(char), diff --git a/feather/plugin-host/macros/src/lib.rs b/feather/plugin-host/macros/src/lib.rs index f342e9060..6292f8471 100644 --- a/feather/plugin-host/macros/src/lib.rs +++ b/feather/plugin-host/macros/src/lib.rs @@ -10,7 +10,7 @@ pub fn host_function( ) -> proc_macro::TokenStream { let input: syn::ItemFn = syn::parse_macro_input!(input); - let ident = input.sig.ident.clone(); + let ident = &input.sig.ident; let gateway_ident = format_ident!("{}_gateway", input.sig.ident); let struct_ident = format_ident!("{}_struct", input.sig.ident); diff --git a/feather/plugin-host/src/lib.rs b/feather/plugin-host/src/lib.rs index 4167b6457..42096a64f 100644 --- a/feather/plugin-host/src/lib.rs +++ b/feather/plugin-host/src/lib.rs @@ -44,6 +44,8 @@ const WASM_FEATURES: Features = Features { multi_memory: false, memory64: false, exceptions: true, + relaxed_simd: false, + extended_const: false, }; /// Unique ID of a plugin. diff --git a/feather/protocol/src/io.rs b/feather/protocol/src/io.rs index 4c9a51be6..fbe598fd0 100644 --- a/feather/protocol/src/io.rs +++ b/feather/protocol/src/io.rs @@ -480,7 +480,7 @@ impl<'a> Readable for LengthInferredVecU8<'a> { impl<'a> Writeable for LengthInferredVecU8<'a> { fn write(&self, buffer: &mut Vec, _version: ProtocolVersion) -> anyhow::Result<()> { - buffer.extend_from_slice(&*self.0); + buffer.extend_from_slice(&self.0); Ok(()) } } diff --git a/feather/server/Cargo.toml b/feather/server/Cargo.toml index 970560311..ff8c3bd88 100644 --- a/feather/server/Cargo.toml +++ b/feather/server/Cargo.toml @@ -33,7 +33,7 @@ num-bigint = "0.4" num-traits = "0.2" once_cell = "1" parking_lot = "0.11" -plugin-host = { path = "../plugin-host", package = "feather-plugin-host" } +# plugin-host = { path = "../plugin-host", package = "feather-plugin-host" } protocol = { path = "../protocol", package = "feather-protocol" } quill-common = { path = "../../quill/common" } @@ -58,15 +58,15 @@ libcraft-items = { path = "../../libcraft/items" } worldgen = { path = "../worldgen", package = "feather-worldgen" } [features] -default = [ "plugin-cranelift" ] +# default = [ "plugin-cranelift" ] # Use zlib-ng for faster compression. Requires CMake. zlib-ng = [ "flate2/zlib-ng-compat" ] # Use Cranelift to JIT-compile plugins. Pure Rust # but produces slower code than LLVM. -plugin-cranelift = [ "plugin-host/cranelift" ] +# plugin-cranelift = [ "plugin-host/cranelift" ] # Use LLVM to JIT-compile plugins. Produces # very fast code, but requires LLVM to be installed # on the build system. May impact startup times. -plugin-llvm = [ "plugin-host/llvm" ] +# plugin-llvm = [ "plugin-host/llvm" ] diff --git a/feather/server/src/client.rs b/feather/server/src/client.rs index f18af09a1..d1f00d07a 100644 --- a/feather/server/src/client.rs +++ b/feather/server/src/client.rs @@ -21,8 +21,9 @@ use common::{ use libcraft_items::InventorySlot; use packets::server::{Particle, SetSlot, SpawnLivingEntity, UpdateLight, WindowConfirmation}; use protocol::packets::server::{ - ChangeGameState, EntityPosition, EntityPositionAndRotation, EntityTeleport, GameStateChange, - HeldItemChange, PlayerAbilities, + AcknowledgePlayerDigging, BlockBreakAnimation, ChangeGameState, EntityPosition, + EntityPositionAndRotation, EntityTeleport, GameStateChange, HeldItemChange, PlayerAbilities, + PlayerDiggingStatus, }; use protocol::{ packets::{ @@ -611,6 +612,34 @@ impl Client { self.send_packet(HeldItemChange { slot }); } + pub fn acknowledge_player_digging( + &self, + position: ValidBlockPosition, + block: BlockId, + status: PlayerDiggingStatus, + successful: bool, + ) { + self.send_packet(AcknowledgePlayerDigging { + position, + block, + status, + successful, + }) + } + + pub fn block_break_animation( + &self, + entity_id: u32, + position: ValidBlockPosition, + destroy_stage: u8, + ) { + self.send_packet(BlockBreakAnimation { + entity_id: i32::from_le_bytes(entity_id.to_le_bytes()), + position, + destroy_stage, + }) + } + pub fn change_gamemode(&self, gamemode: Gamemode) { self.send_packet(ChangeGameState { state_change: GameStateChange::ChangeGamemode { gamemode }, diff --git a/feather/server/src/initial_handler/proxy.rs b/feather/server/src/initial_handler/proxy.rs index f2a2775bb..4a590b036 100644 --- a/feather/server/src/initial_handler/proxy.rs +++ b/feather/server/src/initial_handler/proxy.rs @@ -10,7 +10,7 @@ mod bungeecord; mod velocity; /// IP forwarding data received from the proxy. -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub struct ProxyData { /// IP address of the proxy. pub host: String, diff --git a/feather/server/src/main.rs b/feather/server/src/main.rs index c3bf7ea16..72f1685e1 100644 --- a/feather/server/src/main.rs +++ b/feather/server/src/main.rs @@ -5,7 +5,6 @@ use base::anvil::level::SuperflatGeneratorOptions; use common::{Game, TickLoop, World}; use ecs::SystemExecutor; use feather_server::{config::Config, Server}; -use plugin_host::PluginManager; use worldgen::{ComposableGenerator, SuperflatWorldGenerator, VoidWorldGenerator, WorldGenerator}; mod logging; @@ -77,11 +76,11 @@ fn init_world_source(game: &mut Game, config: &Config) { } fn init_plugin_manager(game: &mut Game) -> anyhow::Result<()> { - let mut plugin_manager = PluginManager::new(); + /*let mut plugin_manager = PluginManager::new(); plugin_manager.load_dir(game, PLUGINS_DIRECTORY)?; let plugin_manager_rc = Rc::new(RefCell::new(plugin_manager)); - game.insert_resource(plugin_manager_rc); + game.insert_resource(plugin_manager_rc);*/ Ok(()) } diff --git a/feather/server/src/packet_handlers.rs b/feather/server/src/packet_handlers.rs index b0452c96a..4fc0fbe3f 100644 --- a/feather/server/src/packet_handlers.rs +++ b/feather/server/src/packet_handlers.rs @@ -1,4 +1,4 @@ -use base::{Position, Text}; +use base::{Gamemode, Position, Text}; use common::{chat::ChatKind, Game}; use ecs::{Entity, EntityRef, SysResult}; use interaction::{ @@ -45,7 +45,7 @@ pub fn handle_packet( ClientPlayPacket::Animation(packet) => handle_animation(server, player, packet), - ClientPlayPacket::ChatMessage(packet) => handle_chat_message(game, player, packet), + ClientPlayPacket::ChatMessage(packet) => handle_chat_message(game, player_id, packet), ClientPlayPacket::PlayerDigging(packet) => { handle_player_digging(game, server, packet, player_id) @@ -132,8 +132,17 @@ fn handle_animation( Ok(()) } -fn handle_chat_message(game: &Game, player: EntityRef, packet: client::ChatMessage) -> SysResult { - let name = player.get::()?; +fn handle_chat_message(game: &mut Game, player: Entity, packet: client::ChatMessage) -> SysResult { + if let m @ ("c" | "s") = &*packet.message { + if m == "c" { + game.set_gamemode(player, Gamemode::Creative)?; + } else { + game.set_gamemode(player, Gamemode::Survival)?; + } + return Ok(()) + } + + let name = game.ecs.get::(player)?; let message = Text::translate_with("chat.type.text", vec![name.to_string(), packet.message]); game.broadcast_chat(ChatKind::PlayerChat, message); Ok(()) diff --git a/feather/server/src/packet_handlers/interaction.rs b/feather/server/src/packet_handlers/interaction.rs index 1c6f69d9c..a01b3621a 100644 --- a/feather/server/src/packet_handlers/interaction.rs +++ b/feather/server/src/packet_handlers/interaction.rs @@ -118,9 +118,43 @@ pub fn handle_player_digging( player: Entity, ) -> SysResult { log::trace!("Got player digging with status {:?}", packet.status); + let client = server.clients.get(*game.ecs.get(player)?).unwrap(); + use PlayerDiggingStatus::*; + if matches!(packet.status, StartDigging | CancelDigging | FinishDigging) + && game.block(packet.position).is_none() + { + client.disconnect("Cannot interact with unloaded block!"); + anyhow::bail!("Cannot interact with unloaded block!") + } match packet.status { - PlayerDiggingStatus::StartDigging | PlayerDiggingStatus::CancelDigging => { - game.break_block(packet.position); + PlayerDiggingStatus::StartDigging => { + let success = common::block_break::start_digging(game, player, packet.position)?; + client.acknowledge_player_digging( + packet.position, + game.block(packet.position).unwrap(), + protocol::packets::server::PlayerDiggingStatus::Started, + success, + ); + Ok(()) + } + PlayerDiggingStatus::CancelDigging => { + let success = common::block_break::cancel_digging(game, player, packet.position)?; + client.acknowledge_player_digging( + packet.position, + game.block(packet.position).unwrap(), + protocol::packets::server::PlayerDiggingStatus::Cancelled, + success, + ); + Ok(()) + } + PlayerDiggingStatus::FinishDigging => { + let success = common::block_break::finish_digging(game, player, packet.position)?; + client.acknowledge_player_digging( + packet.position, + game.block(packet.position).unwrap(), + protocol::packets::server::PlayerDiggingStatus::Finished, + success, + ); Ok(()) } PlayerDiggingStatus::SwapItemInHand => { @@ -145,7 +179,9 @@ pub fn handle_player_digging( Ok(()) } - _ => Ok(()), + PlayerDiggingStatus::DropItemStack => Ok(()), + PlayerDiggingStatus::DropItem => Ok(()), + PlayerDiggingStatus::ShootArrow => Ok(()), } } diff --git a/feather/server/src/packet_handlers/inventory.rs b/feather/server/src/packet_handlers/inventory.rs index 48a397197..f8723b51c 100644 --- a/feather/server/src/packet_handlers/inventory.rs +++ b/feather/server/src/packet_handlers/inventory.rs @@ -56,7 +56,7 @@ pub fn handle_click_window( } client.set_cursor_slot(window.cursor_item()); - client.send_window_items(&*window); + client.send_window_items(&window); result } diff --git a/feather/server/src/systems/block.rs b/feather/server/src/systems/block.rs index 5544da2bd..50f75b7ad 100644 --- a/feather/server/src/systems/block.rs +++ b/feather/server/src/systems/block.rs @@ -15,7 +15,7 @@ use ahash::AHashMap; use base::{chunk::SECTION_VOLUME, position, ChunkPosition, CHUNK_WIDTH}; -use common::{events::BlockChangeEvent, Game}; +use common::{block_break::DestroyStateChange, events::BlockChangeEvent, Game}; use ecs::{SysResult, SystemExecutor}; use crate::Server; @@ -23,7 +23,17 @@ use crate::Server; pub fn register(systems: &mut SystemExecutor) { systems .group::() - .add_system(broadcast_block_changes); + .add_system(broadcast_block_changes) + .add_system(broadcast_block_destroy_stage_change); +} + +fn broadcast_block_destroy_stage_change(game: &mut Game, server: &mut Server) -> SysResult { + for (entity, event) in game.ecs.query::<&DestroyStateChange>().iter() { + server.broadcast_nearby_with(event.0.position(), |client| { + client.block_break_animation(entity.id(), event.0, event.1); + }); + } + Ok(()) } fn broadcast_block_changes(game: &mut Game, server: &mut Server) -> SysResult { diff --git a/feather/server/src/systems/gamemode.rs b/feather/server/src/systems/gamemode.rs index 8c9581bd1..5c48eedd4 100644 --- a/feather/server/src/systems/gamemode.rs +++ b/feather/server/src/systems/gamemode.rs @@ -30,11 +30,11 @@ fn gamemode_change(game: &mut Game, server: &mut Server) -> SysResult { &client_id, &walk_speed, &fly_speed, - mut may_fly, - mut is_flying, - mut instabreak, - mut may_build, - mut invulnerable, + may_fly, + is_flying, + instabreak, + may_build, + invulnerable, gamemode, prev_gamemode, ), diff --git a/feather/utils/src/lib.rs b/feather/utils/src/lib.rs index ead41e358..6df6458e7 100644 --- a/feather/utils/src/lib.rs +++ b/feather/utils/src/lib.rs @@ -7,3 +7,13 @@ pub fn vec_remove_item(vec: &mut Vec, item: &T) { vec.swap_remove(index); } } + +#[macro_export] +macro_rules! continue_on_none { + ($expr:expr) => { + match $expr { + Some(s) => s, + None => continue, + } + }; +} diff --git a/libcraft/core/src/positions.rs b/libcraft/core/src/positions.rs index 81606b6f6..437971831 100644 --- a/libcraft/core/src/positions.rs +++ b/libcraft/core/src/positions.rs @@ -351,6 +351,16 @@ impl BlockPosition { } } + pub fn adjacent(self, face: BlockFace) -> Self { + match face { + BlockFace::Bottom => self.down(), + BlockFace::Top => self.up(), + BlockFace::North => self.north(), + BlockFace::South => self.south(), + BlockFace::West => self.west(), + BlockFace::East => self.east(), + } + } /// Returns `true` if the [`BlockPosition`] is valid. /// /// Minecraft defines a valid block position with the following limits: @@ -433,7 +443,7 @@ impl From for ChunkPosition { } } -#[derive(Debug, Serialize, Deserialize, Clone)] +#[derive(Debug, Serialize, Deserialize, Clone, Copy)] pub enum BlockFace { Bottom, Top, @@ -442,3 +452,16 @@ pub enum BlockFace { West, East, } + +impl BlockFace { + pub fn opposite(self) -> Self { + match self { + BlockFace::Bottom => BlockFace::Top, + BlockFace::Top => BlockFace::Bottom, + BlockFace::North => BlockFace::South, + BlockFace::South => BlockFace::North, + BlockFace::West => BlockFace::East, + BlockFace::East => BlockFace::West, + } + } +} diff --git a/libcraft/items/src/inventory_slot.rs b/libcraft/items/src/inventory_slot.rs index 7f7e37c2a..7825a3c3a 100644 --- a/libcraft/items/src/inventory_slot.rs +++ b/libcraft/items/src/inventory_slot.rs @@ -269,7 +269,7 @@ mod test { let mut a = InventorySlot::new(Item::Stone, 5); let mut b = InventorySlot::new(Item::Stone, 30); a.merge(&mut b); - println!("{:?}", a); + println!("{a:?}"); assert!(a.is_mergable(&b)); assert_eq!(a.count(), 35); assert!(b.is_empty()); diff --git a/libcraft/items/src/item_stack.rs b/libcraft/items/src/item_stack.rs index 410e6650d..982cee83e 100644 --- a/libcraft/items/src/item_stack.rs +++ b/libcraft/items/src/item_stack.rs @@ -62,7 +62,7 @@ impl ItemStack { count, meta: Some(ItemStackMeta { title: String::from(item.name()), - lore: "".to_owned(), + lore: String::new(), damage: None, repair_cost: None, enchantments: vec![], @@ -351,6 +351,11 @@ impl ItemStack { pub fn stack_size(&self) -> u32 { self.item.stack_size() } + + #[must_use] + pub fn metadata(&self) -> Option<&ItemStackMeta> { + self.meta.as_ref() + } } /// An error type that may be returned when performing @@ -366,7 +371,7 @@ pub enum ItemStackError { impl Display for ItemStackError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{:?}", self) + write!(f, "{self:?}") } } @@ -377,7 +382,7 @@ impl ItemStackMeta { pub fn new(item: Item) -> Self { Self { title: item.display_name().to_owned(), - lore: "".to_owned(), + lore: String::new(), damage: None, repair_cost: None, enchantments: vec![], @@ -399,6 +404,14 @@ impl ItemStackMeta { self.enchantments.push(Enchantment::new(ench, level)); } } + #[must_use] + pub fn enchantments(&self) -> &[Enchantment] { + &self.enchantments + } + #[must_use] + pub fn enchantments_mut(&mut self) -> &mut Vec { + &mut self.enchantments + } } pub struct ItemStackBuilder { diff --git a/libcraft/text/src/text.rs b/libcraft/text/src/text.rs index 90af776de..ea5108e3f 100644 --- a/libcraft/text/src/text.rs +++ b/libcraft/text/src/text.rs @@ -16,7 +16,7 @@ pub enum TextConversionError { InvalidStyle(String), } -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum Color { DarkRed, @@ -304,7 +304,7 @@ where } } -impl<'a> From<&Translate> for String { +impl From<&Translate> for String { fn from(translate: &Translate) -> Self { match translate { Translate::ChatTypeText => "chat.type.text", diff --git a/libcraft/text/src/text/markdown/lexer.rs b/libcraft/text/src/text/markdown/lexer.rs index 27e003e3b..899357bc8 100644 --- a/libcraft/text/src/text/markdown/lexer.rs +++ b/libcraft/text/src/text/markdown/lexer.rs @@ -13,7 +13,7 @@ use std::slice::Iter; pub type Span<'a> = LocatedSpan<&'a str>; -#[derive(Debug, PartialEq, Clone)] +#[derive(Debug, PartialEq, Eq, Clone)] pub struct LexToken<'a> { pub tok: LexTokenType<'a>, pub span: Span<'a>, @@ -34,7 +34,7 @@ pub enum LexTokenType<'a> { Word(&'a str), } -#[derive(Debug, PartialEq, Clone, Copy)] +#[derive(Debug, PartialEq, Eq, Clone, Copy)] pub struct Tokens<'a> { pub tok: &'a [LexToken<'a>], start: usize, @@ -159,7 +159,7 @@ pub fn lex_control_word(input: Span) -> IResult IResult> { map(space1, |s: Span| { - LexToken::new(s, LexTokenType::Space(*s.fragment())) + LexToken::new(s, LexTokenType::Space(s.fragment())) })(input) } @@ -173,13 +173,13 @@ pub fn valid_word(input: Span) -> IResult> { pub fn lex_word(input: Span) -> IResult> { map(valid_word, |s: Span| { - LexToken::new(s, LexTokenType::Word(*s.fragment())) + LexToken::new(s, LexTokenType::Word(s.fragment())) })(input) } pub fn lex_color_code(input: Span) -> IResult> { map(preceded(peek(tag("#")), take(7usize)), |code: Span| { - LexToken::new(code, LexTokenType::Word(*code.fragment())) + LexToken::new(code, LexTokenType::Word(code.fragment())) })(input) } diff --git a/libcraft/text/src/text/markdown/parser.rs b/libcraft/text/src/text/markdown/parser.rs index 60ba2d9c5..52ed26bd4 100644 --- a/libcraft/text/src/text/markdown/parser.rs +++ b/libcraft/text/src/text/markdown/parser.rs @@ -9,7 +9,7 @@ use nom::{Err, IResult}; pub mod events; -#[derive(Debug, PartialEq, Clone)] +#[derive(Debug, PartialEq, Eq, Clone)] pub struct DynamicSpan { pub fragment: String, pub col: usize, diff --git a/libcraft/text/src/text/markdown/parser/events.rs b/libcraft/text/src/text/markdown/parser/events.rs index 73932a840..d3e933318 100644 --- a/libcraft/text/src/text/markdown/parser/events.rs +++ b/libcraft/text/src/text/markdown/parser/events.rs @@ -4,13 +4,13 @@ pub enum EventParseError<'a> { InvalidEventAction(&'a str), } -#[derive(Debug, PartialEq, Copy, Clone)] +#[derive(Debug, PartialEq, Eq, Copy, Clone)] pub enum EventType { OnHover, OnClick, } -#[derive(Debug, PartialEq, Copy, Clone)] +#[derive(Debug, PartialEq, Eq, Copy, Clone)] pub enum EventAction { ShowText, OpenUrl, diff --git a/quill/api/src/setup.rs b/quill/api/src/setup.rs index 0b555b25f..07fdebf96 100644 --- a/quill/api/src/setup.rs +++ b/quill/api/src/setup.rs @@ -24,6 +24,7 @@ impl Setup { /// /// The function should take as parameters your /// plugin instance and an `&mut Game` and return nothing. + #[allow(clippy::type_complexity)] pub fn add_system(&mut self, system: T) -> &mut Self { let system: Box = Box::new(system); let system_data = Box::leak(Box::new(system)) as *mut Box<_> as *mut u8; diff --git a/quill/cargo-quill/src/main.rs b/quill/cargo-quill/src/main.rs index 404c76118..7c3c04b51 100644 --- a/quill/cargo-quill/src/main.rs +++ b/quill/cargo-quill/src/main.rs @@ -86,7 +86,7 @@ impl Build { } fn main() -> anyhow::Result<()> { - let args: CargoQuill = argh::from_env(); + let args: CargoQuill = argh::cargo_from_env(); match args.subcommand { Subcommand::Build(args) => build(args), } @@ -126,8 +126,8 @@ fn cargo_build_command(args: &Build) -> Command { } if !args.native { - cmd.args(&["--target", WASM_TARGET]); - cmd.args(&["--", "-C", WASM_TARGET_FEATURES]); + cmd.args(["--target", WASM_TARGET]); + cmd.args(["--", "-C", WASM_TARGET_FEATURES]); } cmd.stdout(Stdio::piped()); diff --git a/quill/common/src/component.rs b/quill/common/src/component.rs index 11e4c4651..009efba9d 100644 --- a/quill/common/src/component.rs +++ b/quill/common/src/component.rs @@ -327,7 +327,7 @@ pod_component_impl!(Position); /** If you are using this macro and you get the error: -``` +```text error[E0599]: no variant or associated item named `...` found for enum `HostComponent` in the current scope. ``` Then you need to go to the top of the file were this macro is defined. There you find the HostCompoent enum, that diff --git a/quill/common/src/components.rs b/quill/common/src/components.rs index 352c45b69..b0fecea22 100644 --- a/quill/common/src/components.rs +++ b/quill/common/src/components.rs @@ -45,7 +45,7 @@ impl Name { } pub fn as_str(&self) -> &str { - &*self + self } } @@ -73,7 +73,7 @@ impl CustomName { } pub fn as_str(&self) -> &str { - &*self + self } pub fn as_mut_str(&mut self) -> &mut str { diff --git a/quill/plugin-format/src/lib.rs b/quill/plugin-format/src/lib.rs index 20a55c417..0c7ae0c53 100644 --- a/quill/plugin-format/src/lib.rs +++ b/quill/plugin-format/src/lib.rs @@ -43,7 +43,7 @@ impl<'a> PluginFile<'a> { /// this is the contents of the shared library /// containing the plugin. pub fn module(&self) -> &[u8] { - &*self.module + &self.module } pub fn metadata(&self) -> &PluginMetadata { diff --git a/quill/plugin-format/src/metadata.rs b/quill/plugin-format/src/metadata.rs index 66cd70eb5..b72b3e1a7 100644 --- a/quill/plugin-format/src/metadata.rs +++ b/quill/plugin-format/src/metadata.rs @@ -3,7 +3,7 @@ use serde_with::{serde_as, DisplayFromStr}; use target_lexicon::Triple; /// A plugin's metadata, stored alongside its WASM module. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct PluginMetadata { /// Plugin name, no spaces pub name: String,