Fix slotted container has empty bitmap after deserialization

This commit is contained in:
DBotThePony 2025-03-22 15:10:17 +07:00
parent eed3b04555
commit d17e64f335
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -274,6 +274,7 @@ class SlottedContainer(
for ((item, slot) in items) {
if (slot in 0 until containerSize) {
slots[slot].item = item
bitmap[slot] = item.isNotEmpty
} else if (item.isNotEmpty) {
ItemStack.CODEC.encodeStart(provider.createSerializationContext(NbtOps.INSTANCE), item)
.ifError { LOGGER.warn("Unable to serialize 'lost' item: ${it.message()}") }
@ -307,6 +308,7 @@ class SlottedContainer(
if (i in 0 until containerSize) {
slots[i].deserializeNBT(provider, element)
bitmap[i] = slots[i].isNotEmpty
} else {
lostItems.add(element)
this.provider = provider