diff options
| author | mat <git@matdoes.dev> | 2025-06-16 17:08:09 -0630 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-06-16 17:08:09 -0630 |
| commit | f82cf7fa859f2bab8207662e74f49bad4999f8fd (patch) | |
| tree | 989257b939605f33cb20c404361739960176f418 /azalea-core/src | |
| parent | fd9bf168716f195e7e6225b93dfb099aa01b1fde (diff) | |
| download | azalea-drasl-f82cf7fa859f2bab8207662e74f49bad4999f8fd.tar.xz | |
cleanup
Diffstat (limited to 'azalea-core/src')
| -rw-r--r-- | azalea-core/src/hit_result.rs | 2 | ||||
| -rw-r--r-- | azalea-core/src/math.rs | 15 |
2 files changed, 6 insertions, 11 deletions
diff --git a/azalea-core/src/hit_result.rs b/azalea-core/src/hit_result.rs index 3b1e160d..fe759d43 100644 --- a/azalea-core/src/hit_result.rs +++ b/azalea-core/src/hit_result.rs @@ -18,7 +18,7 @@ impl HitResult { pub fn miss(&self) -> bool { match self { HitResult::Block(r) => r.miss, - HitResult::Entity(_) => false, + _ => false, } } pub fn location(&self) -> Vec3 { diff --git a/azalea-core/src/math.rs b/azalea-core/src/math.rs index c09bddda..a115927d 100644 --- a/azalea-core/src/math.rs +++ b/azalea-core/src/math.rs @@ -6,25 +6,20 @@ use std::{ pub const EPSILON: f64 = 1.0E-7; -pub static SIN: LazyLock<[f32; 65536]> = LazyLock::new(|| { - let mut sin = [0.0; 65536]; - for (i, item) in sin.iter_mut().enumerate() { - *item = f64::sin((i as f64) * PI * 2.0 / 65536.0) as f32; - } - sin -}); +pub static SIN: LazyLock<[f32; 65536]> = + LazyLock::new(|| std::array::from_fn(|i| f64::sin((i as f64) * PI * 2. / 65536.) as f32)); /// A sine function that uses a lookup table. pub fn sin(x: f32) -> f32 { let x = x * 10430.378; - let x = x as i32 as usize & 65535; + let x = x as i32 as usize & 0xFFFF; SIN[x] } /// A cosine function that uses a lookup table. pub fn cos(x: f32) -> f32 { - let x = x * 10430.378 + 16384.0; - let x = x as i32 as usize & 65535; + let x = x * 10430.378 + 16384.; + let x = x as i32 as usize & 0xFFFF; SIN[x] } |
