mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
fix: add EntityMetadataPalette1206 for correct 1.20.6+ entity metadata parsing
1.20.6 introduced three new EntityDataSerializer types compared to 1.20.4: - PARTICLES (id 18) - list of particles, inserted after PARTICLE - WOLF_VARIANT (id 23) - wolf variant holder, inserted after CAT_VARIANT - ARMADILLO_STATE (id 28) - armadillo state, inserted after SNIFFER_STATE These insertions shifted subsequent serializer IDs, causing the 1.19.4 palette (EntityMetadataPalette1194) to misidentify metadata types on 1.20.6+ servers. This could lead to incorrect byte consumption and potential packet parse failures when entities with affected metadata types (e.g. wolves, armadillos, area effect clouds with particles) were present. Changes: - Add Particles, WolfVariant, ArmadilloState to EntityMetaDataType enum - Create EntityMetadataPalette1206 with correct 31-entry ID mapping - Route 1.20.6+ to the new palette in EntityMetadataPalette.GetPalette() - Add read logic for the three new types in DataTypes.cs Verified on 1.21.1 vanilla server: cat, wolf, frog, armadillo, painting entities all spawn without metadata parse errors. Made-with: Cursor
This commit is contained in:
parent
ee02974abe
commit
e1cb18c6f8
4 changed files with 77 additions and 3 deletions
|
|
@ -0,0 +1,51 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace MinecraftClient.Mapping.EntityMetadataPalettes;
|
||||
|
||||
/// <summary>
|
||||
/// For 1.20.6+
|
||||
/// Added PARTICLES (id 18), WOLF_VARIANT (id 23), ARMADILLO_STATE (id 28)
|
||||
/// compared to 1.19.4 palette.
|
||||
/// </summary>
|
||||
public class EntityMetadataPalette1206 : EntityMetadataPalette
|
||||
{
|
||||
private readonly Dictionary<int, EntityMetaDataType> entityMetadataMappings = new()
|
||||
{
|
||||
{ 0, EntityMetaDataType.Byte },
|
||||
{ 1, EntityMetaDataType.VarInt },
|
||||
{ 2, EntityMetaDataType.VarLong },
|
||||
{ 3, EntityMetaDataType.Float },
|
||||
{ 4, EntityMetaDataType.String },
|
||||
{ 5, EntityMetaDataType.Chat },
|
||||
{ 6, EntityMetaDataType.OptionalChat },
|
||||
{ 7, EntityMetaDataType.Slot },
|
||||
{ 8, EntityMetaDataType.Boolean },
|
||||
{ 9, EntityMetaDataType.Rotation },
|
||||
{ 10, EntityMetaDataType.Position },
|
||||
{ 11, EntityMetaDataType.OptionalPosition },
|
||||
{ 12, EntityMetaDataType.Direction },
|
||||
{ 13, EntityMetaDataType.OptionalUuid },
|
||||
{ 14, EntityMetaDataType.BlockId },
|
||||
{ 15, EntityMetaDataType.OptionalBlockId },
|
||||
{ 16, EntityMetaDataType.Nbt },
|
||||
{ 17, EntityMetaDataType.Particle },
|
||||
{ 18, EntityMetaDataType.Particles },
|
||||
{ 19, EntityMetaDataType.VillagerData },
|
||||
{ 20, EntityMetaDataType.OptionalVarInt },
|
||||
{ 21, EntityMetaDataType.Pose },
|
||||
{ 22, EntityMetaDataType.CatVariant },
|
||||
{ 23, EntityMetaDataType.WolfVariant },
|
||||
{ 24, EntityMetaDataType.FrogVariant },
|
||||
{ 25, EntityMetaDataType.OptionalGlobalPosition },
|
||||
{ 26, EntityMetaDataType.PaintingVariant },
|
||||
{ 27, EntityMetaDataType.SnifferState },
|
||||
{ 28, EntityMetaDataType.ArmadilloState },
|
||||
{ 29, EntityMetaDataType.Vector3 },
|
||||
{ 30, EntityMetaDataType.Quaternion },
|
||||
};
|
||||
|
||||
public override Dictionary<int, EntityMetaDataType> GetEntityMetadataMappingsList()
|
||||
{
|
||||
return entityMetadataMappings;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue