mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
ResourcePackSend: Fix 1.17 regression (#1637)
New fields in 1.17 were also read for older versions
This commit is contained in:
parent
4577deee61
commit
1f2137c985
1 changed files with 15 additions and 8 deletions
|
|
@ -849,17 +849,24 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
case PacketTypesIn.ResourcePackSend:
|
case PacketTypesIn.ResourcePackSend:
|
||||||
string url = dataTypes.ReadNextString(packetData);
|
string url = dataTypes.ReadNextString(packetData);
|
||||||
string hash = dataTypes.ReadNextString(packetData);
|
string hash = dataTypes.ReadNextString(packetData);
|
||||||
bool forced = dataTypes.ReadNextBool(packetData);
|
bool forced = true; // Assume forced for MC 1.16 and below
|
||||||
|
if (protocolversion >= MC117Version)
|
||||||
|
{
|
||||||
|
forced = dataTypes.ReadNextBool(packetData);
|
||||||
String forcedMessage = ChatParser.ParseText(dataTypes.ReadNextString(packetData));
|
String forcedMessage = ChatParser.ParseText(dataTypes.ReadNextString(packetData));
|
||||||
|
}
|
||||||
// Some server plugins may send invalid resource packs to probe the client and we need to ignore them (issue #1056)
|
// Some server plugins may send invalid resource packs to probe the client and we need to ignore them (issue #1056)
|
||||||
if (hash.Length != 40)
|
if (hash.Length != 40)
|
||||||
break;
|
break;
|
||||||
//Send back "accepted" and "successfully loaded" responses for plugins making use of resource pack mandatory
|
//Send back "accepted" and "successfully loaded" responses for plugins or server config making use of resource pack mandatory
|
||||||
|
if (forced)
|
||||||
|
{
|
||||||
byte[] responseHeader = new byte[0];
|
byte[] responseHeader = new byte[0];
|
||||||
if (protocolversion < MC110Version) //MC 1.10 does not include resource pack hash in responses
|
if (protocolversion < MC110Version) //MC 1.10 does not include resource pack hash in responses
|
||||||
responseHeader = dataTypes.ConcatBytes(dataTypes.GetVarInt(hash.Length), Encoding.UTF8.GetBytes(hash));
|
responseHeader = dataTypes.ConcatBytes(dataTypes.GetVarInt(hash.Length), Encoding.UTF8.GetBytes(hash));
|
||||||
SendPacket(PacketTypesOut.ResourcePackStatus, dataTypes.ConcatBytes(responseHeader, dataTypes.GetVarInt(3))); //Accepted pack
|
SendPacket(PacketTypesOut.ResourcePackStatus, dataTypes.ConcatBytes(responseHeader, dataTypes.GetVarInt(3))); //Accepted pack
|
||||||
SendPacket(PacketTypesOut.ResourcePackStatus, dataTypes.ConcatBytes(responseHeader, dataTypes.GetVarInt(0))); //Successfully loaded
|
SendPacket(PacketTypesOut.ResourcePackStatus, dataTypes.ConcatBytes(responseHeader, dataTypes.GetVarInt(0))); //Successfully loaded
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PacketTypesIn.SpawnEntity:
|
case PacketTypesIn.SpawnEntity:
|
||||||
if (handler.GetEntityHandlingEnabled())
|
if (handler.GetEntityHandlingEnabled())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue