@@ -20,7 +20,7 @@ use crate::{
2020 mutate_index:: MutateIndex ,
2121 registry:: {
2222 ReplicationRegistry ,
23- ctx:: { DespawnCtx , RemoveCtx , WriteCtx } ,
23+ ctx:: { DespawnCtx , EntitySpawner , RemoveCtx , WriteCtx } ,
2424 } ,
2525 signature:: SignatureMap ,
2626 track_mutate_messages:: TrackMutateMessages ,
@@ -523,9 +523,9 @@ fn apply_changes(
523523 let data_size: usize = postcard_utils:: from_buf ( message) ?;
524524
525525 let world_cell = world. as_unsafe_world_cell ( ) ;
526- let entities = world_cell . entities ( ) ;
527- // SAFETY: split into `Entities` and `DeferredEntity` .
528- // The latter won't apply any structural changes until `flush`, and `Entities` won't be used afterward.
526+ // SAFETY: split into `EntitySpawner` and `DeferredEntity`.
527+ // The latter won't apply any structural changes until `flush`, and `EntitySpawner` won't be used afterward .
528+ let mut spawner = EntitySpawner :: new ( unsafe { world_cell . world_mut ( ) } ) ;
529529 let world = unsafe { world_cell. world_mut ( ) } ;
530530
531531 let mut client_entity = match params. entity_map . server_entry ( server_entity) {
@@ -562,7 +562,7 @@ fn apply_changes(
562562 type_registry : params. type_registry ,
563563 component_id,
564564 message_tick,
565- entities ,
565+ spawner : & mut spawner ,
566566 ignore_mapping : false ,
567567 } ;
568568 trace ! (
@@ -653,9 +653,9 @@ fn apply_mutations(
653653 } ;
654654
655655 let world_cell = world. as_unsafe_world_cell ( ) ;
656- let entities = world_cell . entities ( ) ;
657- // SAFETY: split into `Entities` and `DeferredEntity` .
658- // The latter won't apply any structural changes until `flush`, and `Entities` won't be used afterward.
656+ // SAFETY: split into `EntitySpawner` and `DeferredEntity`.
657+ // The latter won't apply any structural changes until `flush`, and `EntitySpawner` won't be used afterward .
658+ let mut spawner = EntitySpawner :: new ( unsafe { world_cell . world_mut ( ) } ) ;
659659 let world = unsafe { world_cell. world_mut ( ) } ;
660660
661661 let Ok ( mut client_entity) = world
@@ -716,7 +716,7 @@ fn apply_mutations(
716716 type_registry : params. type_registry ,
717717 component_id,
718718 message_tick,
719- entities ,
719+ spawner : & mut spawner ,
720720 ignore_mapping : false ,
721721 } ;
722722 trace ! (
0 commit comments