material and 5 temporary vectors no longer go into the savegame

This commit is contained in:
minjaesong
2023-05-21 11:20:45 +09:00
parent b0d83325a7
commit 6268b99c1c
53 changed files with 777 additions and 5682 deletions

View File

@@ -3,6 +3,12 @@ package net.torvald.terrarum
typealias ItemValue = KVHashMap
/**
* Supported Value Types:
* - Int
* - Double (`getAsFloat()` first retrieves the Double value then casts to Float)
* - Boolean
* - String
*
* Created by minjaesong on 2015-12-30.
*/
open class KVHashMap {
@@ -42,47 +48,29 @@ open class KVHashMap {
}
fun getAsInt(key: String): Int? {
val value = get(key)
if (value == null) return null
val value = get(key) ?: return null
return value as Int
}
fun getAsDouble(key: String): Double? {
val value = get(key)
if (value == null) return null
if (value is Int)
return value.toDouble()
val value = get(key) ?: return null
if (value is Int) return value.toDouble()
return value as Double
}
fun getAsFloat(key: String): Float? {
val value = get(key)
if (value == null) return null
if (value is Float) return value as Float
val value = get(key) ?: return null
if (value is Float) return value
return getAsDouble(key)?.toFloat()
}
fun getAsString(key: String): String? {
val value = get(key)
if (value == null) return null
val value = get(key) ?: return null
return value as String
}
fun getAsBoolean(key: String): Boolean? {
val value = get(key)
if (value == null) return null
val value = get(key) ?: return null
return value as Boolean
}