mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
feat: handle 26.1 protocol changes and snapshot version support
- Protocol18: add MC_26_1_Version constant (775), version-gated palette routing for blocks/items/entities/metadata, and new TimeUpdate packet format (WorldClock map replaces dayTime+tickDayTime) - Protocol18Terrain: read new fluidCount short in chunk sections (26.1+) - DataTypes: add CatSoundVariant to entity metadata VarInt readers - ProtocolHandler: add NormalizeSnapshotProtocol() to map RC/snapshot protocol numbers (e.g. 0x4000012E → 775) to release versions, pass raw protocol version through for server handshake compatibility Made-with: Cursor
This commit is contained in:
parent
d4014f7c87
commit
d1837d104b
4 changed files with 73 additions and 20 deletions
|
|
@ -145,20 +145,22 @@ namespace MinecraftClient.Protocol
|
|||
public static IMinecraftCom GetProtocolHandler(TcpClient client, int protocolVersion, ForgeInfo? forgeInfo,
|
||||
IMinecraftComHandler handler)
|
||||
{
|
||||
int normalizedVersion = NormalizeSnapshotProtocol(protocolVersion);
|
||||
|
||||
int[] suppoertedVersionsProtocol16 = { 51, 60, 61, 72, 73, 74, 78 };
|
||||
|
||||
if (Array.IndexOf(suppoertedVersionsProtocol16, protocolVersion) > -1)
|
||||
return new Protocol16Handler(client, protocolVersion, handler);
|
||||
if (Array.IndexOf(suppoertedVersionsProtocol16, normalizedVersion) > -1)
|
||||
return new Protocol16Handler(client, normalizedVersion, handler);
|
||||
|
||||
int[] suppoertedVersionsProtocol18 =
|
||||
{
|
||||
4, 5, 47, 107, 108, 109, 110, 210, 315, 316, 335, 338, 340, 393, 401, 404, 477, 480, 485, 490, 498, 573,
|
||||
575, 578, 735, 736, 751, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768,
|
||||
769, 770, 771, 772, 773, 774
|
||||
769, 770, 771, 772, 773, 774, 775
|
||||
};
|
||||
|
||||
if (Array.IndexOf(suppoertedVersionsProtocol18, protocolVersion) > -1)
|
||||
return new Protocol18Handler(client, protocolVersion, handler, forgeInfo);
|
||||
if (Array.IndexOf(suppoertedVersionsProtocol18, normalizedVersion) > -1)
|
||||
return new Protocol18Handler(client, normalizedVersion, handler, forgeInfo, protocolVersion);
|
||||
|
||||
throw new NotSupportedException(string.Format(Translations.exception_version_unsupport, protocolVersion));
|
||||
}
|
||||
|
|
@ -370,6 +372,8 @@ namespace MinecraftClient.Protocol
|
|||
return 773;
|
||||
case "1.21.11":
|
||||
return 774;
|
||||
case "26.1":
|
||||
return 775;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -458,10 +462,27 @@ namespace MinecraftClient.Protocol
|
|||
772 => "1.21.7",
|
||||
773 => "1.21.9",
|
||||
774 => "1.21.11",
|
||||
775 => "26.1",
|
||||
_ => "0.0"
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Normalize snapshot/pre-release protocol numbers (0x40000000 | data_version) to the
|
||||
/// corresponding release protocol number. Unknown snapshot versions pass through unchanged.
|
||||
/// </summary>
|
||||
public static int NormalizeSnapshotProtocol(int protocol)
|
||||
{
|
||||
if ((protocol & 0x40000000) == 0)
|
||||
return protocol;
|
||||
|
||||
return protocol switch
|
||||
{
|
||||
0x4000012E => 775, // 26.1-rc-2 → 26.1
|
||||
_ => protocol
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if we can force-enable Forge support for a Minecraft version without using server Ping
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue