diff options
| author | mat <git@matdoes.dev> | 2025-05-02 01:20:25 +0000 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-05-02 01:20:25 +0000 |
| commit | 881055e58711838893416bfc555e0643c5cfa515 (patch) | |
| tree | 20eca9e01a7422e0a8fb35651307f0420c931339 /azalea-physics | |
| parent | 11a74f215e28d7c3971c9894351567edb68ef0f8 (diff) | |
| download | azalea-drasl-881055e58711838893416bfc555e0643c5cfa515.tar.xz | |
fix InstanceName desync
Diffstat (limited to 'azalea-physics')
| -rw-r--r-- | azalea-physics/tests/physics.rs | 59 |
1 files changed, 35 insertions, 24 deletions
diff --git a/azalea-physics/tests/physics.rs b/azalea-physics/tests/physics.rs index 396c34f9..ebe1cfad 100644 --- a/azalea-physics/tests/physics.rs +++ b/azalea-physics/tests/physics.rs @@ -26,12 +26,14 @@ fn make_test_app() -> App { } pub fn insert_overworld(app: &mut App) -> Arc<RwLock<Instance>> { - app.world_mut().resource_mut::<InstanceContainer>().insert( - ResourceLocation::new("minecraft:overworld"), - 384, - -64, - &RegistryHolder::default(), - ) + app.world_mut() + .resource_mut::<InstanceContainer>() + .get_or_insert( + ResourceLocation::new("minecraft:overworld"), + 384, + -64, + &RegistryHolder::default(), + ) } #[test] @@ -248,12 +250,15 @@ fn test_top_slab_collision() { #[test] fn test_weird_wall_collision() { let mut app = make_test_app(); - let world_lock = app.world_mut().resource_mut::<InstanceContainer>().insert( - ResourceLocation::new("minecraft:overworld"), - 384, - -64, - &RegistryHolder::default(), - ); + let world_lock = app + .world_mut() + .resource_mut::<InstanceContainer>() + .get_or_insert( + ResourceLocation::new("minecraft:overworld"), + 384, + -64, + &RegistryHolder::default(), + ); let mut partial_world = PartialInstance::default(); partial_world.chunks.set( @@ -307,12 +312,15 @@ fn test_weird_wall_collision() { #[test] fn test_negative_coordinates_weird_wall_collision() { let mut app = make_test_app(); - let world_lock = app.world_mut().resource_mut::<InstanceContainer>().insert( - ResourceLocation::new("minecraft:overworld"), - 384, - -64, - &RegistryHolder::default(), - ); + let world_lock = app + .world_mut() + .resource_mut::<InstanceContainer>() + .get_or_insert( + ResourceLocation::new("minecraft:overworld"), + 384, + -64, + &RegistryHolder::default(), + ); let mut partial_world = PartialInstance::default(); partial_world.chunks.set( @@ -370,12 +378,15 @@ fn test_negative_coordinates_weird_wall_collision() { #[test] fn spawn_and_unload_world() { let mut app = make_test_app(); - let world_lock = app.world_mut().resource_mut::<InstanceContainer>().insert( - ResourceLocation::new("minecraft:overworld"), - 384, - -64, - &RegistryHolder::default(), - ); + let world_lock = app + .world_mut() + .resource_mut::<InstanceContainer>() + .get_or_insert( + ResourceLocation::new("minecraft:overworld"), + 384, + -64, + &RegistryHolder::default(), + ); let mut partial_world = PartialInstance::default(); partial_world.chunks.set( |
