Make UUIDIntModifiersMap compatible with savetables

This commit is contained in:
DBotThePony 2023-02-25 18:00:16 +07:00
parent c555b2f318
commit 9924711f31
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -11,7 +11,7 @@ import java.util.UUID
*
* This is like Minecraft's Attribute map, except it operate only on whole numbers
*/
class UUIDIntModifiersMap(private val observer: (Int) -> Unit, private val backingMap: MutableMap<UUID, Int> = HashMap()) : INBTSerializable<ListTag> {
class UUIDIntModifiersMap(private val observer: (Int) -> Unit, private val backingMap: MutableMap<UUID, Int> = HashMap()) : INBTSerializable<ListTag?> {
var value: Int = 0
private set
@ -78,8 +78,9 @@ class UUIDIntModifiersMap(private val observer: (Int) -> Unit, private val backi
}
}
override fun deserializeNBT(nbt: ListTag) {
override fun deserializeNBT(nbt: ListTag?) {
backingMap.clear()
nbt ?: return
val old = this.value
this.value = 0