More tools, added debug tools, fixed issues with some tools.

This commit is contained in:
Anon 2026-03-28 04:12:37 +01:00
parent 79b091cab6
commit 7f9023e7bb
16 changed files with 4005 additions and 72 deletions

View file

@ -1569,6 +1569,7 @@ namespace MinecraftClient.Protocol.Handlers
var dataSize = dataTypes.ReadNextVarInt(packetData); // Size
pTerrain.ProcessChunkColumnData(chunkX, chunkZ, verticalStripBitmask, packetData);
ProcessChunkBlockEntityData(chunkX, chunkZ, packetData);
Interlocked.Decrement(ref handler.GetWorld().chunkLoadNotCompleted);
// Block Entity data: ignored
@ -2957,17 +2958,16 @@ namespace MinecraftClient.Protocol.Handlers
// TODO: Use
break;
case PacketTypesIn.BlockEntityData:
if (handler.GetTerrainEnabled() && protocolVersion >= MC_1_17_Version)
{
var location_ = dataTypes.ReadNextLocation(packetData);
dataTypes.ReadNextVarInt(packetData); // Block entity type registry id
var nbt = dataTypes.ReadNextNbt(packetData);
handler.OnBlockEntityData(location_, nbt);
}
// Temporarily disabled until I find a fix
/*case PacketTypesIn.BlockEntityData:
var location_ = dataTypes.ReadNextLocation(packetData);
var type_ = dataTypes.ReadNextInt(packetData);
var nbt = dataTypes.ReadNextNbt(packetData);
var nbtJson = JsonConvert.SerializeObject(nbt["messages"]);
//log.Info($"BLOCK ENTITY DATA -> {location_.ToString()} [{type_}] -> NBT: {nbtJson}");
break;*/
break;
case PacketTypesIn.SetTickingState:
dataTypes.ReadNextFloat(packetData);
@ -3162,6 +3162,24 @@ namespace MinecraftClient.Protocol.Handlers
SendPacket(packetPalette.GetOutgoingIdByType(packet), packetData);
}
private void ProcessChunkBlockEntityData(int chunkX, int chunkZ, Queue<byte> packetData)
{
if (protocolVersion < MC_1_17_Version || packetData.Count == 0)
return;
int blockEntityCount = dataTypes.ReadNextVarInt(packetData);
for (int i = 0; i < blockEntityCount; i++)
{
int packedXZ = dataTypes.ReadNextByte(packetData);
int y = dataTypes.ReadNextShort(packetData);
dataTypes.ReadNextVarInt(packetData); // Block entity type registry id
Dictionary<string, object>? nbt = dataTypes.ReadNextNbt(packetData);
int blockX = chunkX * Chunk.SizeX + ((packedXZ >> 4) & 0x0F);
int blockZ = chunkZ * Chunk.SizeZ + (packedXZ & 0x0F);
handler.OnBlockEntityData(new Location(blockX, y, blockZ), nbt);
}
}
/// <summary>
/// Send a configuration packet to the server. Packet ID, compression, and encryption will be handled automatically.
/// </summary>