aboutsummaryrefslogtreecommitdiff
path: root/azalea-physics/src
diff options
context:
space:
mode:
authorEightFactorial <29801334+EightFactorial@users.noreply.github.com>2024-12-04 16:31:22 -0800
committerGitHub <noreply@github.com>2024-12-04 18:31:22 -0600
commit6379035b852f1b619565d27f5cee3b93042c2312 (patch)
tree30c858cfaf841d0fcc5a139f1507b9b67d768e8b /azalea-physics/src
parent241c7527ce11177082dcc0ebc4152506946ee684 (diff)
downloadazalea-drasl-6379035b852f1b619565d27f5cee3b93042c2312.tar.xz
Update Bevy and migrate to workspace dependencies and package attributes (#181)
* Use workspace `Cargo.toml` for dependencies and package atributes * Fix a couple clippy warnings * Update bevy, update build script, move deps to workspace, and fix clippy warnings * Remove carrots from crate versions The default behavior is the same * Remove unused dependencies Compiles and all tests pass, so it should be fine * Update codegen to use `std::sync::LazyLock` instead of `once_cell::sync::Lazy` * Update Bevy to `0.15.0-rc.3` Surprisingly little needed to be changed * Update to bevy 0.15.0 * Fix leftover merge issues * Clarify the reason the swarm can't connect * Fix duplicate lint, remove `log` dependency
Diffstat (limited to 'azalea-physics/src')
-rw-r--r--azalea-physics/src/lib.rs62
1 files changed, 31 insertions, 31 deletions
diff --git a/azalea-physics/src/lib.rs b/azalea-physics/src/lib.rs
index 998fb300..c50095e4 100644
--- a/azalea-physics/src/lib.rs
+++ b/azalea-physics/src/lib.rs
@@ -440,7 +440,7 @@ mod tests {
#[test]
fn test_gravity() {
let mut app = make_test_app();
- let world_lock = app.world.resource_mut::<InstanceContainer>().insert(
+ let world_lock = app.world_mut().resource_mut::<InstanceContainer>().insert(
ResourceLocation::new("minecraft:overworld"),
384,
-64,
@@ -454,7 +454,7 @@ mod tests {
);
let entity = app
- .world
+ .world_mut()
.spawn((
EntityBundle::new(
Uuid::nil(),
@@ -471,24 +471,24 @@ mod tests {
))
.id();
{
- let entity_pos = *app.world.get::<Position>(entity).unwrap();
+ let entity_pos = *app.world_mut().get::<Position>(entity).unwrap();
// y should start at 70
assert_eq!(entity_pos.y, 70.);
}
app.update();
- app.world.run_schedule(GameTick);
+ app.world_mut().run_schedule(GameTick);
app.update();
{
- let entity_pos = *app.world.get::<Position>(entity).unwrap();
+ let entity_pos = *app.world_mut().get::<Position>(entity).unwrap();
// delta is applied before gravity, so the first tick only sets the delta
assert_eq!(entity_pos.y, 70.);
- let entity_physics = app.world.get::<Physics>(entity).unwrap();
+ let entity_physics = app.world_mut().get::<Physics>(entity).unwrap();
assert!(entity_physics.velocity.y < 0.);
}
- app.world.run_schedule(GameTick);
+ app.world_mut().run_schedule(GameTick);
app.update();
{
- let entity_pos = *app.world.get::<Position>(entity).unwrap();
+ let entity_pos = *app.world_mut().get::<Position>(entity).unwrap();
// the second tick applies the delta to the position, so now it should go down
assert!(
entity_pos.y < 70.,
@@ -500,7 +500,7 @@ mod tests {
#[test]
fn test_collision() {
let mut app = make_test_app();
- let world_lock = app.world.resource_mut::<InstanceContainer>().insert(
+ let world_lock = app.world_mut().resource_mut::<InstanceContainer>().insert(
ResourceLocation::new("minecraft:overworld"),
384,
-64,
@@ -513,7 +513,7 @@ mod tests {
&mut world_lock.write().chunks,
);
let entity = app
- .world
+ .world_mut()
.spawn((
EntityBundle::new(
Uuid::nil(),
@@ -539,19 +539,19 @@ mod tests {
"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(GameTick);
+ app.world_mut().run_schedule(GameTick);
app.update();
{
- let entity_pos = *app.world.get::<Position>(entity).unwrap();
+ let entity_pos = *app.world_mut().get::<Position>(entity).unwrap();
// delta will change, but it won't move until next tick
assert_eq!(entity_pos.y, 70.);
- let entity_physics = app.world.get::<Physics>(entity).unwrap();
+ let entity_physics = app.world_mut().get::<Physics>(entity).unwrap();
assert!(entity_physics.velocity.y < 0.);
}
- app.world.run_schedule(GameTick);
+ app.world_mut().run_schedule(GameTick);
app.update();
{
- let entity_pos = *app.world.get::<Position>(entity).unwrap();
+ let entity_pos = *app.world_mut().get::<Position>(entity).unwrap();
// the second tick applies the delta to the position, but it also does collision
assert_eq!(entity_pos.y, 70.);
}
@@ -560,7 +560,7 @@ mod tests {
#[test]
fn test_slab_collision() {
let mut app = make_test_app();
- let world_lock = app.world.resource_mut::<InstanceContainer>().insert(
+ let world_lock = app.world_mut().resource_mut::<InstanceContainer>().insert(
ResourceLocation::new("minecraft:overworld"),
384,
-64,
@@ -573,7 +573,7 @@ mod tests {
&mut world_lock.write().chunks,
);
let entity = app
- .world
+ .world_mut()
.spawn((
EntityBundle::new(
Uuid::nil(),
@@ -604,17 +604,17 @@ mod tests {
);
// do a few steps so we fall on the slab
for _ in 0..20 {
- app.world.run_schedule(GameTick);
+ app.world_mut().run_schedule(GameTick);
app.update();
}
- let entity_pos = app.world.get::<Position>(entity).unwrap();
+ let entity_pos = app.world_mut().get::<Position>(entity).unwrap();
assert_eq!(entity_pos.y, 69.5);
}
#[test]
fn test_top_slab_collision() {
let mut app = make_test_app();
- let world_lock = app.world.resource_mut::<InstanceContainer>().insert(
+ let world_lock = app.world_mut().resource_mut::<InstanceContainer>().insert(
ResourceLocation::new("minecraft:overworld"),
384,
-64,
@@ -627,7 +627,7 @@ mod tests {
&mut world_lock.write().chunks,
);
let entity = app
- .world
+ .world_mut()
.spawn((
EntityBundle::new(
Uuid::nil(),
@@ -657,17 +657,17 @@ mod tests {
);
// do a few steps so we fall on the slab
for _ in 0..20 {
- app.world.run_schedule(GameTick);
+ app.world_mut().run_schedule(GameTick);
app.update();
}
- let entity_pos = app.world.get::<Position>(entity).unwrap();
+ let entity_pos = app.world_mut().get::<Position>(entity).unwrap();
assert_eq!(entity_pos.y, 70.);
}
#[test]
fn test_weird_wall_collision() {
let mut app = make_test_app();
- let world_lock = app.world.resource_mut::<InstanceContainer>().insert(
+ let world_lock = app.world_mut().resource_mut::<InstanceContainer>().insert(
ResourceLocation::new("minecraft:overworld"),
384,
-64,
@@ -680,7 +680,7 @@ mod tests {
&mut world_lock.write().chunks,
);
let entity = app
- .world
+ .world_mut()
.spawn((
EntityBundle::new(
Uuid::nil(),
@@ -714,18 +714,18 @@ mod tests {
);
// do a few steps so we fall on the wall
for _ in 0..20 {
- app.world.run_schedule(GameTick);
+ app.world_mut().run_schedule(GameTick);
app.update();
}
- let entity_pos = app.world.get::<Position>(entity).unwrap();
+ let entity_pos = app.world_mut().get::<Position>(entity).unwrap();
assert_eq!(entity_pos.y, 70.5);
}
#[test]
fn test_negative_coordinates_weird_wall_collision() {
let mut app = make_test_app();
- let world_lock = app.world.resource_mut::<InstanceContainer>().insert(
+ let world_lock = app.world_mut().resource_mut::<InstanceContainer>().insert(
ResourceLocation::new("minecraft:overworld"),
384,
-64,
@@ -738,7 +738,7 @@ mod tests {
&mut world_lock.write().chunks,
);
let entity = app
- .world
+ .world_mut()
.spawn((
EntityBundle::new(
Uuid::nil(),
@@ -776,11 +776,11 @@ mod tests {
);
// do a few steps so we fall on the wall
for _ in 0..20 {
- app.world.run_schedule(GameTick);
+ app.world_mut().run_schedule(GameTick);
app.update();
}
- let entity_pos = app.world.get::<Position>(entity).unwrap();
+ let entity_pos = app.world_mut().get::<Position>(entity).unwrap();
assert_eq!(entity_pos.y, 70.5);
}
}