mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 23:44:38 +00:00
fix other tests
This commit is contained in:
parent
68ee9629ce
commit
bdbd418b02
1 changed files with 21 additions and 21 deletions
|
@ -1,12 +1,16 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use azalea_core::{
|
||||
position::{BlockPos, ChunkPos, Vec3},
|
||||
registry_holder::RegistryHolder,
|
||||
resource_location::ResourceLocation,
|
||||
tick::GameTick,
|
||||
};
|
||||
use azalea_entity::{EntityBundle, EntityPlugin, LocalEntity, Physics, Position};
|
||||
use azalea_physics::PhysicsPlugin;
|
||||
use azalea_world::{Chunk, InstanceContainer, MinecraftEntityId, PartialInstance};
|
||||
use azalea_world::{Chunk, Instance, InstanceContainer, MinecraftEntityId, PartialInstance};
|
||||
use bevy_app::App;
|
||||
use parking_lot::RwLock;
|
||||
use uuid::Uuid;
|
||||
|
||||
/// You need an app to spawn entities in the world and do updates.
|
||||
|
@ -17,14 +21,19 @@ fn make_test_app() -> App {
|
|||
app
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_gravity() {
|
||||
let mut app = make_test_app();
|
||||
let world_lock = app.world_mut().resource_mut::<InstanceContainer>().insert(
|
||||
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(),
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_gravity() {
|
||||
let mut app = make_test_app();
|
||||
let world_lock = insert_overworld(&mut app);
|
||||
let mut partial_world = PartialInstance::default();
|
||||
// the entity has to be in a loaded chunk for physics to work
|
||||
partial_world.chunks.set(
|
||||
|
@ -80,11 +89,7 @@ fn test_gravity() {
|
|||
#[test]
|
||||
fn test_collision() {
|
||||
let mut app = make_test_app();
|
||||
let world_lock = app.world_mut().resource_mut::<InstanceContainer>().insert(
|
||||
ResourceLocation::new("minecraft:overworld"),
|
||||
384,
|
||||
-64,
|
||||
);
|
||||
let world_lock = insert_overworld(&mut app);
|
||||
let mut partial_world = PartialInstance::default();
|
||||
|
||||
partial_world.chunks.set(
|
||||
|
@ -140,11 +145,7 @@ fn test_collision() {
|
|||
#[test]
|
||||
fn test_slab_collision() {
|
||||
let mut app = make_test_app();
|
||||
let world_lock = app.world_mut().resource_mut::<InstanceContainer>().insert(
|
||||
ResourceLocation::new("minecraft:overworld"),
|
||||
384,
|
||||
-64,
|
||||
);
|
||||
let world_lock = insert_overworld(&mut app);
|
||||
let mut partial_world = PartialInstance::default();
|
||||
|
||||
partial_world.chunks.set(
|
||||
|
@ -194,11 +195,7 @@ fn test_slab_collision() {
|
|||
#[test]
|
||||
fn test_top_slab_collision() {
|
||||
let mut app = make_test_app();
|
||||
let world_lock = app.world_mut().resource_mut::<InstanceContainer>().insert(
|
||||
ResourceLocation::new("minecraft:overworld"),
|
||||
384,
|
||||
-64,
|
||||
);
|
||||
let world_lock = insert_overworld(&mut app);
|
||||
let mut partial_world = PartialInstance::default();
|
||||
|
||||
partial_world.chunks.set(
|
||||
|
@ -251,6 +248,7 @@ fn test_weird_wall_collision() {
|
|||
ResourceLocation::new("minecraft:overworld"),
|
||||
384,
|
||||
-64,
|
||||
&RegistryHolder::default(),
|
||||
);
|
||||
let mut partial_world = PartialInstance::default();
|
||||
|
||||
|
@ -309,6 +307,7 @@ fn test_negative_coordinates_weird_wall_collision() {
|
|||
ResourceLocation::new("minecraft:overworld"),
|
||||
384,
|
||||
-64,
|
||||
&RegistryHolder::default(),
|
||||
);
|
||||
let mut partial_world = PartialInstance::default();
|
||||
|
||||
|
@ -371,6 +370,7 @@ fn spawn_and_unload_world() {
|
|||
ResourceLocation::new("minecraft:overworld"),
|
||||
384,
|
||||
-64,
|
||||
&RegistryHolder::default(),
|
||||
);
|
||||
let mut partial_world = PartialInstance::default();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue