1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 23:44:38 +00:00

merge main

This commit is contained in:
mat 2025-02-16 22:07:58 +00:00
commit c3bbc9e563
48 changed files with 258 additions and 186 deletions

169
Cargo.lock generated
View file

@ -133,9 +133,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
[[package]]
name = "as-any"
version = "0.3.1"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b8a30a44e99a1c83ccb2a6298c563c888952a1c9134953db26876528f84c93a"
checksum = "b0f477b951e452a0b6b4a10b53ccd569042d1d01729b519e02074a9c0958a063"
[[package]]
name = "assert_type_match"
@ -230,7 +230,7 @@ dependencies = [
"bevy_log",
"bevy_tasks",
"criterion",
"derive_more",
"derive_more 2.0.1",
"futures",
"futures-lite",
"indexmap",
@ -239,7 +239,7 @@ dependencies = [
"num-traits",
"parking_lot",
"rand",
"rustc-hash 2.1.0",
"rustc-hash 2.1.1",
"serde",
"thiserror 2.0.11",
"tokio",
@ -353,7 +353,7 @@ dependencies = [
"bevy_log",
"bevy_tasks",
"bevy_time",
"derive_more",
"derive_more 2.0.1",
"minecraft_folder_path",
"parking_lot",
"paste",
@ -412,7 +412,7 @@ dependencies = [
"azalea-world",
"bevy_app",
"bevy_ecs",
"derive_more",
"derive_more 2.0.1",
"enum-as-inner",
"nohash-hasher",
"parking_lot",
@ -544,10 +544,10 @@ dependencies = [
"azalea-registry",
"bevy_ecs",
"criterion",
"derive_more",
"derive_more 2.0.1",
"nohash-hasher",
"parking_lot",
"rustc-hash 2.1.0",
"rustc-hash 2.1.1",
"simdnbt",
"thiserror 2.0.11",
"tracing",
@ -582,9 +582,9 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b"
[[package]]
name = "bevy_app"
version = "0.15.1"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "454a8cfd134864dcdcba6ee56fb958531b981021bba6bb2037c9e3df6046603c"
checksum = "47983196daf9290ac97023de67d9364182c4a9a88ce400039e2d79aaf342dcb2"
dependencies = [
"bevy_derive",
"bevy_ecs",
@ -593,7 +593,7 @@ dependencies = [
"bevy_utils",
"console_error_panic_hook",
"ctrlc",
"derive_more",
"derive_more 1.0.0",
"downcast-rs",
"wasm-bindgen",
"web-sys",
@ -601,9 +601,9 @@ dependencies = [
[[package]]
name = "bevy_derive"
version = "0.15.1"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b962df2a1bef274ae76ec75279eb6f8ef0ffd85b5e4c43433f5d08ba57b3d071"
checksum = "fa901a443b9ee433823f0d1a4e6db78440ff27572a98e7fa7f2a614bf8d6e475"
dependencies = [
"bevy_macro_utils",
"quote",
@ -612,9 +612,9 @@ dependencies = [
[[package]]
name = "bevy_ecs"
version = "0.15.1"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b747210d7db09dfacc237707d4fd31c8b43d7744cd5e5829e2c4ca86b9e47baf"
checksum = "40e6d5ad061f750f710a9a4e2f9e7d65f86c0061fc9ffcf3a430b3c003bc0088"
dependencies = [
"bevy_ecs_macros",
"bevy_ptr",
@ -623,7 +623,7 @@ dependencies = [
"bevy_utils",
"bitflags",
"concurrent-queue",
"derive_more",
"derive_more 1.0.0",
"disqualified",
"fixedbitset 0.5.7",
"nonmax",
@ -633,9 +633,9 @@ dependencies = [
[[package]]
name = "bevy_ecs_macros"
version = "0.15.1"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d36ba5874ee278d20f17b8934d2969f8fbab90f3ea3fcf8d3583814b3661ada"
checksum = "fea80917f2d11e8928d0b7cd41efa55b814355e6a3544a1bf68e6b73871d332c"
dependencies = [
"bevy_macro_utils",
"proc-macro2",
@ -645,9 +645,9 @@ dependencies = [
[[package]]
name = "bevy_log"
version = "0.15.1"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "774238dcf70a0ef4d82aa2860b24b1cffdd4633f3694d3bcbfbb05c4f17ae4fe"
checksum = "8530cc17503ccfe86c8496136fca222bfa389c9cc70267be7d377d0f6621aa29"
dependencies = [
"android_log-sys",
"bevy_app",
@ -661,9 +661,9 @@ dependencies = [
[[package]]
name = "bevy_macro_utils"
version = "0.15.1"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9bdb3a681c24abace65bf18ed467ad8befbedb42468b32e459811bfdb01e506c"
checksum = "090371a2cd85574989febff6063a21d1fbbc2939e80f00fe075f62aa8e616136"
dependencies = [
"proc-macro2",
"quote",
@ -673,21 +673,21 @@ dependencies = [
[[package]]
name = "bevy_ptr"
version = "0.15.1"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa65df6a190b7dfc84d79f09cf02d47ae046fa86a613e202c31559e06d8d3710"
checksum = "4da2111eefa2000ea8c9dc1beee2eb7283b29b5ef90a29fe43c748df549f84ad"
[[package]]
name = "bevy_reflect"
version = "0.15.1"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bab3264acc3b6f48bc23fbd09fdfea6e5d9b7bfec142e4f3333f532acf195bca"
checksum = "82af24a68fd8feff476d9672ff34d220d3f45e95ef2f2324e7cb674614d18138"
dependencies = [
"assert_type_match",
"bevy_ptr",
"bevy_reflect_derive",
"bevy_utils",
"derive_more",
"derive_more 1.0.0",
"disqualified",
"downcast-rs",
"erased-serde",
@ -698,9 +698,9 @@ dependencies = [
[[package]]
name = "bevy_reflect_derive"
version = "0.15.1"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42f83876a322130ab38a47d5dcf75258944bf76b3387d1acdb3750920fda63e2"
checksum = "8369e6e779ab3540f9dcd93d062139f62551b3d2fe1ab451c6ddf74757e22ccd"
dependencies = [
"bevy_macro_utils",
"proc-macro2",
@ -711,9 +711,9 @@ dependencies = [
[[package]]
name = "bevy_tasks"
version = "0.15.1"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c28f2db2619203aa82342dbbe77e49aeea4f933212c0b7a1f285e94c4008e5b"
checksum = "53e085e93374b8dd2559968bcc1bc66d059387ef3128e59e9af92dcde03f10b7"
dependencies = [
"async-channel",
"async-executor",
@ -726,9 +726,9 @@ dependencies = [
[[package]]
name = "bevy_time"
version = "0.15.1"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb3108ed1ef864bc40bc859ba4c9c3844213c7be3674f982203cf5d87c656848"
checksum = "c02b14d56c04a372725dacc656e2e5f134ff239e72cd73431a065b32b296db31"
dependencies = [
"bevy_app",
"bevy_ecs",
@ -739,9 +739,9 @@ dependencies = [
[[package]]
name = "bevy_utils"
version = "0.15.1"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f01088c048960ea50ee847c3f668942ecf49ed26be12a1585a5e59b6a941d9a"
checksum = "2993cac374b3f88cfaf59506c71f8e3e7ad8b4961f4e9864bc76e1c9e1e4400c"
dependencies = [
"ahash",
"bevy_utils_proc_macros",
@ -754,9 +754,9 @@ dependencies = [
[[package]]
name = "bevy_utils_proc_macros"
version = "0.15.1"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a0c3244d543cc964545b7aa074f6fb18a915a7121cf3de5d7ed37a4aae8662d"
checksum = "2606f79dfe359a88e2a59bb6cd632cd42e9d4bcd250ac8bc3a4e7657e82f4f39"
dependencies = [
"proc-macro2",
"quote",
@ -812,9 +812,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "bytes"
version = "1.9.0"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b"
checksum = "f61dac84819c6588b558454b194026eb1f09c293b9036ae9b159e74e73ab6cf9"
[[package]]
name = "cast"
@ -824,9 +824,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
[[package]]
name = "cc"
version = "1.2.11"
version = "1.2.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4730490333d58093109dc02c23174c3f4d490998c3fed3cc8e82d57afedb9cf"
checksum = "c7777341816418c02e033934a09f20dc0ccaf65a5201ef8a450ae0105a573fda"
dependencies = [
"shlex",
]
@ -921,18 +921,18 @@ dependencies = [
[[package]]
name = "clap"
version = "4.5.27"
version = "4.5.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "769b0145982b4b48713e01ec42d61614425f27b7058bda7180a3a41f30104796"
checksum = "8acebd8ad879283633b343856142139f2da2317c96b05b4dd6181c61e2480184"
dependencies = [
"clap_builder",
]
[[package]]
name = "clap_builder"
version = "4.5.27"
version = "4.5.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b26884eb4b57140e4d2d93652abfa49498b938b3c9179f9fc487b0acc3edad7"
checksum = "f6ba32cbda51c7e1dfd49acc1457ba1a7dec5b64fe360e828acb13ca8dc9c2f9"
dependencies = [
"anstyle",
"clap_lex",
@ -1111,9 +1111,9 @@ dependencies = [
[[package]]
name = "data-encoding"
version = "2.7.0"
version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e60eed09d8c01d3cee5b7d30acb059b76614c918fa0f992e0dd6eeb10daad6f"
checksum = "575f75dfd25738df5b91b8e43e14d44bda14637a58fae779fd2b064f8bf3e010"
[[package]]
name = "der"
@ -1132,7 +1132,16 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05"
dependencies = [
"derive_more-impl",
"derive_more-impl 1.0.0",
]
[[package]]
name = "derive_more"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678"
dependencies = [
"derive_more-impl 2.0.1",
]
[[package]]
@ -1147,6 +1156,17 @@ dependencies = [
"unicode-xid",
]
[[package]]
name = "derive_more-impl"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "digest"
version = "0.10.7"
@ -1480,9 +1500,9 @@ checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc"
[[package]]
name = "hickory-proto"
version = "0.24.2"
version = "0.24.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "447afdcdb8afb9d0a852af6dc65d9b285ce720ed7a59e42a8bf2e931c67bc1b5"
checksum = "2ad3d6d98c648ed628df039541a5577bee1a7c83e9e16fe3dbedeea4cdfeb971"
dependencies = [
"async-trait",
"cfg-if",
@ -1504,9 +1524,9 @@ dependencies = [
[[package]]
name = "hickory-resolver"
version = "0.24.2"
version = "0.24.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a2e2aba9c389ce5267d31cf1e4dace82390ae276b0b364ea55630b1fa1b44b4"
checksum = "dcf287bde7b776e85d7188e6e5db7cf410a2f9531fe82817eb87feed034c8d14"
dependencies = [
"cfg-if",
"futures-util",
@ -1951,9 +1971,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
name = "miniz_oxide"
version = "0.8.3"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8402cab7aefae129c6977bb0ff1b8fd9a04eb5b51efc50a70bea51cda0c7924"
checksum = "b3b1c9bd4fe1f0f8b387f6eb9eb3b4a1aa26185e5750efb9140301703f62cd1b"
dependencies = [
"adler2",
]
@ -2125,9 +2145,9 @@ dependencies = [
[[package]]
name = "once_cell"
version = "1.20.2"
version = "1.20.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e"
[[package]]
name = "oorandom"
@ -2206,18 +2226,18 @@ dependencies = [
[[package]]
name = "pin-project"
version = "1.1.8"
version = "1.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e2ec53ad785f4d35dac0adea7f7dc6f1bb277ad84a680c7afefeae05d1f5916"
checksum = "dfe2e71e1471fe07709406bf725f710b02927c9c54b2b5b2ec0e8087d97c327d"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
version = "1.1.8"
version = "1.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d56a66c0c55993aa927429d0f8a0abfd74f084e4d9c192cffed01e418d83eefb"
checksum = "f6e859e6e5bd50440ab63c47e3ebabc90f26251f7c73c3d3e837b74a1cc3fa67"
dependencies = [
"proc-macro2",
"quote",
@ -2323,7 +2343,7 @@ dependencies = [
"pin-project-lite",
"quinn-proto",
"quinn-udp",
"rustc-hash 2.1.0",
"rustc-hash 2.1.1",
"rustls",
"socket2",
"thiserror 2.0.11",
@ -2341,7 +2361,7 @@ dependencies = [
"getrandom",
"rand",
"ring",
"rustc-hash 2.1.0",
"rustc-hash 2.1.1",
"rustls",
"rustls-pki-types",
"slab",
@ -2522,15 +2542,14 @@ dependencies = [
[[package]]
name = "ring"
version = "0.17.8"
version = "0.17.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d"
checksum = "e75ec5e92c4d8aede845126adc388046234541629e76029599ed35a003c7ed24"
dependencies = [
"cc",
"cfg-if",
"getrandom",
"libc",
"spin",
"untrusted",
"windows-sys 0.52.0",
]
@ -2581,9 +2600,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "rustc-hash"
version = "2.1.0"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497"
checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
[[package]]
name = "rustc_version"
@ -2596,9 +2615,9 @@ dependencies = [
[[package]]
name = "rustls"
version = "0.23.22"
version = "0.23.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fb9263ab4eb695e42321db096e3b8fbd715a59b154d5c88d82db2175b681ba7"
checksum = "47796c98c480fce5406ef69d1c76378375492c3b0a0de587be0c1d9feb12f395"
dependencies = [
"once_cell",
"ring",
@ -2782,9 +2801,9 @@ dependencies = [
[[package]]
name = "simdnbt"
version = "0.7.0"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1af1472d2425ec2edb429ed50c254ec74c403b6aab533d56ef9c59e9ed53ccc7"
checksum = "960b88bb7ea0984fbba94e53f1a2181ba6654e68a0eb53e45843e0eed402f10e"
dependencies = [
"byteorder",
"flate2",
@ -3094,9 +3113,9 @@ checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
[[package]]
name = "toml_edit"
version = "0.22.23"
version = "0.22.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02a8b472d1a3d7c18e2d61a489aee3453fd9031c33e4f55bd533f4a7adca1bee"
checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474"
dependencies = [
"indexmap",
"toml_datetime",
@ -3575,9 +3594,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
name = "winnow"
version = "0.7.0"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e49d2d35d3fad69b39b94139037ecfb4f359f08958b9c11e7315ce770462419"
checksum = "59690dea168f2198d1a3b0cac23b8063efcd11012f10ae4698f284808c8ef603"
dependencies = [
"memchr",
]

View file

@ -33,16 +33,16 @@ aes = "0.8.4"
anyhow = "1.0.95"
async-recursion = "1.1.1"
base64 = "0.22.1"
bevy_app = "0.15.1"
bevy_ecs = { version = "0.15.1", default-features = false }
bevy_log = "0.15.1"
bevy_tasks = "0.15.1"
bevy_time = "0.15.1"
bevy_app = "0.15.2"
bevy_ecs = { version = "0.15.2", default-features = false }
bevy_log = "0.15.2"
bevy_tasks = "0.15.2"
bevy_time = "0.15.2"
byteorder = "1.5.0"
cfb8 = "0.8.1"
chrono = { version = "0.4.39", default-features = false }
criterion = "0.5.1"
derive_more = "1.0.0"
derive_more = "2.0.1"
enum-as-inner = "0.6.1"
env_logger = "0.11.6"
flate2 = "1.0.35"
@ -61,20 +61,20 @@ regex = "1.11.1"
reqwest = { version = "0.12.12", default-features = false }
rsa = "0.9.7"
rsa_public_encrypt_pkcs1 = "0.4.0"
rustc-hash = "2.1.0"
rustc-hash = "2.1.1"
serde = "1.0.217"
serde_json = "1.0.138"
sha-1 = "0.10.1"
sha2 = "0.10.8"
simdnbt = "0.7"
socks5-impl = "0.6.1"
syn = "2.0.97"
syn = "2.0.98"
thiserror = "2.0.11"
tokio = "1.43.0"
tokio-util = "0.7.13"
tracing = "0.1.41"
tracing-subscriber = "0.3.19"
hickory-resolver = { version = "0.24.2", default-features = false }
hickory-resolver = { version = "0.24.3", default-features = false }
uuid = "1.12.1"
num-format = "0.4.4"
indexmap = "2.7.1"

View file

@ -1,5 +1,4 @@
#![doc = include_str!("../README.md")]
#![feature(trait_upcasting)]
mod behavior;
pub mod block_state;

View file

@ -86,7 +86,7 @@ pub fn handle_attack_event(
send_packet_events.send(SendPacketEvent::new(
event.entity,
ServerboundInteract {
entity_id: *event.target,
entity_id: event.target,
action: s_interact::ActionType::Attack,
using_secondary_action: **sneaking,
},

View file

@ -717,7 +717,7 @@ impl Client {
///
/// This is a shortcut for `*bot.component::<TabList>()`.
pub fn tab_list(&self) -> HashMap<Uuid, PlayerInfo> {
self.component::<TabList>().deref().clone()
(*self.component::<TabList>()).clone()
}
/// Call the given function with the client's [`RegistryHolder`].

View file

@ -5,7 +5,6 @@
//! [`azalea_protocol`]: https://docs.rs/azalea-protocol
//! [`azalea`]: https://docs.rs/azalea
#![allow(incomplete_features)]
#![feature(error_generic_member_access)]
mod account;

View file

@ -303,7 +303,7 @@ fn send_sprinting_if_needed(
send_packet_events.send(SendPacketEvent::new(
entity,
ServerboundPlayerCommand {
id: **minecraft_entity_id,
id: *minecraft_entity_id,
action: sprinting_action,
data: 0,
},

View file

@ -25,7 +25,7 @@ use tracing::{debug, error, trace, warn};
use crate::{
chat::{ChatPacket, ChatReceivedEvent},
chunks,
chunks, declare_packet_handlers,
disconnect::DisconnectEvent,
inventory::{
ClientSideCloseContainerEvent, Inventory, MenuOpenedEvent, SetContainerContentEvent,
@ -38,23 +38,6 @@ use crate::{
ClientInformation, PlayerInfo,
};
macro_rules! packets {
(
$packetenum:ident,
$packetvar:ident,
$handler:ident,
[$($packet:path),+ $(,)?]
) => {
paste::paste! {
match $packetvar.as_ref() {
$(
$packetenum::[< $packet:camel >](p) => $handler.$packet(p),
)+
}
}
};
}
pub fn process_packet_events(ecs: &mut World) {
let mut events_owned = Vec::<(Entity, Arc<ClientboundGamePacket>)>::new();
@ -77,7 +60,7 @@ pub fn process_packet_events(ecs: &mut World) {
ecs,
};
packets!(
declare_packet_handlers!(
ClientboundGamePacket,
packet,
handler,
@ -321,7 +304,7 @@ impl GamePacketHandler<'_> {
azalea_registry::EntityKind::Player,
new_instance_name,
);
let entity_id = MinecraftEntityId(p.player_id);
let entity_id = p.player_id;
// insert our components into the ecs :)
commands.entity(self.player).insert((
entity_id,
@ -682,7 +665,7 @@ impl GamePacketHandler<'_> {
let (mut entity_id_index, instance_name, tab_list) =
query.get_mut(self.player).unwrap();
let entity_id = MinecraftEntityId(p.id);
let entity_id = p.id;
let Some(instance_name) = instance_name else {
warn!("got add player packet but we haven't gotten a login packet yet");
@ -759,7 +742,7 @@ impl GamePacketHandler<'_> {
)>(self.ecs, |(mut commands, query, entity_kind_query)| {
let (entity_id_index, instance_holder) = query.get(self.player).unwrap();
let entity = entity_id_index.get(MinecraftEntityId(p.id));
let entity = entity_id_index.get(p.id);
let Some(entity) = entity else {
// some servers like hypixel trigger this a lot :(
@ -813,7 +796,7 @@ impl GamePacketHandler<'_> {
|(mut commands, query)| {
let (entity_id_index, instance_holder) = query.get(self.player).unwrap();
let Some(entity) = entity_id_index.get(MinecraftEntityId(p.id)) else {
let Some(entity) = entity_id_index.get(p.id) else {
// note that this log (and some other ones like the one in RemoveEntities)
// sometimes happens when killing mobs. it seems to be a vanilla bug, which is
// why it's a debug log instead of a warning
@ -886,7 +869,7 @@ impl GamePacketHandler<'_> {
|(mut commands, mut query)| {
let (entity_id_index, instance_holder) = query.get_mut(self.player).unwrap();
let Some(entity) = entity_id_index.get(MinecraftEntityId(p.id)) else {
let Some(entity) = entity_id_index.get(p.id) else {
warn!("Got teleport entity packet for unknown entity id {}", p.id);
return;
};
@ -931,7 +914,7 @@ impl GamePacketHandler<'_> {
debug!("Got move entity pos packet {p:?}");
let Some(entity) = entity_id_index.get(MinecraftEntityId(p.entity_id)) else {
let Some(entity) = entity_id_index.get(p.entity_id) else {
debug!(
"Got move entity pos packet for unknown entity id {}",
p.entity_id
@ -971,7 +954,7 @@ impl GamePacketHandler<'_> {
debug!("Got move entity pos rot packet {p:?}");
let entity = entity_id_index.get(MinecraftEntityId(p.entity_id));
let entity = entity_id_index.get(p.entity_id);
let Some(entity) = entity else {
// often triggered by hypixel :(
@ -1023,7 +1006,7 @@ impl GamePacketHandler<'_> {
|(mut commands, mut query)| {
let (entity_id_index, instance_holder) = query.get_mut(self.player).unwrap();
let entity = entity_id_index.get(MinecraftEntityId(p.entity_id));
let entity = entity_id_index.get(p.entity_id);
if let Some(entity) = entity {
let new_look_direction = LookDirection {
x_rot: (p.x_rot as i32 * 360) as f32 / 256.,
@ -1053,25 +1036,6 @@ impl GamePacketHandler<'_> {
);
}
pub fn keep_alive(&mut self, p: &ClientboundKeepAlive) {
/*
debug!("Got keep alive packet {p:?} for {player_entity:?}");
let mut system_state: SystemState<(
EventWriter<KeepAliveEvent>,
EventWriter<SendPacketEvent>,
)> = SystemState::new(ecs);
let (mut keepalive_events, mut send_packet_events) = system_state.get_mut(ecs);
keepalive_events.send(KeepAliveEvent {
entity: player_entity,
id: p.id,
});
send_packet_events.send(SendPacketEvent::new(
player_entity,
ServerboundKeepAlive { id: p.id },
));
*/
debug!("Got keep alive packet {p:?} for {:?}", self.player);
as_system::<(EventWriter<KeepAliveEvent>, EventWriter<SendPacketEvent>)>(
@ -1101,7 +1065,7 @@ impl GamePacketHandler<'_> {
};
for &id in &p.entity_ids {
let Some(entity) = entity_id_index.remove(MinecraftEntityId(id)) else {
let Some(entity) = entity_id_index.remove(id) else {
debug!("Tried to remove entity with id {id} but it wasn't in the EntityIdIndex");
continue;
};
@ -1417,7 +1381,7 @@ impl GamePacketHandler<'_> {
)>(self.ecs, |(mut commands, mut query, mut events)| {
let (entity_id, dead) = query.get_mut(self.player).unwrap();
if **entity_id == p.player_id && dead.is_none() {
if *entity_id == p.player_id && dead.is_none() {
commands.entity(self.player).insert(Dead);
events.send(DeathEvent {
entity: self.player,
@ -1551,7 +1515,7 @@ impl GamePacketHandler<'_> {
|(mut commands, mut query)| {
let (entity_id_index, instance_holder) = query.get_mut(self.player).unwrap();
let Some(entity) = entity_id_index.get(MinecraftEntityId(p.id)) else {
let Some(entity) = entity_id_index.get(p.id) else {
debug!("Got teleport entity packet for unknown entity id {}", p.id);
return;
};

View file

@ -79,3 +79,21 @@ impl Plugin for PacketHandlerPlugin {
.add_event::<SendLoginPacketEvent>();
}
}
#[macro_export]
macro_rules! declare_packet_handlers {
(
$packetenum:ident,
$packetvar:ident,
$handler:ident,
[$($packet:path),+ $(,)?]
) => {
paste::paste! {
match $packetvar.as_ref() {
$(
$packetenum::[< $packet:camel >](p) => $handler.$packet(p),
)+
}
}
};
}

View file

@ -22,7 +22,7 @@ use azalea_protocol::packets::{
ConnectionProtocol, Packet, ProtocolPacket,
};
use azalea_registry::DimensionType;
use azalea_world::Instance;
use azalea_world::{Instance, MinecraftEntityId};
use bevy_app::App;
use bevy_app::PluginGroup;
use bevy_ecs::{prelude::*, schedule::ExecutorKind};
@ -67,7 +67,7 @@ fn test_set_health_before_login() {
assert_eq!(*simulation.component::<Health>(), 15.);
simulation.receive_packet(ClientboundLogin {
player_id: 0,
player_id: MinecraftEntityId(0),
hardcore: false,
levels: vec![],
max_players: 20,

View file

@ -1,6 +1,4 @@
#![doc = include_str!("../README.md")]
#![feature(trait_upcasting)]
#![allow(incomplete_features)]
pub mod aabb;
pub mod bitset;

View file

@ -1,4 +1,4 @@
#![feature(trait_upcasting)]
/// Representations of various inventory data structures in Minecraft.
pub mod components;

View file

@ -2,13 +2,14 @@ use azalea_buf::AzBuf;
use azalea_core::{position::Vec3, resource_location::ResourceLocation};
use azalea_entity::{metadata::apply_default_metadata, EntityBundle};
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::MinecraftEntityId;
use uuid::Uuid;
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundAddEntity {
/// The id of the entity.
/// The numeric ID of the entity being added to the world.
#[var]
pub id: u32,
pub id: MinecraftEntityId,
pub uuid: Uuid,
pub entity_type: azalea_registry::EntityKind,
pub position: Vec3,

View file

@ -1,11 +1,12 @@
use azalea_buf::AzBuf;
use azalea_core::position::Vec3;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::MinecraftEntityId;
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundAddExperienceOrb {
#[var]
pub id: u32,
pub id: MinecraftEntityId,
pub pos: Vec3,
pub value: u16,
}

View file

@ -1,10 +1,11 @@
use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::MinecraftEntityId;
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundAnimate {
#[var]
pub id: u32,
pub id: MinecraftEntityId,
pub action: AnimationAction,
}

View file

@ -1,12 +1,13 @@
use azalea_buf::AzBuf;
use azalea_core::position::BlockPos;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::MinecraftEntityId;
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundBlockDestruction {
/// The ID of the entity breaking the block.
#[var]
pub id: u32,
pub id: MinecraftEntityId,
pub pos: BlockPos,
/// 09 to set it, any other value to remove it.
pub progress: u8,

View file

@ -1,13 +1,14 @@
use std::io::{Cursor, Write};
use azalea_buf::{AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWriteVar, AzaleaWrite};
use azalea_buf::{AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar};
use azalea_core::position::Vec3;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::MinecraftEntityId;
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundDamageEvent {
#[var]
pub entity_id: u32,
pub entity_id: MinecraftEntityId,
#[var]
pub source_type_id: u32,
pub source_cause_id: OptionalEntityId,

View file

@ -1,8 +1,9 @@
use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::MinecraftEntityId;
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundEntityEvent {
pub entity_id: u32,
pub entity_id: MinecraftEntityId,
pub event_id: u8,
}

View file

@ -1,12 +1,13 @@
use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::MinecraftEntityId;
use crate::common::movements::PositionMoveRotation;
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundEntityPositionSync {
#[var]
pub id: u32,
pub id: MinecraftEntityId,
pub values: PositionMoveRotation,
pub on_ground: bool,
}

View file

@ -1,5 +1,6 @@
use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::MinecraftEntityId;
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundHorseScreenOpen {
@ -7,5 +8,5 @@ pub struct ClientboundHorseScreenOpen {
pub container_id: i32,
#[var]
pub inventory_columns: u32,
pub entity_id: u32,
pub entity_id: MinecraftEntityId,
}

View file

@ -1,9 +1,10 @@
use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::MinecraftEntityId;
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundHurtAnimation {
#[var]
pub id: u32,
pub id: MinecraftEntityId,
pub yaw: f32,
}

View file

@ -1,6 +1,7 @@
use azalea_buf::AzBuf;
use azalea_core::resource_location::ResourceLocation;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::MinecraftEntityId;
use crate::packets::common::CommonPlayerSpawnInfo;
@ -10,7 +11,7 @@ use crate::packets::common::CommonPlayerSpawnInfo;
/// world, and the registry.
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundLogin {
pub player_id: u32,
pub player_id: MinecraftEntityId,
pub hardcore: bool,
pub levels: Vec<ResourceLocation>,
#[var]

View file

@ -1,11 +1,12 @@
use azalea_buf::AzBuf;
use azalea_core::delta::PositionDelta8;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::MinecraftEntityId;
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundMoveEntityPos {
#[var]
pub entity_id: u32,
pub entity_id: MinecraftEntityId,
pub delta: PositionDelta8,
pub on_ground: bool,
}

View file

@ -1,12 +1,13 @@
use azalea_buf::AzBuf;
use azalea_core::delta::PositionDelta8;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::MinecraftEntityId;
/// This packet is sent by the server when an entity moves less then 8 blocks.
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundMoveEntityPosRot {
#[var]
pub entity_id: u32,
pub entity_id: MinecraftEntityId,
pub delta: PositionDelta8,
pub y_rot: i8,
pub x_rot: i8,

View file

@ -1,10 +1,11 @@
use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::MinecraftEntityId;
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundMoveEntityRot {
#[var]
pub entity_id: u32,
pub entity_id: MinecraftEntityId,
pub y_rot: i8,
pub x_rot: i8,
pub on_ground: bool,

View file

@ -1,11 +1,12 @@
use azalea_buf::AzBuf;
use azalea_core::position::Vec3;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::MinecraftEntityId;
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundMoveMinecartAlongTrack {
#[var]
pub entity_id: u32,
pub entity_id: MinecraftEntityId,
pub lerp_steps: Vec<MinecartStep>,
}

View file

@ -1,11 +1,12 @@
use azalea_buf::AzBuf;
use azalea_chat::FormattedText;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::MinecraftEntityId;
/// Used to send a respawn screen.
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundPlayerCombatKill {
#[var]
pub player_id: u32,
pub player_id: MinecraftEntityId,
pub message: FormattedText,
}

View file

@ -5,6 +5,7 @@ use crate::common::movements::{PositionMoveRotation, RelativeMovements};
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundPlayerPosition {
/// The teleport ID.
#[var]
pub id: u32,
pub change: PositionMoveRotation,

View file

@ -1,8 +1,10 @@
use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::MinecraftEntityId;
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundProjectilePower {
pub id: u32,
#[var]
pub id: MinecraftEntityId,
pub acceleration_power: f64,
}

View file

@ -1,8 +1,9 @@
use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::MinecraftEntityId;
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundRemoveEntities {
#[var]
pub entity_ids: Vec<u32>,
pub entity_ids: Vec<MinecraftEntityId>,
}

View file

@ -1,9 +1,10 @@
use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::MinecraftEntityId;
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundRemoveMobEffect {
#[var]
pub entity_id: u32,
pub entity_id: MinecraftEntityId,
pub effect: azalea_registry::MobEffect,
}

View file

@ -1,9 +1,10 @@
use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::MinecraftEntityId;
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundRotateHead {
#[var]
pub entity_id: u32,
pub entity_id: MinecraftEntityId,
pub y_head_rot: i8,
}

View file

@ -1,8 +1,9 @@
use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::MinecraftEntityId;
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundSetCamera {
#[var]
pub camera_id: u32,
pub camera_id: MinecraftEntityId,
}

View file

@ -1,11 +1,12 @@
use azalea_buf::AzBuf;
use azalea_entity::EntityMetadataItems;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::MinecraftEntityId;
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundSetEntityData {
#[var]
pub id: u32,
pub id: MinecraftEntityId,
pub packed_items: EntityMetadataItems,
}

View file

@ -1,8 +1,9 @@
use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::MinecraftEntityId;
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundSetEntityLink {
pub source_id: u32,
pub dest_id: u32,
pub source_id: MinecraftEntityId,
pub dest_id: MinecraftEntityId,
}

View file

@ -1,10 +1,11 @@
use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::MinecraftEntityId;
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundSetEntityMotion {
#[var]
pub id: u32,
pub id: MinecraftEntityId,
pub xa: i16,
pub ya: i16,
pub za: i16,

View file

@ -4,11 +4,12 @@ use azalea_buf::{AzBuf, BufReadError};
use azalea_buf::{AzaleaRead, AzaleaWrite};
use azalea_inventory::ItemStack;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::MinecraftEntityId;
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundSetEquipment {
#[var]
pub entity_id: u32,
pub entity_id: MinecraftEntityId,
pub slots: EquipmentSlots,
}

View file

@ -1,6 +1,7 @@
use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_registry::SoundEvent;
use azalea_world::MinecraftEntityId;
use super::c_sound::{CustomSound, SoundSource};
@ -9,7 +10,7 @@ pub struct ClientboundSoundEntity {
pub sound: azalea_registry::Holder<SoundEvent, CustomSound>,
pub source: SoundSource,
#[var]
pub id: u32,
pub id: MinecraftEntityId,
pub volume: f32,
pub pitch: f32,
pub seed: u64,

View file

@ -1,12 +1,13 @@
use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::MinecraftEntityId;
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundTakeItemEntity {
#[var]
pub item_id: u32,
#[var]
pub player_id: u32,
pub player_id: MinecraftEntityId,
#[var]
pub amount: u32,
}

View file

@ -1,13 +1,13 @@
use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_world::MinecraftEntityId;
use crate::common::movements::{PositionMoveRotation, RelativeMovements};
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundTeleportEntity {
#[var]
pub id: u32,
pub id: MinecraftEntityId,
pub change: PositionMoveRotation,
pub relatives: RelativeMovements,
pub on_ground: bool,

View file

@ -2,11 +2,12 @@ use azalea_buf::AzBuf;
use azalea_entity::attributes::AttributeModifier;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_registry::Attribute;
use azalea_world::MinecraftEntityId;
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundUpdateAttributes {
#[var]
pub entity_id: u32,
pub entity_id: MinecraftEntityId,
pub values: Vec<AttributeSnapshot>,
}

View file

@ -1,11 +1,12 @@
use azalea_buf::AzBuf;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_registry::MobEffect;
use azalea_world::MinecraftEntityId;
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundUpdateMobEffect {
#[var]
pub entity_id: u32,
pub entity_id: MinecraftEntityId,
pub mob_effect: MobEffect,
#[var]
pub effect_amplifier: u32,

View file

@ -1,10 +1,11 @@
use azalea_buf::AzBuf;
use azalea_protocol_macros::ServerboundGamePacket;
use azalea_world::MinecraftEntityId;
#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)]
pub struct ServerboundEntityTagQuery {
#[var]
pub transaction_id: u32,
#[var]
pub entity_id: u32,
pub entity_id: MinecraftEntityId,
}

View file

@ -3,13 +3,14 @@ use std::io::{Cursor, Write};
use azalea_buf::{AzBuf, AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar};
use azalea_core::position::Vec3;
use azalea_protocol_macros::ServerboundGamePacket;
use azalea_world::MinecraftEntityId;
use crate::packets::BufReadError;
#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)]
pub struct ServerboundInteract {
#[var]
pub entity_id: u32,
pub entity_id: MinecraftEntityId,
pub action: ActionType,
/// Whether the player is sneaking
pub using_secondary_action: bool,

View file

@ -1,9 +1,10 @@
use azalea_buf::AzBuf;
use azalea_protocol_macros::ServerboundGamePacket;
use azalea_world::MinecraftEntityId;
#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)]
pub struct ServerboundPickItemFromEntity {
#[var]
pub id: u32,
pub id: MinecraftEntityId,
pub include_data: bool,
}

View file

@ -1,10 +1,11 @@
use azalea_buf::AzBuf;
use azalea_protocol_macros::ServerboundGamePacket;
use azalea_world::MinecraftEntityId;
#[derive(Clone, Debug, AzBuf, ServerboundGamePacket)]
pub struct ServerboundPlayerCommand {
#[var]
pub id: u32,
pub id: MinecraftEntityId,
pub action: Action,
#[var]
pub data: u32,

View file

@ -1,5 +1,6 @@
use std::fmt::Formatter;
use std::fmt::{self, Display, Formatter};
use std::hash::{Hash, Hasher};
use std::io::{self, Cursor};
use std::{
collections::{HashMap, HashSet},
fmt::Debug,
@ -7,6 +8,7 @@ use std::{
use azalea_block::fluid_state::FluidState;
use azalea_block::BlockState;
use azalea_buf::{AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError};
use azalea_core::position::{BlockPos, ChunkPos};
use azalea_core::registry_holder::RegistryHolder;
use bevy_ecs::{component::Component, entity::Entity};
@ -39,20 +41,60 @@ impl PartialInstance {
}
}
/// An entity ID used by Minecraft. These are not guaranteed to be unique in
/// shared worlds, that's what [`Entity`] is for.
/// An entity ID used by Minecraft.
///
/// These IDs are picked by the server. Some server softwares (like Bungeecord)
/// may pick entity IDs per-player, so you should avoid relying on them for
/// identifying IDs (especially if you're using a shared world -- i.e. a swarm).
///
/// You might find [`Entity`] more useful, since that's an ID decided by us that
/// is likely to be correct across shared worlds. You could also use the
/// `EntityUuid` from `azalea_entity`, that one is unlikely to change even
/// across server restarts.
///
/// This serializes as a i32. Usually it's a VarInt in the protocol, but not
/// always. If you do need it to serialize as a VarInt, make sure to use use the
/// `#[var]` attribute.
///
/// [`Entity`]: bevy_ecs::entity::Entity
#[derive(Component, Copy, Clone, Debug, PartialEq, Eq, Deref, DerefMut)]
pub struct MinecraftEntityId(pub u32);
pub struct MinecraftEntityId(pub i32);
impl Hash for MinecraftEntityId {
fn hash<H: Hasher>(&self, hasher: &mut H) {
hasher.write_u32(self.0);
hasher.write_i32(self.0);
}
}
impl nohash_hasher::IsEnabled for MinecraftEntityId {}
// we can't have the default be #[var] because mojang doesn't use varints for
// entities sometimes :(
impl AzaleaRead for MinecraftEntityId {
fn azalea_read(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> {
i32::azalea_read(buf).map(MinecraftEntityId)
}
}
impl AzaleaWrite for MinecraftEntityId {
fn azalea_write(&self, buf: &mut impl io::Write) -> Result<(), io::Error> {
i32::azalea_write(&self.0, buf)
}
}
impl AzaleaReadVar for MinecraftEntityId {
fn azalea_read_var(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> {
i32::azalea_read_var(buf).map(MinecraftEntityId)
}
}
impl AzaleaWriteVar for MinecraftEntityId {
fn azalea_write_var(&self, buf: &mut impl io::Write) -> Result<(), io::Error> {
i32::azalea_write_var(&self.0, buf)
}
}
impl Display for MinecraftEntityId {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(f, "eid({})", self.0)
}
}
/// Keep track of certain metadatas that are only relevant for this partial
/// world.
#[derive(Debug, Default)]

View file

@ -1,5 +1,4 @@
#![doc = include_str!("../README.md")]
#![allow(incomplete_features)]
#![feature(type_changing_struct_update)]
#![feature(let_chains)]
#![feature(never_type)]