aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-02-01 21:26:37 +0000
committermat <git@matdoes.dev>2025-02-01 21:26:37 +0000
commit4562967b617589cb5aa7b401103e84fbb6b0775c (patch)
tree92f98be3c711df7365eef7d2979b62af1a03582a /azalea-client/src
parent87c34e1c3355e2b950f3c6f4ae44dcdfb775bbca (diff)
downloadazalea-drasl-4562967b617589cb5aa7b401103e84fbb6b0775c.tar.xz
set player metadata on init instead of login
Diffstat (limited to 'azalea-client/src')
-rw-r--r--azalea-client/src/client.rs3
-rw-r--r--azalea-client/src/packet_handling/game.rs38
2 files changed, 19 insertions, 22 deletions
diff --git a/azalea-client/src/client.rs b/azalea-client/src/client.rs
index 7c1aca78..1f8ebb53 100644
--- a/azalea-client/src/client.rs
+++ b/azalea-client/src/client.rs
@@ -325,6 +325,7 @@ impl Client {
game_profile: GameProfileComponent(game_profile),
client_information: crate::ClientInformation::default(),
instance_holder,
+ metadata: azalea_entity::metadata::PlayerMetadataBundle::default(),
},
InConfigState,
));
@@ -729,6 +730,8 @@ pub struct LocalPlayerBundle {
pub game_profile: GameProfileComponent,
pub client_information: ClientInformation,
pub instance_holder: InstanceHolder,
+
+ pub metadata: azalea_entity::metadata::PlayerMetadataBundle,
}
/// A bundle for the components that are present on a local player that is
diff --git a/azalea-client/src/packet_handling/game.rs b/azalea-client/src/packet_handling/game.rs
index a7326198..e61d401e 100644
--- a/azalea-client/src/packet_handling/game.rs
+++ b/azalea-client/src/packet_handling/game.rs
@@ -14,9 +14,9 @@ use azalea_core::{
};
use azalea_entity::{
indexing::{EntityIdIndex, EntityUuidIndex},
- metadata::{apply_metadata, Health, PlayerMetadataBundle},
+ metadata::{apply_metadata, Health},
Dead, EntityBundle, EntityKind, LastSentPosition, LoadedBy, LocalEntity, LookDirection,
- Physics, PlayerBundle, Position, RelativeEntityUpdate,
+ Physics, Position, RelativeEntityUpdate,
};
use azalea_protocol::{
packets::{
@@ -298,15 +298,12 @@ pub fn process_packet_events(ecs: &mut World) {
}
instance_holder.instance = weak_instance;
- let player_bundle = PlayerBundle {
- entity: EntityBundle::new(
- game_profile.uuid,
- Vec3::default(),
- azalea_registry::EntityKind::Player,
- new_instance_name,
- ),
- metadata: PlayerMetadataBundle::default(),
- };
+ let entity_bundle = EntityBundle::new(
+ game_profile.uuid,
+ Vec3::default(),
+ azalea_registry::EntityKind::Player,
+ new_instance_name,
+ );
let entity_id = MinecraftEntityId(p.player_id);
// insert our components into the ecs :)
commands.entity(player_entity).insert((
@@ -315,7 +312,7 @@ pub fn process_packet_events(ecs: &mut World) {
current: p.common.game_type,
previous: p.common.previous_game_type.into(),
},
- player_bundle,
+ entity_bundle,
));
azalea_entity::indexing::add_entity_to_indexes(
@@ -1433,22 +1430,19 @@ pub fn process_packet_events(ecs: &mut World) {
instance_holder.instance = weak_instance;
// this resets a bunch of our components like physics and stuff
- let player_bundle = PlayerBundle {
- entity: EntityBundle::new(
- game_profile.uuid,
- Vec3::default(),
- azalea_registry::EntityKind::Player,
- new_instance_name,
- ),
- metadata: PlayerMetadataBundle::default(),
- };
+ let entity_bundle = EntityBundle::new(
+ game_profile.uuid,
+ Vec3::default(),
+ azalea_registry::EntityKind::Player,
+ new_instance_name,
+ );
// update the local gamemode and metadata things
commands.entity(player_entity).insert((
LocalGameMode {
current: p.common.game_type,
previous: p.common.previous_game_type.into(),
},
- player_bundle,
+ entity_bundle,
));
}