Compare commits

...

3 Commits

3 changed files with 7 additions and 24 deletions

View File

@ -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
@ -535,8 +534,8 @@ class MatteryPlayer(val ply: Player) {
}
}
val input = MatteryContainer({ notify(IdleReason.ITEM) }, 1)
val output = MatteryContainer({ notify(IdleReason.ITEM) }, 1)
val input = MatteryContainer(Runnable { notify(IdleReason.ITEM) }, 1)
val output = MatteryContainer(Runnable { notify(IdleReason.ITEM) }, 1)
init {
savetables.stateful(::input, "exopack_smelter_input_$index")
@ -600,6 +599,7 @@ class MatteryPlayer(val ply: Player) {
fun invalidateNetworkState() {
privateSyncherRemote.invalidate()
publicSyncherRemote.invalidate()
remoteSynchers.values.forEach { it.invalidate() }
for (instance in research.values) {
@ -949,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
}
@ -985,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()

View File

@ -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

View File

@ -76,7 +76,7 @@ class DelegateSyncher : Observer {
fun read(registry: RegistryAccess, bytes: ByteArrayList) {
return decodePayload(registry, bytes) {
read(RegistryFriendlyByteBuf(it, registry, ConnectionType.NEOFORGE))
read(it)
}
}