Fixed NPE if container has no items tag

This commit is contained in:
RaphiMC 2024-06-17 18:59:39 +02:00
parent cdfa1a5a10
commit 3b47d46548
No known key found for this signature in database
GPG Key ID: 0F6BB0657A03AC94

View File

@ -364,10 +364,12 @@ public class Protocola1_2_3_5_1_2_6Tob1_0_1_1_1 extends StatelessProtocol<Client
private void readItemsFromTag(final CompoundTag tag, final Item[] items) {
final ListTag<CompoundTag> itemList = tag.getListTag("Items", CompoundTag.class);
if (itemList != null) {
for (CompoundTag itemTag : itemList) {
items[itemTag.getByte("Slot") & 255] = new DataItem(itemTag.getShort("id"), itemTag.getByte("Count"), itemTag.getShort("Damage"), null);
}
}
}
private void sendWindowItems(final UserConnection user, final byte windowId, final Item[] items) {
final PacketWrapper windowItems = PacketWrapper.create(ClientboundPacketsb1_1.CONTAINER_SET_CONTENT, user);