From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> Date: Sun, 6 Jul 2025 02:59:37 +0300 Subject: [PATCH] Use Java's Math functions diff --git a/net/minecraft/util/Mth.java b/net/minecraft/util/Mth.java index 50de03f9293939425feba058a0567ccae8bde09e..a5c4eb68f718769f088306ca8b098611d4ecdf4d 100644 --- a/net/minecraft/util/Mth.java +++ b/net/minecraft/util/Mth.java @@ -60,18 +60,15 @@ public class Mth { } public static int floor(float value) { - int i = (int)value; - return value < i ? i - 1 : i; + return (int) Math.floor(value); // DivineMC - Use Java's Math functions } public static int floor(double value) { - int i = (int)value; - return value < i ? i - 1 : i; + return (int) Math.floor(value); // DivineMC - Use Java's Math functions } public static long lfloor(double value) { - long l = (long)value; - return value < l ? l - 1L : l; + return (long) Math.floor(value); // DivineMC - Use Java's Math functions } public static float abs(float value) { @@ -83,13 +80,11 @@ public class Mth { } public static int ceil(float value) { - int i = (int)value; - return value > i ? i + 1 : i; + return (int) Math.ceil(value); // DivineMC - Use Java's Math functions } public static int ceil(double value) { - int i = (int)value; - return value > i ? i + 1 : i; + return (int) Math.ceil(value); // DivineMC - Use Java's Math functions } public static long ceilLong(double value) {