mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Login Start, Encryption Reqest, Merchant Offers, Set Experience packets implemented.
This commit is contained in:
parent
7a9bc7bd1d
commit
d81a67762e
2 changed files with 30 additions and 6 deletions
|
|
@ -728,11 +728,17 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
{
|
||||
Item inputItem1 = ReadNextItemSlot(cache, itemPalette)!;
|
||||
Item outputItem = ReadNextItemSlot(cache, itemPalette)!;
|
||||
|
||||
Item? inputItem2 = null;
|
||||
if (ReadNextBool(cache)) //check if villager has second item
|
||||
|
||||
if (protocolversion >= Protocol18Handler.MC_1_19_3_Version)
|
||||
inputItem2 = ReadNextItemSlot(cache, itemPalette);
|
||||
else
|
||||
{
|
||||
if (ReadNextBool(cache)) //check if villager has second item
|
||||
inputItem2 = ReadNextItemSlot(cache, itemPalette);
|
||||
}
|
||||
|
||||
bool tradeDisabled = ReadNextBool(cache);
|
||||
int numberOfTradeUses = ReadNextInt(cache);
|
||||
int maximumNumberOfTradeUses = ReadNextInt(cache);
|
||||
|
|
|
|||
|
|
@ -1712,8 +1712,19 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
break;
|
||||
case PacketTypesIn.SetExperience:
|
||||
float experiencebar = dataTypes.ReadNextFloat(packetData);
|
||||
int level = dataTypes.ReadNextVarInt(packetData);
|
||||
int totalexperience = dataTypes.ReadNextVarInt(packetData);
|
||||
int totalexperience, level;
|
||||
|
||||
if (protocolVersion >= MC_1_19_3_Version)
|
||||
{
|
||||
totalexperience = dataTypes.ReadNextVarInt(packetData);
|
||||
level = dataTypes.ReadNextVarInt(packetData);
|
||||
}
|
||||
else
|
||||
{
|
||||
level = dataTypes.ReadNextVarInt(packetData);
|
||||
totalexperience = dataTypes.ReadNextVarInt(packetData);
|
||||
}
|
||||
|
||||
handler.OnSetExperience(experiencebar, level, totalexperience);
|
||||
break;
|
||||
case PacketTypesIn.Explosion:
|
||||
|
|
@ -1911,7 +1922,9 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
|
||||
List<byte> fullLoginPacket = new();
|
||||
fullLoginPacket.AddRange(dataTypes.GetString(handler.GetUsername())); // Username
|
||||
if (protocolVersion >= MC_1_19_Version)
|
||||
|
||||
// 1.19 - 1.19.2
|
||||
if (protocolVersion >= MC_1_19_Version && protocolVersion < MC_1_19_3_Version)
|
||||
{
|
||||
if (playerKeyPair == null)
|
||||
fullLoginPacket.AddRange(dataTypes.GetBool(false)); // Has Sig Data
|
||||
|
|
@ -1929,6 +1942,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
if (protocolVersion >= MC_1_19_2_Version)
|
||||
{
|
||||
Guid uuid = handler.GetUserUuid();
|
||||
|
||||
if (uuid == Guid.Empty)
|
||||
fullLoginPacket.AddRange(dataTypes.GetBool(false)); // Has UUID
|
||||
else
|
||||
|
|
@ -1937,6 +1951,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
fullLoginPacket.AddRange(dataTypes.GetUUID(uuid)); // UUID
|
||||
}
|
||||
}
|
||||
|
||||
SendPacket(0x00, fullLoginPacket);
|
||||
|
||||
while (true)
|
||||
|
|
@ -2018,7 +2033,9 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
// Encryption Response packet
|
||||
List<byte> encryptionResponse = new();
|
||||
encryptionResponse.AddRange(dataTypes.GetArray(RSAService.Encrypt(secretKey, false))); // Shared Secret
|
||||
if (protocolVersion >= Protocol18Handler.MC_1_19_Version)
|
||||
|
||||
// 1.19 - 1.19.2
|
||||
if (protocolVersion >= MC_1_19_Version && protocolVersion < MC_1_19_3_Version)
|
||||
{
|
||||
if (playerKeyPair == null)
|
||||
{
|
||||
|
|
@ -2039,6 +2056,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
{
|
||||
encryptionResponse.AddRange(dataTypes.GetArray(RSAService.Encrypt(token, false))); // Verify Token
|
||||
}
|
||||
|
||||
SendPacket(0x01, encryptionResponse);
|
||||
|
||||
//Start client-side encryption
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue