aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src/packet_handling.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2023-07-23 23:21:08 -0500
committermat <git@matdoes.dev>2023-07-23 23:21:08 -0500
commit22ea8c60fed17e48a591bcbb82808fed55509386 (patch)
treea85be1738270f7fb2a133b20629f2db0464e58f2 /azalea-client/src/packet_handling.rs
parent15acf1347727b84472e6a8a1c7a4f51cd3163f01 (diff)
downloadazalea-drasl-22ea8c60fed17e48a591bcbb82808fed55509386.tar.xz
fix sometimes not receiving chunks
Diffstat (limited to 'azalea-client/src/packet_handling.rs')
-rw-r--r--azalea-client/src/packet_handling.rs24
1 files changed, 13 insertions, 11 deletions
diff --git a/azalea-client/src/packet_handling.rs b/azalea-client/src/packet_handling.rs
index bf438de0..158fbb83 100644
--- a/azalea-client/src/packet_handling.rs
+++ b/azalea-client/src/packet_handling.rs
@@ -188,7 +188,7 @@ pub fn send_packet_events(
}
}
-fn process_packet_events(ecs: &mut World) {
+pub fn process_packet_events(ecs: &mut World) {
let mut events_owned = Vec::new();
let mut system_state: SystemState<EventReader<PacketEvent>> = SystemState::new(ecs);
let mut events = system_state.get_mut(ecs);
@@ -254,7 +254,9 @@ fn process_packet_events(ecs: &mut World) {
// instance_container)
*local_player.partial_instance.write() = PartialInstance::new(
- client_information.view_distance.into(),
+ azalea_world::calculate_chunk_storage_range(
+ client_information.view_distance.into(),
+ ),
// this argument makes it so other clients don't update this
// player entity
// in a shared world
@@ -282,25 +284,25 @@ fn process_packet_events(ecs: &mut World) {
));
}
- // send the client information that we have set
- log::debug!(
- "Sending client information because login: {:?}",
- client_information
- );
- local_player.write_packet(client_information.clone().get());
-
// brand
let mut brand_data = Vec::new();
- "vanilla".to_string().write_into(&mut brand_data).unwrap();
+ // they don't have to know :)
+ "vanilla".write_into(&mut brand_data).unwrap();
local_player.write_packet(
ServerboundCustomPayloadPacket {
identifier: ResourceLocation::new("brand"),
- // they don't have to know :)
data: brand_data.into(),
}
.get(),
);
+ // send the client information that we have set
+ log::debug!(
+ "Sending client information because login: {:?}",
+ client_information
+ );
+ local_player.write_packet(client_information.clone().get());
+
system_state.apply(ecs);
}
ClientboundGamePacket::SetChunkCacheRadius(p) => {