diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2026-01-13 10:51:30 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-13 10:51:30 -0600 |
| commit | d5fa5e32b37754b3b5c136e58821e48cd3b7c2ff (patch) | |
| tree | ea04702f96ad170fb1d90e5ed2dc875ae8166495 /azalea-physics/tests | |
| parent | efb36d5fc0fe56a98f5795c53dfa109887cd5aae (diff) | |
| download | azalea-drasl-d5fa5e32b37754b3b5c136e58821e48cd3b7c2ff.tar.xz | |
Rename Instance to World (#304)
Diffstat (limited to 'azalea-physics/tests')
| -rw-r--r-- | azalea-physics/tests/physics.rs | 102 |
1 files changed, 44 insertions, 58 deletions
diff --git a/azalea-physics/tests/physics.rs b/azalea-physics/tests/physics.rs index 42dcf809..8359e05e 100644 --- a/azalea-physics/tests/physics.rs +++ b/azalea-physics/tests/physics.rs @@ -12,11 +12,8 @@ use azalea_core::{ }; use azalea_entity::{EntityBundle, EntityPlugin, HasClientLoaded, LocalEntity, Physics, Position}; use azalea_physics::PhysicsPlugin; -use azalea_registry::{ - builtin::{BlockKind, EntityKind}, - identifier::Identifier, -}; -use azalea_world::{Chunk, Instance, InstanceContainer, PartialInstance}; +use azalea_registry::builtin::{BlockKind, EntityKind}; +use azalea_world::{Chunk, PartialWorld, World, WorldName, Worlds}; use bevy_app::App; use parking_lot::RwLock; use uuid::Uuid; @@ -25,26 +22,24 @@ use uuid::Uuid; fn make_test_app() -> App { let mut app = App::new(); app.add_plugins((PhysicsPlugin, EntityPlugin)) - .init_resource::<InstanceContainer>(); + .init_resource::<Worlds>(); app } -pub fn insert_overworld(app: &mut App) -> Arc<RwLock<Instance>> { - app.world_mut() - .resource_mut::<InstanceContainer>() - .get_or_insert( - Identifier::new("minecraft:overworld"), - 384, - -64, - &RegistryHolder::default(), - ) +pub fn insert_overworld(app: &mut App) -> Arc<RwLock<World>> { + app.world_mut().resource_mut::<Worlds>().get_or_insert( + WorldName::new("minecraft:overworld"), + 384, + -64, + &RegistryHolder::default(), + ) } #[test] fn test_gravity() { let mut app = make_test_app(); let world_lock = insert_overworld(&mut app); - let mut partial_world = PartialInstance::default(); + let mut partial_world = PartialWorld::default(); // the entity has to be in a loaded chunk for physics to work partial_world.chunks.set( &ChunkPos { x: 0, z: 0 }, @@ -63,7 +58,7 @@ fn test_gravity() { z: 0., }, EntityKind::Zombie, - Identifier::new("minecraft:overworld"), + WorldName::new("minecraft:overworld"), ), MinecraftEntityId(0), LocalEntity, @@ -101,7 +96,7 @@ fn test_gravity() { fn test_collision() { let mut app = make_test_app(); let world_lock = insert_overworld(&mut app); - let mut partial_world = PartialInstance::default(); + let mut partial_world = PartialWorld::default(); partial_world.chunks.set( &ChunkPos { x: 0, z: 0 }, @@ -119,7 +114,7 @@ fn test_collision() { z: 0.5, }, EntityKind::Player, - Identifier::new("minecraft:overworld"), + WorldName::new("minecraft:overworld"), ), MinecraftEntityId(0), LocalEntity, @@ -158,7 +153,7 @@ fn test_collision() { fn test_slab_collision() { let mut app = make_test_app(); let world_lock = insert_overworld(&mut app); - let mut partial_world = PartialInstance::default(); + let mut partial_world = PartialWorld::default(); partial_world.chunks.set( &ChunkPos { x: 0, z: 0 }, @@ -176,7 +171,7 @@ fn test_slab_collision() { z: 0.5, }, EntityKind::Player, - Identifier::new("minecraft:overworld"), + WorldName::new("minecraft:overworld"), ), MinecraftEntityId(0), LocalEntity, @@ -209,7 +204,7 @@ fn test_slab_collision() { fn test_top_slab_collision() { let mut app = make_test_app(); let world_lock = insert_overworld(&mut app); - let mut partial_world = PartialInstance::default(); + let mut partial_world = PartialWorld::default(); partial_world.chunks.set( &ChunkPos { x: 0, z: 0 }, @@ -227,7 +222,7 @@ fn test_top_slab_collision() { z: 0.5, }, EntityKind::Player, - Identifier::new("minecraft:overworld"), + WorldName::new("minecraft:overworld"), ), MinecraftEntityId(0), LocalEntity, @@ -258,16 +253,13 @@ 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>() - .get_or_insert( - Identifier::new("minecraft:overworld"), - 384, - -64, - &RegistryHolder::default(), - ); - let mut partial_world = PartialInstance::default(); + let world_lock = app.world_mut().resource_mut::<Worlds>().get_or_insert( + WorldName::new("minecraft:overworld"), + 384, + -64, + &RegistryHolder::default(), + ); + let mut partial_world = PartialWorld::default(); partial_world.chunks.set( &ChunkPos { x: 0, z: 0 }, @@ -285,7 +277,7 @@ fn test_weird_wall_collision() { z: 0.5, }, EntityKind::Player, - Identifier::new("minecraft:overworld"), + WorldName::new("minecraft:overworld"), ), MinecraftEntityId(0), LocalEntity, @@ -321,16 +313,13 @@ 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>() - .get_or_insert( - Identifier::new("minecraft:overworld"), - 384, - -64, - &RegistryHolder::default(), - ); - let mut partial_world = PartialInstance::default(); + let world_lock = app.world_mut().resource_mut::<Worlds>().get_or_insert( + WorldName::new("minecraft:overworld"), + 384, + -64, + &RegistryHolder::default(), + ); + let mut partial_world = PartialWorld::default(); partial_world.chunks.set( &ChunkPos { x: -1, z: -1 }, @@ -348,7 +337,7 @@ fn test_negative_coordinates_weird_wall_collision() { z: -7.5, }, EntityKind::Player, - Identifier::new("minecraft:overworld"), + WorldName::new("minecraft:overworld"), ), MinecraftEntityId(0), LocalEntity, @@ -388,16 +377,13 @@ 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>() - .get_or_insert( - Identifier::new("minecraft:overworld"), - 384, - -64, - &RegistryHolder::default(), - ); - let mut partial_world = PartialInstance::default(); + let world_lock = app.world_mut().resource_mut::<Worlds>().get_or_insert( + WorldName::new("minecraft:overworld"), + 384, + -64, + &RegistryHolder::default(), + ); + let mut partial_world = PartialWorld::default(); partial_world.chunks.set( &ChunkPos { x: -1, z: -1 }, @@ -415,7 +401,7 @@ fn spawn_and_unload_world() { z: -7.5, }, EntityKind::Player, - Identifier::new("minecraft:overworld"), + WorldName::new("minecraft:overworld"), ), MinecraftEntityId(0), LocalEntity, @@ -440,7 +426,7 @@ fn spawn_and_unload_world() { fn test_afk_pool() { let mut app = make_test_app(); let world_lock = insert_overworld(&mut app); - let mut partial_world = PartialInstance::default(); + let mut partial_world = PartialWorld::default(); partial_world.chunks.set( &ChunkPos { x: 0, z: 0 }, @@ -531,7 +517,7 @@ fn test_afk_pool() { z: 1.5, }, EntityKind::Player, - Identifier::new("minecraft:overworld"), + WorldName::new("minecraft:overworld"), ), MinecraftEntityId(0), LocalEntity, |
