diff --git a/gradle.properties b/gradle.properties index a4ed634..fa07461 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ org.gradle.debug=false # Version -mod_version=1.1.03 +mod_version=1.1.04 # Mod mod_id=zenith diff --git a/src/main/java/net/zepalesque/zenith/util/MathUtil.java b/src/main/java/net/zepalesque/zenith/util/MathUtil.java index 3e03b2d..9bd2560 100644 --- a/src/main/java/net/zepalesque/zenith/util/MathUtil.java +++ b/src/main/java/net/zepalesque/zenith/util/MathUtil.java @@ -39,4 +39,20 @@ public static float nextFloat(float min, float max, RandomSource random) { return min + (random.nextFloat() * (max - min)); } + public static double clampedInverp(double start, double end, double delta) { + if (delta < start) { + return 0.0; + } else { + return delta > end ? 1.0 : Mth.inverseLerp(delta, start, end); + } + } + + public static float clampedInverp(float start, float end, float delta) { + if (delta < start) { + return 0.0F; + } else { + return delta > end ? 1.0F : Mth.inverseLerp(delta, start, end); + } + } + }