mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 23:44:38 +00:00
fix tests
This commit is contained in:
parent
9fa6957fa1
commit
dea4a656a5
2 changed files with 11 additions and 2 deletions
|
@ -68,7 +68,7 @@ impl Plugin for EntityPlugin {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.add_systems(Update, update_bounding_box)
|
.add_systems(Update, update_bounding_box)
|
||||||
.add_systems(FixedUpdate, update_in_loaded_chunk)
|
.add_systems(PreUpdate, update_in_loaded_chunk)
|
||||||
.init_resource::<EntityUuidIndex>();
|
.init_resource::<EntityUuidIndex>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -351,11 +351,18 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_gravity() {
|
fn test_gravity() {
|
||||||
let mut app = make_test_app();
|
let mut app = make_test_app();
|
||||||
let _world_lock = app.world.resource_mut::<InstanceContainer>().insert(
|
let world_lock = app.world.resource_mut::<InstanceContainer>().insert(
|
||||||
ResourceLocation::new("minecraft:overworld"),
|
ResourceLocation::new("minecraft:overworld"),
|
||||||
384,
|
384,
|
||||||
-64,
|
-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
|
let entity = app
|
||||||
.world
|
.world
|
||||||
|
@ -379,6 +386,7 @@ mod tests {
|
||||||
// y should start at 70
|
// y should start at 70
|
||||||
assert_eq!(entity_pos.y, 70.);
|
assert_eq!(entity_pos.y, 70.);
|
||||||
}
|
}
|
||||||
|
app.update();
|
||||||
app.world.run_schedule(FixedUpdate);
|
app.world.run_schedule(FixedUpdate);
|
||||||
app.update();
|
app.update();
|
||||||
{
|
{
|
||||||
|
@ -441,6 +449,7 @@ mod tests {
|
||||||
block_state.is_some(),
|
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"
|
"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.world.run_schedule(FixedUpdate);
|
||||||
app.update();
|
app.update();
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue