mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 13:37:58 +01:00
Add error messages when lerping nan values
This commit is contained in:
parent
450eee5fe6
commit
f9711b9043
1 changed files with 11 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
|||
package com.minelittlepony.unicopia.util;
|
||||
|
||||
import com.minelittlepony.unicopia.Unicopia;
|
||||
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
|
@ -23,6 +25,9 @@ public class Lerp {
|
|||
}
|
||||
|
||||
public boolean update(float newTarget, long changeDuration) {
|
||||
if (Float.isNaN(newTarget) || Float.isInfinite(newTarget)) {
|
||||
Unicopia.LOGGER.error("Invalid lerp target. Target cannot be NaN or Infinity");
|
||||
}
|
||||
if (MathHelper.approximatelyEquals(end, newTarget)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -31,6 +36,12 @@ public class Lerp {
|
|||
end = newTarget;
|
||||
duration = changeDuration;
|
||||
finished = false;
|
||||
if (Float.isNaN(start) || Float.isInfinite(start)) {
|
||||
Unicopia.LOGGER.error("Invalid lerp start. Value cannot be NaN or Infinity");
|
||||
}
|
||||
if (Float.isNaN(end) || Float.isInfinite(end)) {
|
||||
Unicopia.LOGGER.error("Invalid lerp end. Value cannot be NaN or Infinity");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue