diff options
| author | mat <git@matdoes.dev> | 2025-01-21 23:53:11 +0000 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-01-21 23:53:11 +0000 |
| commit | 53fca5faf4878c7afcd65f1eb0811c2b8e02a214 (patch) | |
| tree | 9784b9f5f66f330230e774a7b40f31f4061ddd23 /azalea-client | |
| parent | 900a4234e5b7fbf24a557907bce7c3b7ce30822e (diff) | |
| download | azalea-drasl-53fca5faf4878c7afcd65f1eb0811c2b8e02a214.tar.xz | |
fix errors when switching worlds
Diffstat (limited to 'azalea-client')
| -rw-r--r-- | azalea-client/src/chunks.rs | 5 | ||||
| -rw-r--r-- | azalea-client/src/packet_handling/game.rs | 24 |
2 files changed, 15 insertions, 14 deletions
diff --git a/azalea-client/src/chunks.rs b/azalea-client/src/chunks.rs index 7056efa4..0267c164 100644 --- a/azalea-client/src/chunks.rs +++ b/azalea-client/src/chunks.rs @@ -111,7 +111,10 @@ pub fn handle_receive_chunk_events( heightmaps, &mut instance.chunks, ) { - error!("Couldn't set chunk data: {e}"); + error!( + "Couldn't set chunk data: {e}. World height: {}", + instance.chunks.height + ); } } } diff --git a/azalea-client/src/packet_handling/game.rs b/azalea-client/src/packet_handling/game.rs index 57e6ce68..4553ae6a 100644 --- a/azalea-client/src/packet_handling/game.rs +++ b/azalea-client/src/packet_handling/game.rs @@ -253,13 +253,12 @@ pub fn process_packet_events(ecs: &mut World) { continue; }; - let dimension_type = - ResourceLocation::new(&p.common.dimension_type.to_string()); + let dimension_name = ResourceLocation::new(&p.common.dimension.to_string()); - let dimension = dimension_type_element - .map - .get(&dimension_type) - .unwrap_or_else(|| panic!("No dimension_type with name {dimension_type}")); + let Some(dimension) = dimension_type_element.map.get(&dimension_name) else { + error!("No dimension_type with name {dimension_name}") + continue; + }; // add this world to the instance_container (or don't if it's already // there) @@ -1394,17 +1393,16 @@ pub fn process_packet_events(ecs: &mut World) { let Some(dimension_type_element) = instance_holder.instance.read().registries.dimension_type() else { - error!("Server didn't send dimension type registry, can't log in"); + error!("Server didn't send dimension type registry, can't log in."); continue; }; - let dimension_type = - ResourceLocation::new(&p.common.dimension_type.to_string()); + let dimension_name = ResourceLocation::new(&p.common.dimension.to_string()); - let dimension = dimension_type_element - .map - .get(&dimension_type) - .unwrap_or_else(|| panic!("No dimension_type with name {dimension_type}")); + let Some(dimension) = dimension_type_element.map.get(&dimension_name) else { + error!("No dimension_type with name {dimension_name}"); + continue; + }; // add this world to the instance_container (or don't if it's already // there) |
