mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 23:44:38 +00:00
insert ClientInformation earlier
This commit is contained in:
parent
3087b0c996
commit
45d7371274
6 changed files with 19 additions and 18 deletions
|
@ -55,7 +55,7 @@ impl<S> CommandDispatcher<S> {
|
||||||
build
|
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 source = Arc::new(source);
|
||||||
|
|
||||||
let context = CommandContextBuilder::new(self, source, self.root.clone(), command.cursor());
|
let context = CommandContextBuilder::new(self, source, self.root.clone(), command.cursor());
|
||||||
|
|
|
@ -572,7 +572,6 @@ impl Client {
|
||||||
#[derive(Bundle)]
|
#[derive(Bundle)]
|
||||||
pub struct LocalPlayerBundle {
|
pub struct LocalPlayerBundle {
|
||||||
pub raw_connection: RawConnection,
|
pub raw_connection: RawConnection,
|
||||||
pub client_information: ClientInformation,
|
|
||||||
pub instance_holder: InstanceHolder,
|
pub instance_holder: InstanceHolder,
|
||||||
|
|
||||||
pub metadata: azalea_entity::metadata::PlayerMetadataBundle,
|
pub metadata: azalea_entity::metadata::PlayerMetadataBundle,
|
||||||
|
|
|
@ -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
|
// localentity is always present for our clients, even if we're not actually logged
|
||||||
// in
|
// in
|
||||||
LocalEntity,
|
LocalEntity,
|
||||||
|
// this is inserted early so the user can always access and modify it
|
||||||
|
ClientInformation::default(),
|
||||||
// ConnectOpts is inserted as a component here
|
// ConnectOpts is inserted as a component here
|
||||||
event.connect_opts.clone(),
|
event.connect_opts.clone(),
|
||||||
// we don't insert InLoginState until we actually create the connection. note that
|
// 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,
|
write_conn,
|
||||||
ConnectionProtocol::Login,
|
ConnectionProtocol::Login,
|
||||||
),
|
),
|
||||||
client_information: ClientInformation::default(),
|
|
||||||
instance_holder,
|
instance_holder,
|
||||||
metadata: azalea_entity::metadata::PlayerMetadataBundle::default(),
|
metadata: azalea_entity::metadata::PlayerMetadataBundle::default(),
|
||||||
},
|
},
|
||||||
|
|
|
@ -11,14 +11,17 @@ use azalea_core::{
|
||||||
tick::GameTick,
|
tick::GameTick,
|
||||||
};
|
};
|
||||||
use azalea_entity::metadata::PlayerMetadataBundle;
|
use azalea_entity::metadata::PlayerMetadataBundle;
|
||||||
use azalea_protocol::packets::{
|
use azalea_protocol::{
|
||||||
ConnectionProtocol, Packet, ProtocolPacket,
|
common::client_information::ClientInformation,
|
||||||
common::CommonPlayerSpawnInfo,
|
packets::{
|
||||||
config::{ClientboundFinishConfiguration, ClientboundRegistryData},
|
ConnectionProtocol, Packet, ProtocolPacket,
|
||||||
game::{
|
common::CommonPlayerSpawnInfo,
|
||||||
ClientboundAddEntity, ClientboundLevelChunkWithLight, ClientboundLogin, ClientboundRespawn,
|
config::{ClientboundFinishConfiguration, ClientboundRegistryData},
|
||||||
c_level_chunk_with_light::ClientboundLevelChunkPacketData,
|
game::{
|
||||||
c_light_update::ClientboundLightUpdatePacketData,
|
ClientboundAddEntity, ClientboundLevelChunkWithLight, ClientboundLogin,
|
||||||
|
ClientboundRespawn, c_level_chunk_with_light::ClientboundLevelChunkPacketData,
|
||||||
|
c_light_update::ClientboundLightUpdatePacketData,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use azalea_registry::{Biome, DimensionType, EntityKind};
|
use azalea_registry::{Biome, DimensionType, EntityKind};
|
||||||
|
@ -30,8 +33,8 @@ use simdnbt::owned::{NbtCompound, NbtTag};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
ClientInformation, InConfigState, LocalPlayerBundle, connection::RawConnection,
|
InConfigState, LocalPlayerBundle, connection::RawConnection, disconnect::DisconnectEvent,
|
||||||
disconnect::DisconnectEvent, local_player::InstanceHolder, player::GameProfileComponent,
|
local_player::InstanceHolder, player::GameProfileComponent,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// A way to simulate a client in a server, used for some internal tests.
|
/// 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 mut entity = app.world_mut().spawn_empty();
|
||||||
let (player, rt) =
|
let (player, rt) =
|
||||||
create_local_player_bundle(entity.id(), ConnectionProtocol::Configuration);
|
create_local_player_bundle(entity.id(), ConnectionProtocol::Configuration);
|
||||||
entity.insert(player);
|
entity.insert((player, ClientInformation::default()));
|
||||||
|
|
||||||
let entity = entity.id();
|
let entity = entity.id();
|
||||||
|
|
||||||
|
@ -171,7 +174,6 @@ fn create_local_player_bundle(
|
||||||
|
|
||||||
let local_player_bundle = LocalPlayerBundle {
|
let local_player_bundle = LocalPlayerBundle {
|
||||||
raw_connection,
|
raw_connection,
|
||||||
client_information: ClientInformation::default(),
|
|
||||||
instance_holder,
|
instance_holder,
|
||||||
metadata: PlayerMetadataBundle::default(),
|
metadata: PlayerMetadataBundle::default(),
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
use bevy_log::tracing_subscriber::{
|
use bevy_log::tracing_subscriber::{
|
||||||
self, EnvFilter, Layer,
|
self, EnvFilter, Layer,
|
||||||
layer::{Context, SubscriberExt},
|
layer::{Context, SubscriberExt},
|
||||||
registry::LookupSpan,
|
|
||||||
util::SubscriberInitExt,
|
util::SubscriberInitExt,
|
||||||
};
|
};
|
||||||
use tracing::{Event, Level, Subscriber, level_filters::LevelFilter};
|
use tracing::{Event, Level, Subscriber};
|
||||||
|
|
||||||
pub fn init_tracing() {
|
pub fn init_tracing() {
|
||||||
init_tracing_with_level(Level::WARN);
|
init_tracing_with_level(Level::WARN);
|
||||||
|
|
|
@ -219,7 +219,7 @@ impl BitStorage {
|
||||||
self.size
|
self.size
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn iter(&self) -> BitStorageIter {
|
pub fn iter(&self) -> BitStorageIter<'_> {
|
||||||
BitStorageIter {
|
BitStorageIter {
|
||||||
storage: self,
|
storage: self,
|
||||||
index: 0,
|
index: 0,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue