From 4f288b1c031065805f5eb11362fe762f2e295c12 Mon Sep 17 00:00:00 2001 From: mat Date: Mon, 26 Feb 2024 00:55:27 -0600 Subject: optimize physics a bit more --- azalea/src/pathfinder/simulation.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'azalea/src') diff --git a/azalea/src/pathfinder/simulation.rs b/azalea/src/pathfinder/simulation.rs index a5e8113f..2803b846 100644 --- a/azalea/src/pathfinder/simulation.rs +++ b/azalea/src/pathfinder/simulation.rs @@ -87,14 +87,13 @@ fn create_simulation_instance(chunks: ChunkStorage) -> (App, Arc>, - player: SimulatedPlayerBundle, -) -> Entity { + player: &SimulatedPlayerBundle, +) -> impl Bundle { let instance_name = simulation_instance_name(); - let mut entity = ecs.spawn(( + ( MinecraftEntityId(0), azalea_entity::LocalEntity, azalea_entity::metadata::PlayerMetadataBundle::default(), @@ -110,9 +109,16 @@ fn create_simulation_player( instance: instance.clone(), }, InventoryComponent::default(), - )); - entity.insert(player); + ) +} +fn create_simulation_player( + ecs: &mut World, + instance: Arc>, + player: SimulatedPlayerBundle, +) -> Entity { + let mut entity = ecs.spawn(create_simulation_player_complete_bundle(instance, &player)); + entity.insert(player); entity.id() } -- cgit v1.2.3