mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 03:24:06 +09:00
Physics stuff Float -> Double
Former-commit-id: 54ccee75769691aa6aaa2416767bd15270f63347 Former-commit-id: 61e892434f48adf11e3ca49b60928a930fd5cde9
This commit is contained in:
@@ -47,17 +47,6 @@ open class KVHashMap {
|
||||
return get(key) as Int?
|
||||
}
|
||||
|
||||
fun getAsFloat(key: String): Float? {
|
||||
val value = get(key)
|
||||
|
||||
if (value is Int)
|
||||
return value.toFloat()
|
||||
else if (value is JsonPrimitive)
|
||||
return value.asFloat
|
||||
|
||||
return value as Float?
|
||||
}
|
||||
|
||||
fun getAsDouble(key: String): Double? {
|
||||
val value = get(key)
|
||||
|
||||
@@ -66,7 +55,14 @@ open class KVHashMap {
|
||||
else if (value is JsonPrimitive)
|
||||
return value.asDouble
|
||||
|
||||
return value as Double?
|
||||
try {
|
||||
return value as Double?
|
||||
}
|
||||
catch (e: ClassCastException) {
|
||||
System.err.println("[KVHashMap] ClassCastException for key '$key'")
|
||||
e.printStackTrace(System.err)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
fun getAsString(key: String): String? {
|
||||
|
||||
Reference in New Issue
Block a user