diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2022-11-06 14:05:01 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-06 14:05:01 -0600 |
| commit | d112856ff6353592a50658b0ddd316f54dd97b87 (patch) | |
| tree | 6c408ecab96012e3bffaf15843fad5b9b6817796 /azalea-protocol/src/packets | |
| parent | 9bc517511663193f3166320db4cb5ca02701b039 (diff) | |
| download | azalea-drasl-d112856ff6353592a50658b0ddd316f54dd97b87.tar.xz | |
Entity metadata (#37)
* add example generated metadata.rs
* metadata.rs codegen
* add the files
* add comment to top of metadata.rs
* avoid clone
* metadata
* defaults
* defaults
* fix metadata readers and writers
* fix bad bitmasks and ignore some clippy warnings in generated code
* add set_index function to entity metadatas
* applying metadata
Diffstat (limited to 'azalea-protocol/src/packets')
4 files changed, 8 insertions, 5 deletions
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 f74a8746..fcbd8fa5 100644 --- a/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_add_entity_packet.rs @@ -1,7 +1,7 @@ use azalea_buf::McBuf; use azalea_core::Vec3; use azalea_protocol_macros::ClientboundGamePacket; -use azalea_world::entity::EntityData; +use azalea_world::entity::{EntityData, EntityMetadata}; use uuid::Uuid; #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] @@ -33,6 +33,8 @@ impl From<&ClientboundAddEntityPacket> for EntityData { y: p.y, z: p.z, }, + // default metadata for the entity type + EntityMetadata::from(p.entity_type), ) } } diff --git a/azalea-protocol/src/packets/game/clientbound_add_player_packet.rs b/azalea-protocol/src/packets/game/clientbound_add_player_packet.rs index 4a763c64..03585f06 100644 --- a/azalea-protocol/src/packets/game/clientbound_add_player_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_add_player_packet.rs @@ -1,7 +1,7 @@ use azalea_buf::McBuf; use azalea_core::Vec3; use azalea_protocol_macros::ClientboundGamePacket; -use azalea_world::entity::EntityData; +use azalea_world::entity::{metadata, EntityData, EntityMetadata}; use uuid::Uuid; /// This packet is sent by the server when a player comes into visible range, not when a player joins. @@ -26,6 +26,7 @@ impl From<&ClientboundAddPlayerPacket> for EntityData { y: p.y, z: p.z, }, + EntityMetadata::Player(metadata::Player::default()), ) } } diff --git a/azalea-protocol/src/packets/game/clientbound_level_particles_packet.rs b/azalea-protocol/src/packets/game/clientbound_level_particles_packet.rs index 705a7540..eaa34669 100644 --- a/azalea-protocol/src/packets/game/clientbound_level_particles_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_level_particles_packet.rs @@ -32,7 +32,7 @@ impl McBufReadable for ClientboundLevelParticlesPacket { let max_speed = f32::read_from(buf)?; let count = u32::read_from(buf)?; - let data = ParticleData::read_from_particle_id(buf, particle_id)?; + let data = ParticleData::read_from_id(buf, particle_id)?; Ok(Self { particle_id, diff --git a/azalea-protocol/src/packets/game/clientbound_set_entity_data_packet.rs b/azalea-protocol/src/packets/game/clientbound_set_entity_data_packet.rs index 05c89296..d133eeea 100644 --- a/azalea-protocol/src/packets/game/clientbound_set_entity_data_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_set_entity_data_packet.rs @@ -1,10 +1,10 @@ use azalea_buf::McBuf; use azalea_protocol_macros::ClientboundGamePacket; -use azalea_world::entity::EntityMetadata; +use azalea_world::entity::EntityMetadataItems; #[derive(Clone, Debug, McBuf, ClientboundGamePacket)] pub struct ClientboundSetEntityDataPacket { #[var] pub id: u32, - pub packed_items: EntityMetadata, + pub packed_items: EntityMetadataItems, } |
