Fixed incorrect handling in 1.18(1.18.1) and 1.18.2

This commit is contained in:
BruceChen 2022-07-24 22:21:15 +08:00
parent 3429989527
commit 59ed18bb40
5 changed files with 15 additions and 7 deletions

View file

@ -410,7 +410,10 @@ namespace MinecraftClient.Protocol.Handlers
if (living)
{
entityPitch = ReadNextByte(cache);
if (protocolversion >= Protocol18Handler.MC1182Version)
entityYaw = ReadNextByte(cache);
else
entityPitch = ReadNextByte(cache);
}
else
{

View file

@ -1208,7 +1208,7 @@ namespace MinecraftClient.Protocol.Handlers
break;
case PacketTypesIn.UpdateScore:
string entityname = dataTypes.ReadNextString(packetData);
byte action3 = dataTypes.ReadNextByte(packetData);
int action3 = protocolversion >= MC1182Version ? dataTypes.ReadNextVarInt(packetData) : dataTypes.ReadNextByte(packetData);
string objectivename2 = null;
int value = -1;
if (action3 != 1 || protocolversion >= MC18Version)
@ -1713,7 +1713,12 @@ namespace MinecraftClient.Protocol.Handlers
if (protocolversion >= MC19Version)
fields.AddRange(dataTypes.GetVarInt(mainHand));
if (protocolversion >= MC117Version)
fields.Add(1); // 1.17 and above - Disable text filtering. (Always true)
{
if (protocolversion == MC117Version || protocolversion == MC1171Version)
fields.Add(1); // 1.17 and 1.17.1 - Disable text filtering. (Always true)
else
fields.Add(0); // 1.18 and above - Enable text filtering. (Always false)
}
if (protocolversion >= MC1181Version)
fields.Add(1); // 1.18 and above - Allow server listings
SendPacket(PacketTypesOut.ClientSettings, fields);
@ -2040,7 +2045,7 @@ namespace MinecraftClient.Protocol.Handlers
packet.AddRange(arrayOfSlots);
}
packet.AddRange(dataTypes.GetItemSlot(item, itemPalette)); // Clicked item
packet.AddRange(dataTypes.GetItemSlot(item, itemPalette)); // Carried item (Clicked item)
log.Info("Packet data: " + dataTypes.ByteArrayToString(packet.ToArray()));

View file

@ -374,7 +374,7 @@ namespace MinecraftClient.Protocol
/// <param name="action">0 to create/update an item. 1 to remove an item.</param>
/// <param name="objectivename">The name of the objective the score belongs to</param>
/// <param name="value">he score to be displayed next to the entry. Only sent when Action does not equal 1.</param>
void OnUpdateScore(string entityname, byte action, string objectivename, int value);
void OnUpdateScore(string entityname, int action, string objectivename, int value);
/// <summary>
/// Called when tradeList is received from server