Enhance container handling for Minecraft protocol updates

- Updated the Container class to include a protocol version parameter for accurate container type mapping.
- Modified the GetContainerType method to account for changes in container types introduced in Minecraft 1.20.4.
- Added new container types, including Crafter, to the ContainerType enum.
- Adjusted ContainerTypeExtensions to reflect the new container mappings and ensure compatibility with the updated protocol.
This commit is contained in:
BruceChen 2026-03-28 02:16:31 +08:00
parent 22f46d14a9
commit ef133f3d6d
4 changed files with 69 additions and 19 deletions

View file

@ -2319,7 +2319,7 @@ namespace MinecraftClient.Protocol.Handlers
var windowId = dataTypes.ReadNextVarInt(packetData);
var windowType = dataTypes.ReadNextVarInt(packetData);
var title = dataTypes.ReadNextChat(packetData);
Container inventory = new(windowId, windowType, ChatParser.ParseText(title));
Container inventory = new(windowId, windowType, ChatParser.ParseText(title), protocolVersion);
handler.OnInventoryOpen(windowId, inventory);
}
}