mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 06:16:04 +00:00
fix errors when switching worlds
This commit is contained in:
parent
900a4234e5
commit
53fca5faf4
7 changed files with 23 additions and 20 deletions
|
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -152,7 +152,7 @@ pub struct DimensionTypeElement {
|
|||
pub natural: bool,
|
||||
pub piglin_safe: bool,
|
||||
pub respawn_anchor_works: bool,
|
||||
pub ultrawarm: bool,
|
||||
pub ultrawarm: Option<bool>,
|
||||
}
|
||||
|
||||
/// Dimension attributes.
|
||||
|
@ -161,7 +161,7 @@ pub struct DimensionTypeElement {
|
|||
pub struct DimensionTypeElement {
|
||||
pub height: u32,
|
||||
pub min_y: i32,
|
||||
pub ultrawarm: bool,
|
||||
pub ultrawarm: Option<bool>,
|
||||
#[simdnbt(flatten)]
|
||||
pub _extra: HashMap<String, NbtTag>,
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ pub fn update_in_water_state_and_do_fluid_pushing(
|
|||
.registries
|
||||
.dimension_type()
|
||||
.and_then(|d| d.map.get(instance_name).map(|d| d.ultrawarm))
|
||||
== Some(true);
|
||||
== Some(Some(true));
|
||||
let lava_push_factor = if is_ultrawarm {
|
||||
0.007
|
||||
} else {
|
||||
|
|
|
@ -7,7 +7,7 @@ use azalea_core::{
|
|||
|
||||
#[derive(Clone, Debug, AzBuf)]
|
||||
pub struct CommonPlayerSpawnInfo {
|
||||
pub dimension_type: azalea_registry::DimensionType,
|
||||
pub dimension: azalea_registry::DimensionType,
|
||||
pub dimension: ResourceLocation,
|
||||
pub seed: i64,
|
||||
pub game_type: GameMode,
|
||||
|
|
|
@ -9,7 +9,7 @@ use derive_more::{Deref, DerefMut};
|
|||
use nohash_hasher::IntMap;
|
||||
use parking_lot::RwLock;
|
||||
use rustc_hash::FxHashMap;
|
||||
use tracing::error;
|
||||
use tracing::{debug, error};
|
||||
|
||||
use crate::{ChunkStorage, Instance};
|
||||
|
||||
|
@ -43,7 +43,7 @@ impl InstanceContainer {
|
|||
self.instances.get(name).and_then(|world| world.upgrade())
|
||||
}
|
||||
|
||||
/// Add an empty world to the container (or not if it already exists) and
|
||||
/// Add an empty world to the container (unless it already exists) and
|
||||
/// returns a strong reference to the world.
|
||||
#[must_use = "the world will be immediately forgotten if unused"]
|
||||
pub fn insert(
|
||||
|
@ -74,6 +74,7 @@ impl InstanceContainer {
|
|||
entity_by_id: IntMap::default(),
|
||||
registries: RegistryHolder::default(),
|
||||
}));
|
||||
debug!("Added new instance {name}");
|
||||
self.instances.insert(name, Arc::downgrade(&world));
|
||||
world
|
||||
}
|
||||
|
|
1
registries.txt
Normal file
1
registries.txt
Normal file
|
@ -0,0 +1 @@
|
|||
{}
|
Loading…
Add table
Reference in a new issue