aboutsummaryrefslogtreecommitdiff
path: root/azalea
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2024-02-26 00:55:27 -0600
committermat <git@matdoes.dev>2024-02-26 00:55:46 -0600
commit4f288b1c031065805f5eb11362fe762f2e295c12 (patch)
tree4c860b357b1d999d138bb218e62e29ef5e953dd6 /azalea
parente47dee388e1e7f051417244ab1c054f8b9acd755 (diff)
downloadazalea-drasl-4f288b1c031065805f5eb11362fe762f2e295c12.tar.xz
optimize physics a bit more
Diffstat (limited to 'azalea')
-rw-r--r--azalea/src/pathfinder/simulation.rs20
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()
}