diff --git a/azalea-entity/src/plugin/mod.rs b/azalea-entity/src/plugin/mod.rs index 6153ac17..10e2a2f3 100644 --- a/azalea-entity/src/plugin/mod.rs +++ b/azalea-entity/src/plugin/mod.rs @@ -68,7 +68,7 @@ impl Plugin for EntityPlugin { ), ) .add_systems(Update, update_bounding_box) - .add_systems(FixedUpdate, update_in_loaded_chunk) + .add_systems(PreUpdate, update_in_loaded_chunk) .init_resource::(); } } diff --git a/azalea-physics/src/lib.rs b/azalea-physics/src/lib.rs index 143f99ab..5a2b896c 100644 --- a/azalea-physics/src/lib.rs +++ b/azalea-physics/src/lib.rs @@ -351,11 +351,18 @@ mod tests { #[test] fn test_gravity() { let mut app = make_test_app(); - let _world_lock = app.world.resource_mut::().insert( + let world_lock = app.world.resource_mut::().insert( ResourceLocation::new("minecraft:overworld"), 384, -64, ); + let mut partial_world = PartialInstance::default(); + // the entity has to be in a loaded chunk for physics to work + partial_world.chunks.set( + &ChunkPos { x: 0, z: 0 }, + Some(Chunk::default()), + &mut world_lock.write().chunks, + ); let entity = app .world @@ -379,6 +386,7 @@ mod tests { // y should start at 70 assert_eq!(entity_pos.y, 70.); } + app.update(); app.world.run_schedule(FixedUpdate); app.update(); { @@ -441,6 +449,7 @@ mod tests { block_state.is_some(), "Block state should exist, if this fails that means the chunk wasn't loaded and the block didn't get placed" ); + app.update(); app.world.run_schedule(FixedUpdate); app.update(); {