@@ -246,26 +246,20 @@ pub fn process_packet_events(ecs: &mut World) {
246246 . insert ( InstanceName ( new_instance_name. clone ( ) ) ) ;
247247 }
248248
249- let Some ( dimension_type_element) =
250- instance_holder. instance . read ( ) . registries . dimension_type ( )
249+ let Some ( ( _dimension_type, dimension_data) ) = p
250+ . common
251+ . dimension_type ( & instance_holder. instance . read ( ) . registries )
251252 else {
252- error ! ( "Server didn't send dimension type registry, can't log in" ) ;
253- continue ;
254- } ;
255-
256- let dimension_name = ResourceLocation :: new ( & p. common . dimension . to_string ( ) ) ;
257-
258- let Some ( dimension) = dimension_type_element. map . get ( & dimension_name) else {
259- error ! ( "No dimension_type with name {dimension_name}" ) ;
260253 continue ;
261254 } ;
262255
263256 // add this world to the instance_container (or don't if it's already
264257 // there)
265258 let weak_instance = instance_container. insert (
266259 new_instance_name. clone ( ) ,
267- dimension. height ,
268- dimension. min_y ,
260+ dimension_data. height ,
261+ dimension_data. min_y ,
262+ & instance_holder. instance . read ( ) . registries ,
269263 ) ;
270264 instance_loaded_events. send ( InstanceLoadedEvent {
271265 entity : player_entity,
@@ -610,7 +604,7 @@ pub fn process_packet_events(ecs: &mut World) {
610604 // debug!("Got light update packet {p:?}");
611605 }
612606 ClientboundGamePacket :: LevelChunkWithLight ( p) => {
613- debug ! ( "Got chunk with light packet {} {} " , p. x , p . z ) ;
607+ debug ! ( "Got chunk with light packet {:?} " , p. pos ) ;
614608
615609 let mut system_state: SystemState < EventWriter < chunks:: ReceiveChunkEvent > > =
616610 SystemState :: new ( ecs) ;
@@ -1387,26 +1381,20 @@ pub fn process_packet_events(ecs: &mut World) {
13871381 {
13881382 let new_instance_name = p. common . dimension . clone ( ) ;
13891383
1390- let Some ( dimension_type_element) =
1391- instance_holder. instance . read ( ) . registries . dimension_type ( )
1384+ let Some ( ( _dimension_type, dimension_data) ) = p
1385+ . common
1386+ . dimension_type ( & instance_holder. instance . read ( ) . registries )
13921387 else {
1393- error ! ( "Server didn't send dimension type registry, can't log in." ) ;
1394- continue ;
1395- } ;
1396-
1397- let dimension_name = ResourceLocation :: new ( & p. common . dimension . to_string ( ) ) ;
1398-
1399- let Some ( dimension) = dimension_type_element. map . get ( & dimension_name) else {
1400- error ! ( "No dimension_type with name {dimension_name}" ) ;
14011388 continue ;
14021389 } ;
14031390
14041391 // add this world to the instance_container (or don't if it's already
14051392 // there)
14061393 let weak_instance = instance_container. insert (
14071394 new_instance_name. clone ( ) ,
1408- dimension. height ,
1409- dimension. min_y ,
1395+ dimension_data. height ,
1396+ dimension_data. min_y ,
1397+ & instance_holder. instance . read ( ) . registries ,
14101398 ) ;
14111399 instance_loaded_events. send ( InstanceLoadedEvent {
14121400 entity : player_entity,
0 commit comments