mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Fix entity handle & Try fix message singing again
This commit is contained in:
parent
50dd5a3ba3
commit
950d9bcfdc
3 changed files with 198 additions and 130 deletions
|
|
@ -684,6 +684,55 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case 15: // Particle
|
||||
// Currecutly not handled. Reading data only
|
||||
int ParticleID = ReadNextVarInt(cache);
|
||||
// Need to check the exact version where the change occurred!!!!!
|
||||
if (protocolversion >= Protocol18Handler.MC_1_19_3_Version)
|
||||
{
|
||||
switch (ParticleID)
|
||||
{
|
||||
case 2:
|
||||
ReadNextVarInt(cache);
|
||||
break;
|
||||
case 3:
|
||||
ReadNextVarInt(cache);
|
||||
break;
|
||||
case 14:
|
||||
ReadNextFloat(cache);
|
||||
ReadNextFloat(cache);
|
||||
ReadNextFloat(cache);
|
||||
ReadNextFloat(cache);
|
||||
break;
|
||||
case 15:
|
||||
ReadNextFloat(cache);
|
||||
ReadNextFloat(cache);
|
||||
ReadNextFloat(cache);
|
||||
ReadNextFloat(cache);
|
||||
ReadNextFloat(cache);
|
||||
ReadNextFloat(cache);
|
||||
ReadNextFloat(cache);
|
||||
break;
|
||||
case 24:
|
||||
ReadNextVarInt(cache);
|
||||
break;
|
||||
case 35:
|
||||
ReadNextItemSlot(cache, itemPalette);
|
||||
break;
|
||||
case 36:
|
||||
string positionSourceType = ReadNextString(cache);
|
||||
if (positionSourceType == "minecraft:block")
|
||||
{
|
||||
ReadNextLocation(cache);
|
||||
}
|
||||
else if (positionSourceType == "minecraft:entity")
|
||||
{
|
||||
ReadNextVarInt(cache);
|
||||
ReadNextFloat(cache);
|
||||
}
|
||||
ReadNextVarInt(cache);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (ParticleID)
|
||||
{
|
||||
case 3:
|
||||
|
|
@ -702,6 +751,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
ReadNextItemSlot(cache, itemPalette);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 16: // Villager Data (3x VarInt)
|
||||
value = new List<int>
|
||||
|
|
@ -730,7 +780,10 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
if (protocolversion <= Protocol18Handler.MC_1_19_Version)
|
||||
value = ReadNextVarInt(cache);
|
||||
else
|
||||
value = null; // Dimension and blockPos, currently not in use
|
||||
{
|
||||
// Dimension and blockPos, currently not in use
|
||||
value = new Tuple<string, Location>(ReadNextString(cache), ReadNextLocation(cache));
|
||||
}
|
||||
break;
|
||||
case 22: // Painting Variant
|
||||
value = ReadNextVarInt(cache);
|
||||
|
|
|
|||
|
|
@ -104,6 +104,9 @@ namespace MinecraftClient.Protocol.Handlers.packet.s2c
|
|||
|
||||
private static void CollectSignArguments(int NodeIdx, string command, List<Tuple<string, string>> arguments)
|
||||
{
|
||||
if (Nodes.Length <= NodeIdx)
|
||||
return;
|
||||
|
||||
CommandNode node = Nodes[NodeIdx];
|
||||
string last_arg = command;
|
||||
switch (node.Flags & 0x03)
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
private readonly BlockingCollection<Tuple<int, Queue<byte>>> packetQueue = new();
|
||||
private float LastYaw, LastPitch;
|
||||
|
||||
private object MessageSigningLock = new();
|
||||
private Guid chatUuid = Guid.Empty;
|
||||
private int pendingAcknowledgments = 0, messageIndex = 0;
|
||||
private LastSeenMessagesCollector lastSeenMessagesCollector;
|
||||
|
|
@ -696,11 +697,15 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
}
|
||||
|
||||
ChatMessage chat = new(message, false, chatTypeId, senderUUID, unsignedChatContent, senderDisplayName, senderTeamName, timestamp, messageSignature, verifyResult);
|
||||
if (isOnlineMode && !chat.LacksSender() && messageSignature != null)
|
||||
lock (MessageSigningLock)
|
||||
Acknowledge(chat);
|
||||
handler.OnTextReceived(chat);
|
||||
}
|
||||
break;
|
||||
case PacketTypesIn.HideMessage:
|
||||
byte[] hideMessageSignature = dataTypes.ReadNextByteArray(packetData);
|
||||
ConsoleIO.WriteLine($"HideMessage was not processed! (SigLen={hideMessageSignature.Length})");
|
||||
break;
|
||||
case PacketTypesIn.SystemChat:
|
||||
string systemMessage = dataTypes.ReadNextString(packetData);
|
||||
if (protocolVersion >= MC_1_19_3_Version)
|
||||
|
|
@ -2524,8 +2529,8 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
{
|
||||
if (protocolVersion >= MC_1_19_3_Version)
|
||||
{
|
||||
lastSeenMessagesCollector.Add_1_19_3(entry, true);
|
||||
lastReceivedMessage = null;
|
||||
if (lastSeenMessagesCollector.Add_1_19_3(entry, true))
|
||||
{
|
||||
if (lastSeenMessagesCollector.messageCount > 64)
|
||||
{
|
||||
int messageCount = lastSeenMessagesCollector.ResetMessageCount();
|
||||
|
|
@ -2533,6 +2538,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
SendMessageAcknowledgment(messageCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lastSeenMessagesCollector.Add_1_19_2(entry);
|
||||
|
|
@ -2560,6 +2566,13 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
log.Debug("chat command = " + command);
|
||||
|
||||
try
|
||||
{
|
||||
List<Tuple<string, string>>? needSigned = null; // List< Argument Name, Argument Value >
|
||||
if (playerKeyPair != null && isOnlineMode && protocolVersion >= MC_1_19_Version
|
||||
&& Config.Signature.LoginWithSecureProfile && Config.Signature.SignMessageInCommand)
|
||||
needSigned = DeclareCommands.CollectSignArguments(command);
|
||||
|
||||
lock (MessageSigningLock)
|
||||
{
|
||||
LastSeenMessageList.Acknowledgment? acknowledgment_1_19_2 =
|
||||
(protocolVersion == MC_1_19_2_Version) ? ConsumeAcknowledgment() : null;
|
||||
|
|
@ -2576,11 +2589,6 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
DateTimeOffset timeNow = DateTimeOffset.UtcNow;
|
||||
fields.AddRange(DataTypes.GetLong(timeNow.ToUnixTimeMilliseconds()));
|
||||
|
||||
List<Tuple<string, string>>? needSigned = null; // List< Argument Name, Argument Value >
|
||||
if (playerKeyPair != null && isOnlineMode && protocolVersion >= MC_1_19_Version
|
||||
&& Config.Signature.LoginWithSecureProfile && Config.Signature.SignMessageInCommand)
|
||||
needSigned = DeclareCommands.CollectSignArguments(command);
|
||||
|
||||
if (needSigned == null || needSigned!.Count == 0)
|
||||
{
|
||||
fields.AddRange(DataTypes.GetLong(0)); // Salt: Long
|
||||
|
|
@ -2629,6 +2637,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
}
|
||||
|
||||
SendPacket(PacketTypesOut.ChatCommand, fields);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (SocketException) { return false; }
|
||||
|
|
@ -2659,6 +2668,8 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
fields.AddRange(dataTypes.GetString(message));
|
||||
|
||||
if (protocolVersion >= MC_1_19_Version)
|
||||
{
|
||||
lock (MessageSigningLock)
|
||||
{
|
||||
LastSeenMessageList.Acknowledgment? acknowledgment_1_19_2 =
|
||||
(protocolVersion == MC_1_19_2_Version) ? ConsumeAcknowledgment() : null;
|
||||
|
|
@ -2718,6 +2729,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
fields.AddRange(dataTypes.GetAcknowledgment(acknowledgment_1_19_2!, isOnlineMode && Config.Signature.LoginWithSecureProfile));
|
||||
}
|
||||
}
|
||||
}
|
||||
SendPacket(PacketTypesOut.ChatMessage, fields);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue