Fix slot charge flags being lost during deserialization due to internal changes in CompoundTag code
This commit is contained in:
parent
f3dbcb0dd5
commit
7e9352e60a
@ -96,7 +96,6 @@ import ru.dbotthepony.mc.otm.core.math.Decimal
|
||||
import ru.dbotthepony.mc.otm.core.math.RGBColorDFUCodec
|
||||
import ru.dbotthepony.mc.otm.core.math.minus
|
||||
import ru.dbotthepony.mc.otm.core.nbt.getCompoundList
|
||||
import ru.dbotthepony.mc.otm.core.nbt.getIntList
|
||||
import ru.dbotthepony.mc.otm.core.nbt.getStringList
|
||||
import ru.dbotthepony.mc.otm.core.nbt.set
|
||||
import ru.dbotthepony.mc.otm.core.util.Savetables
|
||||
@ -950,12 +949,7 @@ class MatteryPlayer(val ply: Player) {
|
||||
}
|
||||
}
|
||||
|
||||
tag["slotsChargeFlag"] = ListTag().also {
|
||||
for (value in slotsChargeFlag) {
|
||||
it.add(IntTag.valueOf(value))
|
||||
}
|
||||
}
|
||||
|
||||
tag.putIntArray("slotsChargeFlag", slotsChargeFlag.toIntArray())
|
||||
return tag
|
||||
}
|
||||
|
||||
@ -986,8 +980,8 @@ class MatteryPlayer(val ply: Player) {
|
||||
}
|
||||
|
||||
if ("slotsChargeFlag" in tag) {
|
||||
for (v in tag.getIntList("slotsChargeFlag")) {
|
||||
this.slotsChargeFlag.add(v.asInt)
|
||||
for (v in tag.getIntArray("slotsChargeFlag")) {
|
||||
this.slotsChargeFlag.add(v)
|
||||
}
|
||||
} else {
|
||||
slotChargeToDefault()
|
||||
|
@ -79,18 +79,6 @@ fun <T> CompoundTag.mapString(index: String, mapper: (String) -> T, orElse: T):
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("unchecked_cast") // type is checked inside getList
|
||||
fun CompoundTag.getByteList(key: String): MutableList<ByteTag> = getList(key, Tag.TAG_BYTE.toInt()) as MutableList<ByteTag>
|
||||
@Suppress("unchecked_cast") // type is checked inside getList
|
||||
fun CompoundTag.getShortList(key: String): MutableList<ShortTag> = getList(key, Tag.TAG_SHORT.toInt()) as MutableList<ShortTag>
|
||||
@Suppress("unchecked_cast") // type is checked inside getList
|
||||
fun CompoundTag.getIntList(key: String): MutableList<IntTag> = getList(key, Tag.TAG_INT.toInt()) as MutableList<IntTag>
|
||||
@Suppress("unchecked_cast") // type is checked inside getList
|
||||
fun CompoundTag.getLongList(key: String): MutableList<LongTag> = getList(key, Tag.TAG_LONG.toInt()) as MutableList<LongTag>
|
||||
@Suppress("unchecked_cast") // type is checked inside getList
|
||||
fun CompoundTag.getFloatList(key: String): MutableList<FloatTag> = getList(key, Tag.TAG_FLOAT.toInt()) as MutableList<FloatTag>
|
||||
@Suppress("unchecked_cast") // type is checked inside getList
|
||||
fun CompoundTag.getDoubleList(key: String): MutableList<DoubleTag> = getList(key, Tag.TAG_DOUBLE.toInt()) as MutableList<DoubleTag>
|
||||
@Suppress("unchecked_cast") // type is checked inside getList
|
||||
fun CompoundTag.getByteArrayList(key: String): MutableList<ByteArrayTag> = getList(key, Tag.TAG_BYTE_ARRAY.toInt()) as MutableList<ByteArrayTag>
|
||||
@Suppress("unchecked_cast") // type is checked inside getList
|
||||
|
Loading…
Reference in New Issue
Block a user