Wire up entity metadata palette

This commit is contained in:
ReinforceZwei 2023-03-24 19:46:25 +08:00
parent 1a22002bde
commit f4ad24746c
6 changed files with 225 additions and 337 deletions

View file

@ -86,6 +86,7 @@ namespace MinecraftClient.Protocol.Handlers
readonly Protocol18Terrain pTerrain;
readonly IMinecraftComHandler handler;
readonly EntityPalette entityPalette;
readonly EntityMetadataPalette entityMetadataPalette;
readonly ItemPalette itemPalette;
readonly PacketTypePalette packetPalette;
readonly SocketWrapper socketWrapper;
@ -179,6 +180,8 @@ namespace MinecraftClient.Protocol.Handlers
else
entityPalette = new EntityPalette112();
entityMetadataPalette = EntityMetadataPalette.GetPalette(protocolVersion);
// Item palette
if (protocolVersion > MC_1_19_4_Version && handler.GetInventoryEnabled())
throw new NotImplementedException(Translations.exception_palette_item);
@ -2132,8 +2135,9 @@ namespace MinecraftClient.Protocol.Handlers
if (handler.GetEntityHandlingEnabled())
{
int EntityID = dataTypes.ReadNextVarInt(packetData);
Dictionary<int, object?> metadata = dataTypes.ReadNextMetadata(packetData, itemPalette);
Dictionary<int, object?> metadata = dataTypes.ReadNextMetadata(packetData, itemPalette, entityMetadataPalette);
// Also make a palette for field? Will be a lot of work
int healthField; // See https://wiki.vg/Entity_metadata#Living_Entity
if (protocolVersion > MC_1_19_4_Version)
throw new NotImplementedException(Translations.exception_palette_healthfield);