make vec2 safer too

This commit is contained in:
yrsegal@gmail.com 2022-04-27 16:26:44 -04:00
parent a214c49c1c
commit f4ea6cfedb

View file

@ -30,7 +30,7 @@ object HexUtils {
LongArrayTag(longArrayOf(this.x.toDouble().toRawBits(), this.y.toDouble().toRawBits()))
@JvmStatic
fun DeserializeVec2FromNBT(tag: LongArray): Vec2 =
fun DeserializeVec2FromNBT(tag: LongArray): Vec2 = if (tag.size != 2) Vec2.ZERO else
Vec2(
Double.fromBits(tag[0]).toFloat(),
Double.fromBits(tag[1]).toFloat(),