mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 06:09:05 +00:00
Added needed gui utils
This commit is contained in:
1 parent
cd4174713a
commit
ebd005c2df
3 files changed
+304
No files matched your search
@@ -1,6 +1,15 @@
|
||||
package noppes.npcs.util;
|
||||
|
||||
public class ValueUtil {
|
||||
|
||||
public static float lerp(float start, float end, float delta) {
|
||||
return start + delta * (end - start);
|
||||
}
|
||||
|
||||
public static double lerp(double start, double end, double delta) {
|
||||
return start + delta * (end - start);
|
||||
}
|
||||
|
||||
public static float clamp(float given, float min, float max) {
|
||||
if (given < min)
|
||||
return min;
|
||||
@@ -48,4 +57,16 @@ public class ValueUtil {
|
||||
return max;
|
||||
return given;
|
||||
}
|
||||
|
||||
public static String format(double value) {
|
||||
return (value % 1 == 0) ? String.format("%.0f", value) : String.format("%.2f", value);
|
||||
}
|
||||
|
||||
public static String format(String precision, float value) {
|
||||
return (value % 1 == 0) ? String.format("%.0f", value) : String.format(precision, value);
|
||||
}
|
||||
|
||||
public static String format(String precision, double value) {
|
||||
return (value % 1 == 0) ? String.format("%.0f", value) : String.format(precision, value);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user