Fix slotted container has empty bitmap after deserialization
This commit is contained in:
parent
eed3b04555
commit
d17e64f335
@ -274,6 +274,7 @@ class SlottedContainer(
|
|||||||
for ((item, slot) in items) {
|
for ((item, slot) in items) {
|
||||||
if (slot in 0 until containerSize) {
|
if (slot in 0 until containerSize) {
|
||||||
slots[slot].item = item
|
slots[slot].item = item
|
||||||
|
bitmap[slot] = item.isNotEmpty
|
||||||
} else if (item.isNotEmpty) {
|
} else if (item.isNotEmpty) {
|
||||||
ItemStack.CODEC.encodeStart(provider.createSerializationContext(NbtOps.INSTANCE), item)
|
ItemStack.CODEC.encodeStart(provider.createSerializationContext(NbtOps.INSTANCE), item)
|
||||||
.ifError { LOGGER.warn("Unable to serialize 'lost' item: ${it.message()}") }
|
.ifError { LOGGER.warn("Unable to serialize 'lost' item: ${it.message()}") }
|
||||||
@ -307,6 +308,7 @@ class SlottedContainer(
|
|||||||
|
|
||||||
if (i in 0 until containerSize) {
|
if (i in 0 until containerSize) {
|
||||||
slots[i].deserializeNBT(provider, element)
|
slots[i].deserializeNBT(provider, element)
|
||||||
|
bitmap[i] = slots[i].isNotEmpty
|
||||||
} else {
|
} else {
|
||||||
lostItems.add(element)
|
lostItems.add(element)
|
||||||
this.provider = provider
|
this.provider = provider
|
||||||
|
Loading…
Reference in New Issue
Block a user