diff options
| author | mat <github@matdoes.dev> | 2022-09-05 11:44:48 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-09-05 11:44:48 -0500 |
| commit | fcb5bdf04241082d08b1ecc083745d6d97af61a9 (patch) | |
| tree | b41a76923e299dc60802d676a319c85f9c76858c /azalea-protocol | |
| parent | 4301a2f2d4c711fd50a54cf065079c42b89a72f2 (diff) | |
| download | azalea-drasl-fcb5bdf04241082d08b1ecc083745d6d97af61a9.tar.xz | |
use az-registry in az-protocol
Diffstat (limited to 'azalea-protocol')
13 files changed, 24 insertions, 38 deletions
diff --git a/azalea-protocol/Cargo.toml b/azalea-protocol/Cargo.toml index 6b7dc290..513e324c 100755 --- a/azalea-protocol/Cargo.toml +++ b/azalea-protocol/Cargo.toml @@ -11,6 +11,7 @@ version = "0.1.0" async-compression = {version = "^0.3.8", features = ["tokio", "zlib"], optional = true} async-recursion = "1.0.0" azalea-auth = {path = "../azalea-auth", version = "^0.1.0"} +azalea-block = {path = "../azalea-block", default-features = false, version = "^0.1.0"} azalea-brigadier = {path = "../azalea-brigadier", version = "^0.1.0"} azalea-buf = {path = "../azalea-buf", version = "^0.1.0"} azalea-chat = {path = "../azalea-chat", version = "^0.1.1"} @@ -18,6 +19,7 @@ azalea-core = {path = "../azalea-core", optional = true, version = "^0.1.0"} azalea-crypto = {path = "../azalea-crypto", version = "^0.1.0"} azalea-nbt = {path = "../azalea-nbt", version = "^0.1.0"} azalea-protocol-macros = {path = "./azalea-protocol-macros", version = "^0.1.0"} +azalea-registry = {path = "../azalea-registry", version = "^0.1.0"} azalea-world = {path = "../azalea-world", version = "^0.1.0"} byteorder = "^1.4.3" bytes = "^1.1.0" diff --git a/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs b/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs index 403925f4..f74a8746 100644 --- a/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs @@ -10,9 +10,7 @@ pub struct ClientboundAddEntityPacket { #[var] pub id: u32, pub uuid: Uuid, - // TODO: have an entity type enum/struct - #[var] - pub entity_type: i32, + pub entity_type: azalea_registry::EntityType, pub x: f64, pub y: f64, pub z: f64, diff --git a/azalea-protocol/src/packets/game/clientbound_award_stats_packet.rs b/azalea-protocol/src/packets/game/clientbound_award_stats_packet.rs index 3629ed6f..2812987d 100644 --- a/azalea-protocol/src/packets/game/clientbound_award_stats_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_award_stats_packet.rs @@ -9,10 +9,14 @@ pub struct ClientboundAwardStatsPacket { } #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, McBuf)] -pub struct Stat { - // TODO: make these good enums and stuff - #[var] - pub stat_type: u32, - #[var] - pub statistic_id: u32, +pub enum Stat { + Mined(azalea_registry::Block), + Crafted(azalea_registry::Item), + Used(azalea_registry::Item), + Broken(azalea_registry::Item), + PickedUp(azalea_registry::Item), + Dropped(azalea_registry::Item), + Killed(azalea_registry::EntityType), + KilledBy(azalea_registry::EntityType), + Custom(azalea_registry::CustomStat), } diff --git a/azalea-protocol/src/packets/game/clientbound_block_entity_data_packet.rs b/azalea-protocol/src/packets/game/clientbound_block_entity_data_packet.rs index dbf0ae65..faa3b1a9 100644 --- a/azalea-protocol/src/packets/game/clientbound_block_entity_data_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_block_entity_data_packet.rs @@ -5,8 +5,6 @@ use azalea_protocol_macros::ClientboundGamePacket; #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] pub struct ClientboundBlockEntityDataPacket { pub pos: BlockPos, - // TODO: in vanilla this uses the block entity registry, we should have an enum in azalea-entity for this - #[var] - pub block_entity_type: u32, + pub block_entity_type: azalea_registry::BlockEntityType, pub tag: azalea_nbt::Tag, } diff --git a/azalea-protocol/src/packets/game/clientbound_block_event_packet.rs b/azalea-protocol/src/packets/game/clientbound_block_event_packet.rs index 124950f1..1a8a0c52 100644 --- a/azalea-protocol/src/packets/game/clientbound_block_event_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_block_event_packet.rs @@ -1,3 +1,4 @@ +use azalea_block::BlockState; use azalea_buf::McBuf; use azalea_core::BlockPos; use azalea_protocol_macros::ClientboundGamePacket; @@ -7,7 +8,5 @@ pub struct ClientboundBlockEventPacket { pub pos: BlockPos, pub b0: u8, pub b1: u8, - // TODO: this is a BlockState, see ClientboundBlockUpdatePacket for more info - #[var] - pub block: u32, + pub block: BlockState, } diff --git a/azalea-protocol/src/packets/game/clientbound_block_update_packet.rs b/azalea-protocol/src/packets/game/clientbound_block_update_packet.rs index 44629c82..3034accc 100644 --- a/azalea-protocol/src/packets/game/clientbound_block_update_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_block_update_packet.rs @@ -1,3 +1,4 @@ +use azalea_block::BlockState; use azalea_buf::McBuf; use azalea_core::BlockPos; use azalea_protocol_macros::ClientboundGamePacket; @@ -5,8 +6,5 @@ use azalea_protocol_macros::ClientboundGamePacket; #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] pub struct ClientboundBlockUpdatePacket { pub pos: BlockPos, - // TODO: in vanilla this is a BlockState, but here we just have it as a number. - // perhaps we could make a crate that only handles block states? right now blockstates are handled in azalea-block - #[var] - pub block_state: u32, + pub block_state: BlockState, } diff --git a/azalea-protocol/src/packets/game/clientbound_cooldown_packet.rs b/azalea-protocol/src/packets/game/clientbound_cooldown_packet.rs index 36795575..41c8291a 100644 --- a/azalea-protocol/src/packets/game/clientbound_cooldown_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_cooldown_packet.rs @@ -3,9 +3,7 @@ use azalea_protocol_macros::ClientboundGamePacket; #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] pub struct ClientboundCooldownPacket { - // TODO: make azalea-items or something and use that - #[var] - pub item: u32, + pub item: azalea_registry::Item, #[var] pub duration: u32, } diff --git a/azalea-protocol/src/packets/game/clientbound_open_screen_packet.rs b/azalea-protocol/src/packets/game/clientbound_open_screen_packet.rs index b526b210..521975af 100644 --- a/azalea-protocol/src/packets/game/clientbound_open_screen_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_open_screen_packet.rs @@ -6,8 +6,6 @@ use azalea_protocol_macros::ClientboundGamePacket; pub struct ClientboundOpenScreenPacket { #[var] pub container_id: u32, - // TODO: have an enum of this - #[var] - pub menu_type: u32, + pub menu_type: azalea_registry::Menu, pub title: Component, } diff --git a/azalea-protocol/src/packets/game/clientbound_remove_mob_effect_packet.rs b/azalea-protocol/src/packets/game/clientbound_remove_mob_effect_packet.rs index 38265271..87bf81bd 100644 --- a/azalea-protocol/src/packets/game/clientbound_remove_mob_effect_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_remove_mob_effect_packet.rs @@ -5,7 +5,5 @@ use azalea_protocol_macros::ClientboundGamePacket; pub struct ClientboundRemoveMobEffectPacket { #[var] pub entity_id: u32, - // TODO: have this use an enum - #[var] - pub effect: u32, + pub effect: azalea_registry::MobEffect, } diff --git a/azalea-protocol/src/packets/game/clientbound_sound_entity_packet.rs b/azalea-protocol/src/packets/game/clientbound_sound_entity_packet.rs index 9f8ab9e4..ad382fe0 100644 --- a/azalea-protocol/src/packets/game/clientbound_sound_entity_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_sound_entity_packet.rs @@ -4,9 +4,7 @@ use azalea_protocol_macros::ClientboundGamePacket; #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] pub struct ClientboundSoundEntityPacket { - // TODO: sound enum/registry - #[var] - pub sound: u32, + pub sound: azalea_registry::SoundEvent, pub source: SoundSource, #[var] pub id: u32, diff --git a/azalea-protocol/src/packets/game/clientbound_sound_packet.rs b/azalea-protocol/src/packets/game/clientbound_sound_packet.rs index 5f67714d..54f35492 100644 --- a/azalea-protocol/src/packets/game/clientbound_sound_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_sound_packet.rs @@ -3,9 +3,7 @@ use azalea_protocol_macros::ClientboundGamePacket; #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] pub struct ClientboundSoundPacket { - // TODO: sound enum/registry - #[var] - pub sound: u32, + pub sound: azalea_registry::SoundEvent, pub source: SoundSource, pub x: i32, pub y: i32, diff --git a/azalea-protocol/src/packets/game/clientbound_update_mob_effect_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_mob_effect_packet.rs index aeaea223..d1d9f9cc 100644 --- a/azalea-protocol/src/packets/game/clientbound_update_mob_effect_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_update_mob_effect_packet.rs @@ -5,9 +5,7 @@ use azalea_protocol_macros::ClientboundGamePacket; pub struct ClientboundUpdateMobEffectPacket { #[var] pub entity_id: u32, - // TODO: have an enum for this - #[var] - pub effect: u32, + pub effect: azalea_registry::MobEffect, pub effect_amplifier: u8, #[var] pub effect_duration_ticks: u32, diff --git a/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs index 33e8e0fe..8d8ef32b 100644 --- a/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_update_recipes_packet.rs @@ -26,7 +26,6 @@ pub struct ShapelessRecipe { } #[derive(Clone, Debug)] pub struct ShapedRecipe { - // TODO: make own McBufReadable and McBufWritable for this width: usize, height: usize, group: String, |
