diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2025-02-21 13:43:56 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-21 13:43:56 -0600 |
| commit | 833f306e8b8faddd232b5c736b2134ed08adcb6c (patch) | |
| tree | 08a59009f3118d5c56891d6c4fb6a0293aa9e6fc /azalea-client/src/packet_handling | |
| parent | 63b1036a96c45b0fefc6ca2501f1cc479acc95de (diff) | |
| download | azalea-drasl-833f306e8b8faddd232b5c736b2134ed08adcb6c.tar.xz | |
Fix errors on switching dimensions (#204)
* Fix errors on switching dimensions
* fix other tests
* clippy
* fix log feature in test_simulation
* fix chunks oops
Diffstat (limited to 'azalea-client/src/packet_handling')
| -rw-r--r-- | azalea-client/src/packet_handling/game.rs | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/azalea-client/src/packet_handling/game.rs b/azalea-client/src/packet_handling/game.rs index 207cdd91..73442804 100644 --- a/azalea-client/src/packet_handling/game.rs +++ b/azalea-client/src/packet_handling/game.rs @@ -246,17 +246,10 @@ pub fn process_packet_events(ecs: &mut World) { .insert(InstanceName(new_instance_name.clone())); } - let Some(dimension_type_element) = - instance_holder.instance.read().registries.dimension_type() + let Some((_dimension_type, dimension_data)) = p + .common + .dimension_type(&instance_holder.instance.read().registries) else { - error!("Server didn't send dimension type registry, can't log in"); - continue; - }; - - let dimension_name = ResourceLocation::new(&p.common.dimension.to_string()); - - let Some(dimension) = dimension_type_element.map.get(&dimension_name) else { - error!("No dimension_type with name {dimension_name}"); continue; }; @@ -264,8 +257,9 @@ pub fn process_packet_events(ecs: &mut World) { // there) let weak_instance = instance_container.insert( new_instance_name.clone(), - dimension.height, - dimension.min_y, + dimension_data.height, + dimension_data.min_y, + &instance_holder.instance.read().registries, ); instance_loaded_events.send(InstanceLoadedEvent { entity: player_entity, @@ -1387,17 +1381,10 @@ pub fn process_packet_events(ecs: &mut World) { { let new_instance_name = p.common.dimension.clone(); - let Some(dimension_type_element) = - instance_holder.instance.read().registries.dimension_type() + let Some((_dimension_type, dimension_data)) = p + .common + .dimension_type(&instance_holder.instance.read().registries) else { - error!("Server didn't send dimension type registry, can't log in."); - continue; - }; - - let dimension_name = ResourceLocation::new(&p.common.dimension.to_string()); - - let Some(dimension) = dimension_type_element.map.get(&dimension_name) else { - error!("No dimension_type with name {dimension_name}"); continue; }; @@ -1405,8 +1392,9 @@ pub fn process_packet_events(ecs: &mut World) { // there) let weak_instance = instance_container.insert( new_instance_name.clone(), - dimension.height, - dimension.min_y, + dimension_data.height, + dimension_data.min_y, + &instance_holder.instance.read().registries, ); instance_loaded_events.send(InstanceLoadedEvent { entity: player_entity, |
