Cleanup debugging in loading dimension

This commit is contained in:
ice_iix 2022-08-07 18:44:48 -07:00
parent ad5beac205
commit 400565f050
1 changed files with 7 additions and 6 deletions

View File

@ -1116,27 +1116,24 @@ impl Server {
&mut self, &mut self,
join: packet::play::clientbound::JoinGame_WorldNames_IsHard_SimDist_HasDeath, join: packet::play::clientbound::JoinGame_WorldNames_IsHard_SimDist_HasDeath,
) { ) {
let mut found_dimension = false;
if let Some(nbt::NamedTag(_, nbt::Tag::Compound(registries))) = join.registry_codec { if let Some(nbt::NamedTag(_, nbt::Tag::Compound(registries))) = join.registry_codec {
if let Some(nbt::Tag::Compound(dimension_types)) = if let Some(nbt::Tag::Compound(dimension_types)) =
registries.get("minecraft:dimension_type") registries.get("minecraft:dimension_type")
{ {
println!("world_name = {:?}", join.world_name);
println!("dimension_types = {:?}", dimension_types);
if let Some(nbt::Tag::List(list)) = dimension_types.get("value") { if let Some(nbt::Tag::List(list)) = dimension_types.get("value") {
println!("list = {:?}", list);
for item in list { for item in list {
if let nbt::Tag::Compound(item) = item { if let nbt::Tag::Compound(item) = item {
println!("item = {:?}", item);
if let Some(nbt::Tag::String(name)) = item.get("name") { if let Some(nbt::Tag::String(name)) = item.get("name") {
println!("name = {:?}", name); debug!("Dimension {:?} = {:?}", name, item);
if name == &join.world_name { if name == &join.world_name {
if let Some(nbt::Tag::Compound(dimension_type)) = if let Some(nbt::Tag::Compound(dimension_type)) =
item.get("element") item.get("element")
{ {
self.world.load_dimension_type_tags(dimension_type); self.world.load_dimension_type_tags(dimension_type);
found_dimension = true;
} }
} }
println!("match? {:?} ", name == &join.world_name);
} }
} }
} }
@ -1146,6 +1143,10 @@ impl Server {
let _biome_registry = registries.get("minecraft:worldgen/biome"); let _biome_registry = registries.get("minecraft:worldgen/biome");
let _chat_type_registry = registries.get("minecraft:chat_type"); let _chat_type_registry = registries.get("minecraft:chat_type");
} }
if !found_dimension {
warn!("Failed to find world name {} in dimension types of JoinGame - expect broken offsets", join.world_name);
//self.world.min_y = -64;
}
self.on_game_join(join.gamemode, join.entity_id) self.on_game_join(join.gamemode, join.entity_id)
} }