aboutsummaryrefslogtreecommitdiff
path: root/azalea-core/src/math.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2024-12-05 06:30:47 +0000
committermat <git@matdoes.dev>2024-12-05 06:30:47 +0000
commit39f4d68e1ff1f0fa0d45663335d83299d5d37790 (patch)
treeac61d7bf437a1874c91d5c794b732dc599f86259 /azalea-core/src/math.rs
parent6379035b852f1b619565d27f5cee3b93042c2312 (diff)
downloadazalea-drasl-39f4d68e1ff1f0fa0d45663335d83299d5d37790.tar.xz
fix container_set_content, player_position, and recipe_book_remove packets
Diffstat (limited to 'azalea-core/src/math.rs')
-rw-r--r--azalea-core/src/math.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/azalea-core/src/math.rs b/azalea-core/src/math.rs
index 7c0ac7b4..62215749 100644
--- a/azalea-core/src/math.rs
+++ b/azalea-core/src/math.rs
@@ -68,6 +68,15 @@ pub fn fract(x: f64) -> f64 {
x - floor
}
+// these are copied from the java standard library, we don't calculate the
+// consts ourself to make sure it's the same as java
+pub fn to_radians(degrees: f64) -> f64 {
+ degrees * 0.017453292519943295
+}
+pub fn to_degrees(radians: f64) -> f64 {
+ radians * 57.29577951308232
+}
+
#[cfg(test)]
mod tests {
use super::*;