aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
diff options
context:
space:
mode:
authorBuildTools <james.jenour@protonmail.com>2021-02-05 03:52:39 +0800
committerBuildTools <james.jenour@protonmail.com>2021-02-05 03:52:39 +0800
commitc40f8e737c62c8dadef294f8621716529d354796 (patch)
tree3f0fb8be376d09e4fa1a7d95da0624359d8f67b1 /src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
parent5ea3130efceca3148334a613471cec7f22acdf8c (diff)
downloadnotenoughupdates-c40f8e737c62c8dadef294f8621716529d354796.tar.gz
notenoughupdates-c40f8e737c62c8dadef294f8621716529d354796.tar.bz2
notenoughupdates-c40f8e737c62c8dadef294f8621716529d354796.zip
PRE15
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
index f452b406..4a72a85e 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
@@ -270,6 +270,14 @@ public class Utils {
return "";
}
+ public static String floatToString(float f, int decimals) {
+ if(decimals <= 0) {
+ return String.valueOf(Math.round(f));
+ } else {
+ return String.format("%."+decimals+"f", f + 0.00001f);
+ }
+ }
+
public static void drawItemStackLinear(ItemStack stack, int x, int y) {
if(stack == null)return;