Fix reading window items packet in versions below 1.17.1

This commit is contained in:
Tasuku Bobcorn 2025-04-29 13:56:38 +08:00
parent 2409de2a2f
commit 19781985f7

View file

@ -2121,7 +2121,7 @@ namespace MinecraftClient.Protocol.Handlers
{ {
var windowId = dataTypes.ReadNextByte(packetData); var windowId = dataTypes.ReadNextByte(packetData);
var stateId = -1; var stateId = -1;
var elements = 0; int elements;
if (protocolVersion >= MC_1_17_1_Version) if (protocolVersion >= MC_1_17_1_Version)
{ {
@ -2132,7 +2132,7 @@ namespace MinecraftClient.Protocol.Handlers
else else
{ {
// Elements as Short - 1.17.0 and below // Elements as Short - 1.17.0 and below
dataTypes.ReadNextShort(packetData); elements = dataTypes.ReadNextShort(packetData);
} }
Dictionary<int, Item> inventorySlots = new(); Dictionary<int, Item> inventorySlots = new();