aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src/plugins/packet
diff options
context:
space:
mode:
authorRaeders <38367311+nebula161@users.noreply.github.com>2026-01-23 23:04:54 -0500
committerGitHub <noreply@github.com>2026-01-23 22:04:54 -0600
commitd665924eb2163fc8afe256e502a39e72ad0e4a42 (patch)
tree5050630905b9802ef254e4352ac6d5c23116cacc /azalea-client/src/plugins/packet
parent4ab3609244d4eb87c3087f69f48083d9413a1cb3 (diff)
downloadazalea-drasl-d665924eb2163fc8afe256e502a39e72ad0e4a42.tar.xz
Implement SetExperience (#307)
Diffstat (limited to 'azalea-client/src/plugins/packet')
-rw-r--r--azalea-client/src/plugins/packet/game/events.rs2
-rw-r--r--azalea-client/src/plugins/packet/game/mod.rs19
2 files changed, 14 insertions, 7 deletions
diff --git a/azalea-client/src/plugins/packet/game/events.rs b/azalea-client/src/plugins/packet/game/events.rs
index bc070ec8..4a919382 100644
--- a/azalea-client/src/plugins/packet/game/events.rs
+++ b/azalea-client/src/plugins/packet/game/events.rs
@@ -2,8 +2,8 @@ use std::sync::{Arc, Weak};
use azalea_chat::FormattedText;
use azalea_protocol::packets::{
- Packet,
game::{ClientboundGamePacket, ClientboundPlayerCombatKill, ServerboundGamePacket},
+ Packet,
};
use azalea_world::{World, WorldName};
use bevy_ecs::prelude::*;
diff --git a/azalea-client/src/plugins/packet/game/mod.rs b/azalea-client/src/plugins/packet/game/mod.rs
index 6489c899..1fdceddf 100644
--- a/azalea-client/src/plugins/packet/game/mod.rs
+++ b/azalea-client/src/plugins/packet/game/mod.rs
@@ -8,15 +8,15 @@ use azalea_core::{
position::{ChunkPos, Vec3},
};
use azalea_entity::{
- ActiveEffects, Dead, EntityBundle, EntityKindComponent, HasClientLoaded, LoadedBy, LocalEntity,
- LookDirection, Physics, PlayerAbilities, Position, RelativeEntityUpdate,
indexing::{EntityIdIndex, EntityUuidIndex},
inventory::Inventory,
- metadata::{Health, apply_metadata},
+ metadata::{apply_metadata, Health},
+ ActiveEffects, Dead, EntityBundle, EntityKindComponent, HasClientLoaded, LoadedBy, LocalEntity,
+ LookDirection, Physics, PlayerAbilities, Position, RelativeEntityUpdate,
};
use azalea_protocol::{
common::movements::MoveFlags,
- packets::{ConnectionProtocol, game::*},
+ packets::{game::*, ConnectionProtocol},
};
use azalea_registry::builtin::EntityKind;
use azalea_world::{PartialWorld, WorldName, Worlds};
@@ -25,7 +25,6 @@ pub use events::*;
use tracing::{debug, error, trace, warn};
use crate::{
- ClientInformation,
block_update::QueuedServerBlockUpdates,
chat::{ChatPacket, ChatReceivedEvent},
chunks,
@@ -34,11 +33,12 @@ use crate::{
disconnect::DisconnectEvent,
interact::BlockStatePredictionHandler,
inventory::{ClientsideCloseContainerEvent, MenuOpenedEvent, SetContainerContentEvent},
- local_player::{Hunger, LocalGameMode, TabList, WorldHolder},
+ local_player::{Experience, Hunger, LocalGameMode, TabList, WorldHolder},
movement::{KnockbackData, KnockbackEvent},
packet::{as_system, declare_packet_handlers},
player::{GameProfileComponent, PlayerInfo},
tick_counter::TicksConnected,
+ ClientInformation,
};
pub fn process_packet(ecs: &mut World, player: Entity, packet: &ClientboundGamePacket) {
@@ -781,6 +781,13 @@ impl GamePacketHandler<'_> {
pub fn set_experience(&mut self, p: &ClientboundSetExperience) {
debug!("Got set experience packet {p:?}");
+
+ as_system::<Query<&mut Experience>>(self.ecs, |mut query| {
+ let mut experience = query.get_mut(self.player).unwrap();
+ experience.progress = p.experience_progress;
+ experience.level = p.experience_level;
+ experience.total = p.total_experience;
+ });
}
pub fn teleport_entity(&mut self, p: &ClientboundTeleportEntity) {