This commit is contained in:
mat 2023-09-10 18:22:59 -05:00
parent 5f8704ccc5
commit bcefa64dd1
2 changed files with 6 additions and 15 deletions

View file

@ -1,9 +1,9 @@
use std::sync::LazyLock;
use std::{f64::consts::PI, sync::LazyLock};
pub static SIN: LazyLock<[f32; 65536]> = LazyLock::new(|| {
let mut sin = [0.0; 65536];
for i in 0..65536 {
sin[i] = f64::sin((i as f64) * 3.141592653589793 * 2.0 / 65536.0) as f32;
for (i, item) in sin.iter_mut().enumerate() {
*item = f64::sin((i as f64) * PI * 2.0 / 65536.0) as f32;
}
sin
});

View file

@ -11,17 +11,13 @@ use azalea_entity::{
Position,
};
use azalea_world::{Instance, InstanceContainer, InstanceName};
use bevy_app::{App, FixedUpdate, Plugin, Update};
use bevy_app::{App, FixedUpdate, Plugin};
use bevy_ecs::{
entity::Entity,
event::{EventReader, EventWriter},
prelude::Event,
query::With,
schedule::{IntoSystemConfigs, SystemSet},
system::{Query, Res},
};
use collision::{move_colliding, MoverType};
use log::trace;
/// A Bevy [`SystemSet`] for running physics that makes entities do things.
#[derive(SystemSet, Debug, Hash, PartialEq, Eq, Clone)]
@ -36,6 +32,7 @@ impl Plugin for PhysicsPlugin {
/// Move the entity with the given acceleration while handling friction,
/// gravity, collisions, and some other stuff.
#[allow(clippy::type_complexity)]
fn travel(
mut query: Query<
(
@ -118,6 +115,7 @@ fn travel(
/// applies air resistance, calls self.travel(), and some other random
/// stuff.
#[allow(clippy::type_complexity)]
pub fn ai_step(
mut query: Query<
(
@ -133,13 +131,6 @@ pub fn ai_step(
// With<LocalPlayerInLoadedChunk> maybe there should be an InLoadedChunk/InUnloadedChunk
// component?
>,
// mut jump_query: Query<(
// &mut Physics,
// &Position,
// &LookDirection,
// &Sprinting,
// &InstanceName,
// )>,
instance_container: Res<InstanceContainer>,
) {
for (mut physics, jumping, position, look_direction, sprinting, instance_name) in &mut query {