aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-06-18 14:08:34 -0500
committermat <github@matdoes.dev>2022-06-18 14:08:34 -0500
commitd8e0457b62f5826183671e5b05890b400be35709 (patch)
treed40dccc61a2e96d60e2f678bca075102b28232c8 /azalea-client/src
parent614b21129804930159f041ce3f51202bc3e1c0b6 (diff)
downloadazalea-drasl-d8e0457b62f5826183671e5b05890b400be35709.tar.xz
from<ClientboundAddEntityPacket> for Entity
Diffstat (limited to 'azalea-client/src')
-rwxr-xr-xazalea-client/src/connect.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/azalea-client/src/connect.rs b/azalea-client/src/connect.rs
index 2deaab68..dd3162eb 100755
--- a/azalea-client/src/connect.rs
+++ b/azalea-client/src/connect.rs
@@ -1,5 +1,6 @@
use crate::Player;
use azalea_core::{resource_location::ResourceLocation, ChunkPos, EntityPos};
+use azalea_entity::Entity;
use azalea_protocol::{
connect::{GameConnection, HandshakeConnection},
packets::{
@@ -352,12 +353,15 @@ impl Client {
}
GamePacket::ClientboundAddEntityPacket(p) => {
println!("Got add entity packet {:?}", p);
- let pos = EntityPos {
- x: p.x,
- y: p.y,
- z: p.z,
- };
- p.id;
+ let entity = Entity::from(p);
+ state
+ .lock()
+ .await
+ .world
+ .as_mut()
+ .expect("World doesn't exist! We should've gotten a login packet by now.")
+ .entities
+ .insert(entity);
}
GamePacket::ClientboundSetEntityDataPacket(p) => {
// println!("Got set entity data packet {:?}", p);