mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
NBT Changes, needs fixing
This commit is contained in:
parent
790e0bfe55
commit
975aab88e3
2 changed files with 36 additions and 6 deletions
|
|
@ -561,18 +561,43 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
return nbtData;
|
return nbtData;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cache.Peek() != 10) // TAG_Compound
|
var nextId = cache.Peek();
|
||||||
throw new System.IO.InvalidDataException("Failed to decode NBT: Does not start with TAG_Compound");
|
|
||||||
ReadNextByte(cache); // Tag type (TAG_Compound)
|
|
||||||
|
|
||||||
if (protocolversion < Protocol18Handler.MC_1_20_2_Version)
|
if (protocolversion < Protocol18Handler.MC_1_20_2_Version)
|
||||||
{
|
{
|
||||||
|
if (nextId is 10) // TAG_Compound
|
||||||
|
throw new System.IO.InvalidDataException("Failed to decode NBT: Does not start with TAG_Compound");
|
||||||
|
|
||||||
|
// Read TAG_Compound
|
||||||
|
ReadNextByte(cache);
|
||||||
|
|
||||||
// NBT root name
|
// NBT root name
|
||||||
var rootName = Encoding.ASCII.GetString(ReadData(ReadNextUShort(cache), cache));
|
var rootName = Encoding.ASCII.GetString(ReadData(ReadNextUShort(cache), cache));
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(rootName))
|
if (!string.IsNullOrEmpty(rootName))
|
||||||
nbtData[""] = rootName;
|
nbtData[""] = rootName;
|
||||||
}
|
}
|
||||||
|
// In 1.20.2 The root TAG_Compound doesn't have a name
|
||||||
|
// In 1.20.3+ The root can be TAG_Compound or TAG_String
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (nextId is not (10 or 8)) // TAG_Compound or TAG_String
|
||||||
|
throw new System.IO.InvalidDataException("Failed to decode NBT: Does not start with TAG_Compound or TAG_String");
|
||||||
|
|
||||||
|
// Read TAG_String
|
||||||
|
if(nextId is 8)
|
||||||
|
{
|
||||||
|
var byteArrayLength = ReadNextUShort(cache);
|
||||||
|
var result = Encoding.UTF8.GetString(ReadData(byteArrayLength, cache));
|
||||||
|
|
||||||
|
return new Dictionary<string, object>()
|
||||||
|
{
|
||||||
|
{ "", result }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read TAG_Compound
|
||||||
|
ReadNextByte(cache);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
|
|
|
||||||
|
|
@ -1674,7 +1674,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hasMotd = true;
|
hasMotd = true;
|
||||||
motd = ChatParser.ParseText(dataTypes.ReadNextString(packetData));
|
motd = (string)dataTypes.ReadNextNbt(packetData)[""];
|
||||||
}
|
}
|
||||||
|
|
||||||
var iconBase64 = "-";
|
var iconBase64 = "-";
|
||||||
|
|
@ -2635,6 +2635,11 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
|
|
||||||
break;*/
|
break;*/
|
||||||
|
|
||||||
|
case PacketTypesIn.SetTickingState:
|
||||||
|
dataTypes.ReadNextFloat(packetData);
|
||||||
|
dataTypes.ReadNextBool(packetData);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false; //Ignored packet
|
return false; //Ignored packet
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue