diff options
| author | mat <git@matdoes.dev> | 2024-02-26 00:55:27 -0600 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2024-02-26 00:55:46 -0600 |
| commit | 4f288b1c031065805f5eb11362fe762f2e295c12 (patch) | |
| tree | 4c860b357b1d999d138bb218e62e29ef5e953dd6 /azalea | |
| parent | e47dee388e1e7f051417244ab1c054f8b9acd755 (diff) | |
| download | azalea-drasl-4f288b1c031065805f5eb11362fe762f2e295c12.tar.xz | |
optimize physics a bit more
Diffstat (limited to 'azalea')
| -rw-r--r-- | azalea/src/pathfinder/simulation.rs | 20 |
1 files changed, 13 insertions, 7 deletions
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<RwLock<Instance (app, instance) } -fn create_simulation_player( - ecs: &mut World, +fn create_simulation_player_complete_bundle( instance: Arc<RwLock<Instance>>, - 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<RwLock<Instance>>, + player: SimulatedPlayerBundle, +) -> Entity { + let mut entity = ecs.spawn(create_simulation_player_complete_bundle(instance, &player)); + entity.insert(player); entity.id() } |
