Formatted the code and removed logs from Auto Attack

This commit is contained in:
Anon 2026-06-04 11:42:41 +02:00
parent a4ff7ae438
commit c6ca3dc13d
117 changed files with 602 additions and 585 deletions

View file

@ -62,14 +62,17 @@ namespace MinecraftClient.Protocol.Message
public static void ReadChatType(Dictionary<string, object> registryCodec)
{
Dictionary<int, MessageType> chatTypeDictionary = ChatId2Type ?? new();
// Check if the chat type registry is in the correct format
if (!registryCodec.ContainsKey("minecraft:chat_type")) {
if (!registryCodec.ContainsKey("minecraft:chat_type"))
{
// If not, then we force the registry to be in the correct format
if (registryCodec.ContainsKey("chat_type")) {
foreach (var key in registryCodec.Keys.ToArray()) {
if (registryCodec.ContainsKey("chat_type"))
{
foreach (var key in registryCodec.Keys.ToArray())
{
// Skip entries with a namespace already
if (key.Contains(':', StringComparison.OrdinalIgnoreCase)) continue;
@ -79,12 +82,12 @@ namespace MinecraftClient.Protocol.Message
}
}
}
var chatTypeListNbt = (object[])(((Dictionary<string, object>)registryCodec["minecraft:chat_type"])["value"]);
foreach (var (chatName, chatId) in from Dictionary<string, object> chatTypeNbt in chatTypeListNbt
let chatName = (string)chatTypeNbt["name"]
let chatId = (int)chatTypeNbt["id"]
select (chatName, chatId))
let chatName = (string)chatTypeNbt["name"]
let chatId = (int)chatTypeNbt["id"]
select (chatName, chatId))
{
chatTypeDictionary[chatId] = chatName switch
{