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 0713d164851216483247da09ff7901f8bfbe2eb9..ed46863a244f4e23610a918f0692390130eaadaf 100644 --- a/net/minecraft/util/Mth.java +++ b/net/minecraft/util/Mth.java @@ -58,18 +58,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) { @@ -81,13 +78,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) {