1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 06:16:04 +00:00

insert ClientInformation earlier

This commit is contained in:
mat 2025-06-08 13:37:23 -13:00
parent 3087b0c996
commit 45d7371274
6 changed files with 19 additions and 18 deletions

View file

@ -55,7 +55,7 @@ impl<S> CommandDispatcher<S> {
build
}
pub fn parse(&self, command: StringReader, source: S) -> ParseResults<S> {
pub fn parse(&self, command: StringReader, source: S) -> ParseResults<'_, S> {
let source = Arc::new(source);
let context = CommandContextBuilder::new(self, source, self.root.clone(), command.cursor());

View file

@ -572,7 +572,6 @@ impl Client {
#[derive(Bundle)]
pub struct LocalPlayerBundle {
pub raw_connection: RawConnection,
pub client_information: ClientInformation,
pub instance_holder: InstanceHolder,
pub metadata: azalea_entity::metadata::PlayerMetadataBundle,

View file

@ -129,6 +129,8 @@ pub fn handle_start_join_server_event(
// localentity is always present for our clients, even if we're not actually logged
// in
LocalEntity,
// this is inserted early so the user can always access and modify it
ClientInformation::default(),
// ConnectOpts is inserted as a component here
event.connect_opts.clone(),
// we don't insert InLoginState until we actually create the connection. note that
@ -216,7 +218,6 @@ pub fn poll_create_connection_task(
write_conn,
ConnectionProtocol::Login,
),
client_information: ClientInformation::default(),
instance_holder,
metadata: azalea_entity::metadata::PlayerMetadataBundle::default(),
},

View file

@ -11,14 +11,17 @@ use azalea_core::{
tick::GameTick,
};
use azalea_entity::metadata::PlayerMetadataBundle;
use azalea_protocol::packets::{
ConnectionProtocol, Packet, ProtocolPacket,
common::CommonPlayerSpawnInfo,
config::{ClientboundFinishConfiguration, ClientboundRegistryData},
game::{
ClientboundAddEntity, ClientboundLevelChunkWithLight, ClientboundLogin, ClientboundRespawn,
c_level_chunk_with_light::ClientboundLevelChunkPacketData,
c_light_update::ClientboundLightUpdatePacketData,
use azalea_protocol::{
common::client_information::ClientInformation,
packets::{
ConnectionProtocol, Packet, ProtocolPacket,
common::CommonPlayerSpawnInfo,
config::{ClientboundFinishConfiguration, ClientboundRegistryData},
game::{
ClientboundAddEntity, ClientboundLevelChunkWithLight, ClientboundLogin,
ClientboundRespawn, c_level_chunk_with_light::ClientboundLevelChunkPacketData,
c_light_update::ClientboundLightUpdatePacketData,
},
},
};
use azalea_registry::{Biome, DimensionType, EntityKind};
@ -30,8 +33,8 @@ use simdnbt::owned::{NbtCompound, NbtTag};
use uuid::Uuid;
use crate::{
ClientInformation, InConfigState, LocalPlayerBundle, connection::RawConnection,
disconnect::DisconnectEvent, local_player::InstanceHolder, player::GameProfileComponent,
InConfigState, LocalPlayerBundle, connection::RawConnection, disconnect::DisconnectEvent,
local_player::InstanceHolder, player::GameProfileComponent,
};
/// A way to simulate a client in a server, used for some internal tests.
@ -49,7 +52,7 @@ impl Simulation {
let mut entity = app.world_mut().spawn_empty();
let (player, rt) =
create_local_player_bundle(entity.id(), ConnectionProtocol::Configuration);
entity.insert(player);
entity.insert((player, ClientInformation::default()));
let entity = entity.id();
@ -171,7 +174,6 @@ fn create_local_player_bundle(
let local_player_bundle = LocalPlayerBundle {
raw_connection,
client_information: ClientInformation::default(),
instance_holder,
metadata: PlayerMetadataBundle::default(),
};

View file

@ -1,10 +1,9 @@
use bevy_log::tracing_subscriber::{
self, EnvFilter, Layer,
layer::{Context, SubscriberExt},
registry::LookupSpan,
util::SubscriberInitExt,
};
use tracing::{Event, Level, Subscriber, level_filters::LevelFilter};
use tracing::{Event, Level, Subscriber};
pub fn init_tracing() {
init_tracing_with_level(Level::WARN);

View file

@ -219,7 +219,7 @@ impl BitStorage {
self.size
}
pub fn iter(&self) -> BitStorageIter {
pub fn iter(&self) -> BitStorageIter<'_> {
BitStorageIter {
storage: self,
index: 0,