aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2022-11-06 14:05:01 -0600
committerGitHub <noreply@github.com>2022-11-06 14:05:01 -0600
commitd112856ff6353592a50658b0ddd316f54dd97b87 (patch)
tree6c408ecab96012e3bffaf15843fad5b9b6817796 /azalea-client/src
parent9bc517511663193f3166320db4cb5ca02701b039 (diff)
downloadazalea-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-client/src')
-rw-r--r--azalea-client/src/client.rs15
1 files changed, 11 insertions, 4 deletions
diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs
index f19178c2..ff2e02a9 100644
--- a/azalea-client/src/client.rs
+++ b/azalea-client/src/client.rs
@@ -28,7 +28,7 @@ use azalea_protocol::{
resolver, ServerAddress,
};
use azalea_world::{
- entity::{EntityData, EntityMut, EntityRef},
+ entity::{metadata, EntityData, EntityMetadata, EntityMut, EntityRef},
Dimension,
};
use log::{debug, error, warn};
@@ -399,7 +399,11 @@ impl Client {
// i'll make this an actual setting later
*dimension_lock = Dimension::new(16, height, min_y);
- let entity = EntityData::new(client.game_profile.uuid, Vec3::default());
+ let entity = EntityData::new(
+ client.game_profile.uuid,
+ Vec3::default(),
+ EntityMetadata::Player(metadata::Player::default()),
+ );
dimension_lock.add_entity(p.player_id, entity);
let mut player_lock = client.player.lock();
@@ -579,8 +583,11 @@ impl Client {
let entity = EntityData::from(p);
client.dimension.lock().add_entity(p.id, entity);
}
- ClientboundGamePacket::SetEntityData(_p) => {
- // debug!("Got set entity data packet {:?}", p);
+ ClientboundGamePacket::SetEntityData(p) => {
+ debug!("Got set entity data packet {:?}", p);
+ let mut dimension = client.dimension.lock();
+ let mut entity = dimension.entity_mut(p.id).expect("Entity doesn't exist");
+ entity.apply_metadata(&p.packed_items.0);
}
ClientboundGamePacket::UpdateAttributes(_p) => {
// debug!("Got update attributes packet {:?}", p);