mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Tested on all versions 1.8 +
Fixed 1.14 not working at all.
This commit is contained in:
parent
f47c240920
commit
12c8a60ad7
3 changed files with 68 additions and 18 deletions
|
|
@ -584,6 +584,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
{
|
||||
Dictionary<int, object?> data = new();
|
||||
byte key = ReadNextByte(cache);
|
||||
|
||||
while (key != 0xff)
|
||||
{
|
||||
int type = ReadNextVarInt(cache);
|
||||
|
|
@ -599,6 +600,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
type += 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Value's data type is depended on Type
|
||||
object? value = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
p = new PacketPalette112();
|
||||
else if (protocol <= Protocol18Handler.MC_1_12_2_Version)
|
||||
p = new PacketPalette1122();
|
||||
else if (protocol <= Protocol18Handler.MC_1_14_Version)
|
||||
else if (protocol < Protocol18Handler.MC_1_14_Version)
|
||||
p = new PacketPalette113();
|
||||
else if (protocol <= Protocol18Handler.MC_1_15_Version)
|
||||
p = new PacketPalette114();
|
||||
|
|
|
|||
|
|
@ -4,23 +4,22 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading;
|
||||
using System.Security.Cryptography;
|
||||
using System.Diagnostics;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Collections.Concurrent;
|
||||
using MinecraftClient.Crypto;
|
||||
using MinecraftClient.Proxy;
|
||||
using System.Security.Cryptography;
|
||||
using MinecraftClient.Mapping;
|
||||
using MinecraftClient.Mapping.BlockPalettes;
|
||||
using MinecraftClient.Mapping.EntityPalettes;
|
||||
using MinecraftClient.Protocol.Handlers.Forge;
|
||||
using MinecraftClient.Inventory;
|
||||
using System.Diagnostics;
|
||||
using MinecraftClient.Inventory.ItemPalettes;
|
||||
using MinecraftClient.Protocol.Handlers.PacketPalettes;
|
||||
using MinecraftClient.Logger;
|
||||
using System.Threading.Tasks;
|
||||
using MinecraftClient.Protocol.Keys;
|
||||
using System.Text.RegularExpressions;
|
||||
using MinecraftClient.Protocol.Session;
|
||||
using System.Collections.Concurrent;
|
||||
using MinecraftClient.Protocol.Message;
|
||||
|
||||
namespace MinecraftClient.Protocol.Handlers
|
||||
|
|
@ -45,6 +44,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
internal const int MC_1_12_Version = 335;
|
||||
internal const int MC_1_12_2_Version = 340;
|
||||
internal const int MC_1_13_Version = 393;
|
||||
internal const int MC_1_13_2_Version = 404;
|
||||
internal const int MC_1_14_Version = 477;
|
||||
internal const int MC_1_15_Version = 573;
|
||||
internal const int MC_1_15_2_Version = 578;
|
||||
|
|
@ -781,23 +781,42 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
}
|
||||
break;
|
||||
case PacketTypesIn.MapData:
|
||||
if (protocolVersion < MC_1_8_Version)
|
||||
break;
|
||||
|
||||
int mapid = dataTypes.ReadNextVarInt(packetData);
|
||||
byte scale = dataTypes.ReadNextByte(packetData);
|
||||
bool trackingPosition = protocolVersion >= MC_1_17_Version ? false : dataTypes.ReadNextBool(packetData);
|
||||
|
||||
|
||||
// 1.9 +
|
||||
bool trackingPosition = true;
|
||||
|
||||
// 1.14+
|
||||
bool locked = false;
|
||||
if (protocolVersion >= MC_1_14_Version)
|
||||
{
|
||||
locked = dataTypes.ReadNextBool(packetData);
|
||||
}
|
||||
|
||||
// 1.17+ (locked and trackingPosition switched places)
|
||||
if (protocolVersion >= MC_1_17_Version)
|
||||
{
|
||||
if (protocolVersion >= MC_1_14_Version)
|
||||
locked = dataTypes.ReadNextBool(packetData);
|
||||
|
||||
if (protocolVersion >= MC_1_9_Version)
|
||||
trackingPosition = dataTypes.ReadNextBool(packetData);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (protocolVersion >= MC_1_9_Version)
|
||||
trackingPosition = dataTypes.ReadNextBool(packetData);
|
||||
|
||||
if (protocolVersion >= MC_1_14_Version)
|
||||
locked = dataTypes.ReadNextBool(packetData);
|
||||
}
|
||||
|
||||
int iconcount = 0;
|
||||
List<MapIcon> icons = new();
|
||||
|
||||
if (trackingPosition)
|
||||
// 1,9 + = needs tracking position to be true to get the icons
|
||||
if (protocolVersion > MC_1_9_Version ? trackingPosition : true)
|
||||
{
|
||||
iconcount = dataTypes.ReadNextVarInt(packetData);
|
||||
|
||||
|
|
@ -805,14 +824,43 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
{
|
||||
MapIcon mapIcon = new();
|
||||
|
||||
// 1.8 - 1.13
|
||||
if (protocolVersion < MC_1_13_2_Version)
|
||||
{
|
||||
byte directionAndtype = dataTypes.ReadNextByte(packetData);
|
||||
byte direction, type;
|
||||
|
||||
// 1.12.2+
|
||||
if (protocolVersion >= MC_1_12_2_Version)
|
||||
{
|
||||
direction = (byte)(directionAndtype & 0xF);
|
||||
type = (byte)((directionAndtype >> 4) & 0xF);
|
||||
}
|
||||
else // 1.8 - 1.12
|
||||
{
|
||||
direction = (byte)((directionAndtype >> 4) & 0xF);
|
||||
type = (byte)(directionAndtype & 0xF);
|
||||
}
|
||||
|
||||
mapIcon.Type = (MapIconType)type;
|
||||
mapIcon.Direction = direction;
|
||||
}
|
||||
|
||||
// 1.13.2+
|
||||
if (protocolVersion >= MC_1_13_2_Version)
|
||||
mapIcon.Type = (MapIconType)dataTypes.ReadNextVarInt(packetData);
|
||||
|
||||
mapIcon.X = dataTypes.ReadNextByte(packetData);
|
||||
mapIcon.Z = dataTypes.ReadNextByte(packetData);
|
||||
mapIcon.Direction = dataTypes.ReadNextByte(packetData);
|
||||
bool mapIconHasDisplayName = dataTypes.ReadNextBool(packetData);
|
||||
|
||||
if (mapIconHasDisplayName)
|
||||
// 1.13.2+
|
||||
if (protocolVersion >= MC_1_13_2_Version)
|
||||
{
|
||||
mapIcon.Direction = dataTypes.ReadNextByte(packetData);
|
||||
|
||||
if (dataTypes.ReadNextBool(packetData)) // Has Display Name?
|
||||
mapIcon.DisplayName = ChatParser.ParseText(dataTypes.ReadNextString(packetData));
|
||||
}
|
||||
|
||||
icons.Add(mapIcon);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue