mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Added Configuration Packets mapping
This commit is contained in:
parent
7aabe8ba28
commit
e13ba93f47
22 changed files with 252 additions and 214 deletions
|
|
@ -0,0 +1,16 @@
|
|||
namespace MinecraftClient.Protocol.Handlers;
|
||||
|
||||
public enum ConfigurationPacketTypesIn
|
||||
{
|
||||
PluginMessage,
|
||||
Disconnect,
|
||||
FinishConfiguration,
|
||||
KeepAlive,
|
||||
Ping,
|
||||
RegistryData,
|
||||
ResourcePack,
|
||||
FeatureFlags,
|
||||
UpdateTags,
|
||||
|
||||
Unknown
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
namespace MinecraftClient.Protocol.Handlers;
|
||||
|
||||
public enum ConfigurationPacketTypesOut
|
||||
{
|
||||
ClientInformation,
|
||||
PluginMessage,
|
||||
FinishConfiguration,
|
||||
KeepAlive,
|
||||
Pong,
|
||||
ResourcePackResponse,
|
||||
|
||||
Unknown
|
||||
}
|
||||
|
|
@ -118,14 +118,9 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x1D, PacketTypesOut.UseItem },
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||
{
|
||||
return typeIn;
|
||||
}
|
||||
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut()
|
||||
{
|
||||
return typeOut;
|
||||
}
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => null!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => null!;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,14 +124,9 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x20, PacketTypesOut.UseItem },
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||
{
|
||||
return typeIn;
|
||||
}
|
||||
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut()
|
||||
{
|
||||
return typeOut;
|
||||
}
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => null!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => null!;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,14 +125,9 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x20, PacketTypesOut.UseItem },
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||
{
|
||||
return typeIn;
|
||||
}
|
||||
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut()
|
||||
{
|
||||
return typeOut;
|
||||
}
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => null!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => null!;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,14 +141,9 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x2A, PacketTypesOut.UseItem },
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||
{
|
||||
return typeIn;
|
||||
}
|
||||
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut()
|
||||
{
|
||||
return typeOut;
|
||||
}
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => null!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => null!;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,14 +151,9 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x2D, PacketTypesOut.UseItem },
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||
{
|
||||
return typeIn;
|
||||
}
|
||||
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut()
|
||||
{
|
||||
return typeOut;
|
||||
}
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => null!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => null!;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,14 +151,9 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x2D, PacketTypesOut.UseItem },
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||
{
|
||||
return typeIn;
|
||||
}
|
||||
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut()
|
||||
{
|
||||
return typeOut;
|
||||
}
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => null!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => null!;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,14 +151,9 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x2E, PacketTypesOut.UseItem },
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||
{
|
||||
return typeIn;
|
||||
}
|
||||
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut()
|
||||
{
|
||||
return typeOut;
|
||||
}
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => null!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => null!;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,14 +152,9 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x2F, PacketTypesOut.UseItem },
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||
{
|
||||
return typeIn;
|
||||
}
|
||||
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut()
|
||||
{
|
||||
return typeOut;
|
||||
}
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => null!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => null!;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,14 +163,9 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x2F, PacketTypesOut.UseItem },
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||
{
|
||||
return typeIn;
|
||||
}
|
||||
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut()
|
||||
{
|
||||
return typeOut;
|
||||
}
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => null!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => null!;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -164,14 +164,9 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x2F, PacketTypesOut.UseItem },
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||
{
|
||||
return typeIn;
|
||||
}
|
||||
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut()
|
||||
{
|
||||
return typeOut;
|
||||
}
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => null!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => null!;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x00, PacketTypesOut.TeleportConfirm }, // (Wiki name: Confirm Teleportation)
|
||||
{ 0x01, PacketTypesOut.QueryBlockNBT }, // (Wiki name: Query Block Entity Tag)
|
||||
{ 0x02, PacketTypesOut.SetDifficulty }, // (Wiki name: Change Difficutly)
|
||||
{ 0x03, PacketTypesOut.MessageAcknowledgment }, // TODO
|
||||
{ 0x03, PacketTypesOut.MessageAcknowledgment }, //
|
||||
{ 0x04, PacketTypesOut.ChatCommand }, // Added in 1.19
|
||||
{ 0x05, PacketTypesOut.ChatMessage }, // Changed in 1.19 (Completely changed) (Wiki name: Chat)
|
||||
{ 0x06, PacketTypesOut.ClientStatus }, // (Wiki name: Client Command)
|
||||
|
|
@ -147,7 +147,7 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x1D, PacketTypesOut.EntityAction }, // (Wiki name: Player Command)
|
||||
{ 0x1E, PacketTypesOut.SteerVehicle }, // (Wiki name: Player Input)
|
||||
{ 0x1F, PacketTypesOut.Pong }, // (Wiki name: Pong (play))
|
||||
{ 0x20, PacketTypesOut.PlayerSession }, // Added in 1.19.3 TODO
|
||||
{ 0x20, PacketTypesOut.PlayerSession }, // Added in 1.19.3
|
||||
{ 0x21, PacketTypesOut.SetDisplayedRecipe }, // (Wiki name: Recipe Book Change Settings)
|
||||
{ 0x22, PacketTypesOut.SetRecipeBookState }, // (Wiki name: Recipe Book Seen Recipe)
|
||||
{ 0x23, PacketTypesOut.NameItem }, // (Wiki name: Rename Item)
|
||||
|
|
@ -168,14 +168,9 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x32, PacketTypesOut.UseItem }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item)
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||
{
|
||||
return typeIn;
|
||||
}
|
||||
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut()
|
||||
{
|
||||
return typeOut;
|
||||
}
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => null!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => null!;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,14 +171,9 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x32, PacketTypesOut.UseItem }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item)
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||
{
|
||||
return typeIn;
|
||||
}
|
||||
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut()
|
||||
{
|
||||
return typeOut;
|
||||
}
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => null!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => null!;
|
||||
}
|
||||
}
|
||||
|
|
@ -170,14 +170,9 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x32, PacketTypesOut.UseItem }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item)
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||
{
|
||||
return typeIn;
|
||||
}
|
||||
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut()
|
||||
{
|
||||
return typeOut;
|
||||
}
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => null!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => null!;
|
||||
}
|
||||
}
|
||||
|
|
@ -175,14 +175,9 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x32, PacketTypesOut.UseItem }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item)
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||
{
|
||||
return typeIn;
|
||||
}
|
||||
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut()
|
||||
{
|
||||
return typeOut;
|
||||
}
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => null!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => null!;
|
||||
}
|
||||
}
|
||||
|
|
@ -18,8 +18,8 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x09, PacketTypesIn.BlockChange }, // (Wiki name: Block Update)
|
||||
{ 0x0A, PacketTypesIn.BossBar }, //
|
||||
{ 0x0B, PacketTypesIn.ServerDifficulty }, // (Wiki name: Change Difficulty)
|
||||
{ 0x0C, PacketTypesIn.ChunkBatchFinished }, // Added in 1.20.2 - TODO
|
||||
{ 0x0D, PacketTypesIn.ChunkBatchStarted }, // Added in 1.20.2 - TODO
|
||||
{ 0x0C, PacketTypesIn.ChunkBatchFinished }, // Added in 1.20.2
|
||||
{ 0x0D, PacketTypesIn.ChunkBatchStarted }, // Added in 1.20.2
|
||||
{ 0x0E, PacketTypesIn.ChunksBiomes }, // Added in 1.19.4
|
||||
{ 0x0F, PacketTypesIn.ClearTiles }, //
|
||||
{ 0x10, PacketTypesIn.TabComplete }, // (Wiki name: Command Suggestions Response)
|
||||
|
|
@ -47,7 +47,7 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x26, PacketTypesIn.Effect }, // (Wiki name: World Event)
|
||||
{ 0x27, PacketTypesIn.Particle }, // Changed in 1.19 ("Particle Data" field is now "Max Speed", it's the same Float data type) (Wiki name: Level Particle) (No need to be implemented)
|
||||
{ 0x28, PacketTypesIn.UpdateLight }, // (Wiki name: Light Update)
|
||||
{ 0x29, PacketTypesIn.JoinGame }, // Changed in 1.20.2 (Wiki name: Login (play)) - TODO
|
||||
{ 0x29, PacketTypesIn.JoinGame }, // Changed in 1.20.2 (Wiki name: Login (play))
|
||||
{ 0x2A, PacketTypesIn.MapData }, // (Wiki name: Map Item Data)
|
||||
{ 0x2B, PacketTypesIn.TradeList }, // (Wiki name: Merchant Offers)
|
||||
{ 0x2C, PacketTypesIn.EntityPosition }, // (Wiki name: Move Entity Position)
|
||||
|
|
@ -58,7 +58,7 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x31, PacketTypesIn.OpenWindow }, // (Wiki name: Open Screen)
|
||||
{ 0x32, PacketTypesIn.OpenSignEditor }, //
|
||||
{ 0x33, PacketTypesIn.Ping }, // (Wiki name: Ping (play))
|
||||
{ 0x34, PacketTypesIn.PingResponse }, // Added in 1.20.2 - TODO
|
||||
{ 0x34, PacketTypesIn.PingResponse }, // Added in 1.20.2
|
||||
{ 0x35, PacketTypesIn.CraftRecipeResponse }, // (Wiki name: Place Ghost Recipe)
|
||||
{ 0x36, PacketTypesIn.PlayerAbilities }, //
|
||||
{ 0x37, PacketTypesIn.ChatMessage }, // Changed in 1.19 (Completely changed) (Wiki name: Player Chat Message)
|
||||
|
|
@ -73,7 +73,7 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x40, PacketTypesIn.DestroyEntities }, // (Wiki name: Remove Entites)
|
||||
{ 0x41, PacketTypesIn.RemoveEntityEffect }, //
|
||||
{ 0x42, PacketTypesIn.ResourcePackSend }, // (Wiki name: Resource Pack)
|
||||
{ 0x43, PacketTypesIn.Respawn }, // Changed in 1.20.2 - TODO
|
||||
{ 0x43, PacketTypesIn.Respawn }, // Changed in 1.20.2
|
||||
{ 0x44, PacketTypesIn.EntityHeadLook }, // (Wiki name: Set Head Rotation)
|
||||
{ 0x45, PacketTypesIn.MultiBlockChange }, // (Wiki name: Update Section Blocks)
|
||||
{ 0x46, PacketTypesIn.SelectAdvancementTab }, //
|
||||
|
|
@ -89,12 +89,12 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x50, PacketTypesIn.UpdateViewPosition }, // (Wiki name: Set Center Chunk)
|
||||
{ 0x51, PacketTypesIn.UpdateViewDistance }, // (Wiki name: Set Render Distance)
|
||||
{ 0x52, PacketTypesIn.SpawnPosition }, // (Wiki name: Set Default Spawn Position)
|
||||
{ 0x53, PacketTypesIn.DisplayScoreboard }, // (Wiki name: Set Display Objective) - TODO
|
||||
{ 0x53, PacketTypesIn.DisplayScoreboard }, // (Wiki name: Set Display Objective)
|
||||
{ 0x54, PacketTypesIn.EntityMetadata }, // (Wiki name: Set Entity Metadata)
|
||||
{ 0x55, PacketTypesIn.AttachEntity }, // (Wiki name: Link Entities)
|
||||
{ 0x56, PacketTypesIn.EntityVelocity }, // (Wiki name: Set Entity Velocity)
|
||||
{ 0x57, PacketTypesIn.EntityEquipment }, // (Wiki name: Set Equipment)
|
||||
{ 0x58, PacketTypesIn.SetExperience }, // Changed in 1.20.2 - TODO
|
||||
{ 0x58, PacketTypesIn.SetExperience }, // Changed in 1.20.2
|
||||
{ 0x59, PacketTypesIn.UpdateHealth }, // (Wiki name: Set Health)
|
||||
{ 0x5A, PacketTypesIn.ScoreboardObjective }, // (Wiki name: Update Objectives)
|
||||
{ 0x5B, PacketTypesIn.SetPassengers }, //
|
||||
|
|
@ -107,7 +107,7 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x62, PacketTypesIn.SetTitleTime }, // (Wiki name: Set Title Animation Times)
|
||||
{ 0x63, PacketTypesIn.EntitySoundEffect }, // (Wiki name: Sound Entity)
|
||||
{ 0x64, PacketTypesIn.SoundEffect }, // Changed in 1.19 (Added "Seed" field) (Wiki name: Sound Effect) (No need to be implemented)
|
||||
{ 0x65, PacketTypesIn.StartConfiguration }, // Added in 1.20.2 - TODO
|
||||
{ 0x65, PacketTypesIn.StartConfiguration }, // Added in 1.20.2
|
||||
{ 0x66, PacketTypesIn.StopSound }, //
|
||||
{ 0x67, PacketTypesIn.SystemChat }, // Added in 1.19 (Wiki name: System Chat Message)
|
||||
{ 0x68, PacketTypesIn.PlayerListHeaderAndFooter }, // (Wiki name: Set Tab List Header And Footer)
|
||||
|
|
@ -130,11 +130,11 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x04, PacketTypesOut.ChatCommand }, // Added in 1.19
|
||||
{ 0x05, PacketTypesOut.ChatMessage }, // Changed in 1.19 (Completely changed) (Wiki name: Chat)
|
||||
{ 0x06, PacketTypesOut.PlayerSession }, // Added in 1.19.3
|
||||
{ 0x07, PacketTypesOut.ChunkBatchReceived }, // Added in 1.20.2 - TODO
|
||||
{ 0x07, PacketTypesOut.ChunkBatchReceived }, // Added in 1.20.2
|
||||
{ 0x08, PacketTypesOut.ClientStatus }, // (Wiki name: Client Command)
|
||||
{ 0x09, PacketTypesOut.ClientSettings }, // (Wiki name: Client Information)
|
||||
{ 0x0A, PacketTypesOut.TabComplete }, // (Wiki name: Command Suggestions Request)
|
||||
{ 0x0B, PacketTypesOut.AcknowledgeConfiguration }, // Added in 1.20.2 - TODO
|
||||
{ 0x0B, PacketTypesOut.AcknowledgeConfiguration }, // Added in 1.20.2
|
||||
{ 0x0C, PacketTypesOut.ClickWindowButton }, // (Wiki name: Click Container Button)
|
||||
{ 0x0D, PacketTypesOut.ClickWindow }, // (Wiki name: Click Container)
|
||||
{ 0x0E, PacketTypesOut.CloseWindow }, // (Wiki name: Close Container (serverbound))
|
||||
|
|
@ -152,7 +152,7 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x1A, PacketTypesOut.VehicleMove }, // (Wiki name: Move Vehicle (serverbound))
|
||||
{ 0x1B, PacketTypesOut.SteerBoat }, // (Wiki name: Paddle Boat)
|
||||
{ 0x1C, PacketTypesOut.PickItem }, //
|
||||
{ 0x1D, PacketTypesOut.PingRequest }, // Added in 1.20.2 - TODO
|
||||
{ 0x1D, PacketTypesOut.PingRequest }, // Added in 1.20.2
|
||||
{ 0x1E, PacketTypesOut.CraftRecipeRequest }, // (Wiki name: Place recipe)
|
||||
{ 0x1F, PacketTypesOut.PlayerAbilities }, //
|
||||
{ 0x20, PacketTypesOut.PlayerDigging }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Player Action)
|
||||
|
|
@ -179,14 +179,32 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x35, PacketTypesOut.UseItem }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item)
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesIn> configurationTypesIn = new()
|
||||
{
|
||||
return typeIn;
|
||||
}
|
||||
{ 0x00, ConfigurationPacketTypesIn.PluginMessage },
|
||||
{ 0x01, ConfigurationPacketTypesIn.Disconnect },
|
||||
{ 0x02, ConfigurationPacketTypesIn.FinishConfiguration },
|
||||
{ 0x03, ConfigurationPacketTypesIn.KeepAlive },
|
||||
{ 0x04, ConfigurationPacketTypesIn.Ping },
|
||||
{ 0x05, ConfigurationPacketTypesIn.RegistryData },
|
||||
{ 0x06, ConfigurationPacketTypesIn.ResourcePack },
|
||||
{ 0x07, ConfigurationPacketTypesIn.FeatureFlags },
|
||||
{ 0x08, ConfigurationPacketTypesIn.UpdateTags },
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut()
|
||||
private readonly Dictionary<int, ConfigurationPacketTypesOut> configurationTypesOut = new()
|
||||
{
|
||||
return typeOut;
|
||||
}
|
||||
{ 0x00, ConfigurationPacketTypesOut.ClientInformation },
|
||||
{ 0x01, ConfigurationPacketTypesOut.PluginMessage },
|
||||
{ 0x02, ConfigurationPacketTypesOut.FinishConfiguration },
|
||||
{ 0x03, ConfigurationPacketTypesOut.KeepAlive },
|
||||
{ 0x04, ConfigurationPacketTypesOut.Pong },
|
||||
{ 0x05, ConfigurationPacketTypesOut.ResourcePackResponse }
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => configurationTypesIn!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => configurationTypesOut!;
|
||||
}
|
||||
}
|
||||
|
|
@ -112,14 +112,10 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x19, PacketTypesOut.ResourcePackStatus },
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||
{
|
||||
return typeIn;
|
||||
}
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut()
|
||||
{
|
||||
return typeOut;
|
||||
}
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => null!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => null!;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,14 +117,9 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{ 0x20, PacketTypesOut.UseItem },
|
||||
};
|
||||
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn()
|
||||
{
|
||||
return typeIn;
|
||||
}
|
||||
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut()
|
||||
{
|
||||
return typeOut;
|
||||
}
|
||||
protected override Dictionary<int, PacketTypesIn> GetListIn() => typeIn;
|
||||
protected override Dictionary<int, PacketTypesOut> GetListOut() => typeOut;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn() => null!;
|
||||
protected override Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut() => null!;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,33 +29,40 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
{
|
||||
protected abstract Dictionary<int, PacketTypesIn> GetListIn();
|
||||
protected abstract Dictionary<int, PacketTypesOut> GetListOut();
|
||||
protected abstract Dictionary<int, ConfigurationPacketTypesIn> GetConfigurationListIn();
|
||||
protected abstract Dictionary<int, ConfigurationPacketTypesOut> GetConfigurationListOut();
|
||||
|
||||
private readonly Dictionary<PacketTypesIn, int> reverseMappingIn = new();
|
||||
|
||||
private readonly Dictionary<PacketTypesOut, int> reverseMappingOut = new();
|
||||
|
||||
private readonly Dictionary<ConfigurationPacketTypesIn, int> configurationReverseMappingIn = new();
|
||||
private readonly Dictionary<ConfigurationPacketTypesOut, int> configurationReverseMappingOut = new();
|
||||
|
||||
private bool forgeEnabled = false;
|
||||
|
||||
public PacketTypePalette()
|
||||
{
|
||||
foreach (var p in GetListIn())
|
||||
{
|
||||
reverseMappingIn.Add(p.Value, p.Key);
|
||||
}
|
||||
|
||||
foreach (var p in GetListOut())
|
||||
{
|
||||
reverseMappingOut.Add(p.Value, p.Key);
|
||||
}
|
||||
|
||||
foreach (var p in GetConfigurationListIn())
|
||||
configurationReverseMappingIn.Add(p.Value, p.Key);
|
||||
|
||||
foreach (var p in GetConfigurationListOut())
|
||||
configurationReverseMappingOut.Add(p.Value, p.Key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get incomming packet type by packet ID
|
||||
/// Get incoming packet type by packet ID
|
||||
/// </summary>
|
||||
/// <param name="packetId">packet ID</param>
|
||||
/// <returns>Packet type</returns>
|
||||
public PacketTypesIn GetIncommingTypeById(int packetId)
|
||||
public PacketTypesIn GetIncomingTypeById(int packetId)
|
||||
{
|
||||
if (GetListIn().TryGetValue(packetId, out PacketTypesIn p))
|
||||
if (GetListIn().TryGetValue(packetId, out var p))
|
||||
{
|
||||
return p;
|
||||
}
|
||||
|
|
@ -70,14 +77,41 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get incomming packet ID by packet type
|
||||
/// Get incoming packet ID by packet type
|
||||
/// </summary>
|
||||
/// <param name="packetType">Packet type</param>
|
||||
/// <returns>packet ID</returns>
|
||||
public int GetIncommingIdByType(PacketTypesIn packetType)
|
||||
public int GetIncomingIdByType(PacketTypesIn packetType) => reverseMappingIn[packetType];
|
||||
|
||||
/// <summary>
|
||||
/// Get incoming configuration packet type by packet ID
|
||||
/// </summary>
|
||||
/// <param name="packetId">packet ID</param>
|
||||
/// <returns>Packet type</returns>
|
||||
public ConfigurationPacketTypesIn GetIncomingConfigurationTypeById(int packetId)
|
||||
{
|
||||
return reverseMappingIn[packetType];
|
||||
if (GetConfigurationListIn().TryGetValue(packetId, out var p))
|
||||
{
|
||||
return p;
|
||||
}
|
||||
else if (forgeEnabled)
|
||||
{
|
||||
if (Settings.Config.Logging.DebugMessages)
|
||||
ConsoleIO.WriteLogLine("Ignoring unknown packet ID of 0x" + packetId.ToString("X2"));
|
||||
return ConfigurationPacketTypesIn.Unknown;
|
||||
}
|
||||
else
|
||||
throw new KeyNotFoundException("Configuration Packet ID of 0x" + packetId.ToString("X2") +
|
||||
" doesn't exist!");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get incoming packet ID by packet type for configuration packets
|
||||
/// </summary>
|
||||
/// <param name="packetType">Packet type</param>
|
||||
/// <returns>packet ID</returns>
|
||||
public int GetIncomingIdByType(ConfigurationPacketTypesIn packetType) =>
|
||||
configurationReverseMappingIn[packetType];
|
||||
|
||||
/// <summary>
|
||||
/// Get outgoing packet type by packet ID
|
||||
|
|
@ -86,7 +120,7 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
/// <returns>Packet type</returns>
|
||||
public PacketTypesOut GetOutgoingTypeById(int packetId)
|
||||
{
|
||||
if (GetListOut().TryGetValue(packetId, out PacketTypesOut p))
|
||||
if (GetListOut().TryGetValue(packetId, out var p))
|
||||
{
|
||||
return p;
|
||||
}
|
||||
|
|
@ -105,29 +139,61 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
|
|||
/// </summary>
|
||||
/// <param name="packetType">Packet type</param>
|
||||
/// <returns>Packet ID</returns>
|
||||
public int GetOutgoingIdByType(PacketTypesOut packetType)
|
||||
public int GetOutgoingIdByType(PacketTypesOut packetType) => reverseMappingOut[packetType];
|
||||
|
||||
/// <summary>
|
||||
/// Get outgoing configuration packet type by packet ID
|
||||
/// </summary>
|
||||
/// <param name="packetId">Packet ID</param>
|
||||
/// <returns>Packet type</returns>
|
||||
public ConfigurationPacketTypesOut GetOutgoingConfigurationTypeById(int packetId)
|
||||
{
|
||||
return reverseMappingOut[packetType];
|
||||
if (GetConfigurationListOut().TryGetValue(packetId, out var p))
|
||||
{
|
||||
return p;
|
||||
}
|
||||
else if (forgeEnabled)
|
||||
{
|
||||
if (Settings.Config.Logging.DebugMessages)
|
||||
ConsoleIO.WriteLogLine("Ignoring unknown packet ID of 0x" + packetId.ToString("X2"));
|
||||
return ConfigurationPacketTypesOut.Unknown;
|
||||
}
|
||||
else
|
||||
throw new KeyNotFoundException("Configuration Packet ID of 0x" + packetId.ToString("X2") +
|
||||
" doesn't exist!");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get outgoing packet ID by packet type for configuration packets
|
||||
/// </summary>
|
||||
/// <param name="packetType">Packet type</param>
|
||||
/// <returns>Packet ID</returns>
|
||||
public int GetOutgoingIdByTypeConfiguration(ConfigurationPacketTypesOut packetType) =>
|
||||
configurationReverseMappingOut[packetType];
|
||||
|
||||
/// <summary>
|
||||
/// Public method for getting the type mapping
|
||||
/// </summary>
|
||||
/// <returns>PacketTypesIn with packet ID as index</returns>
|
||||
public Dictionary<int, PacketTypesIn> GetMappingIn()
|
||||
{
|
||||
return GetListIn();
|
||||
}
|
||||
public Dictionary<int, PacketTypesIn> GetMappingIn() => GetListIn();
|
||||
|
||||
/// <summary>
|
||||
/// Public method for getting the type mapping
|
||||
/// </summary>
|
||||
/// <returns>PacketTypesOut with packet ID as index</returns>
|
||||
public Dictionary<int, PacketTypesOut> GetMappingOut()
|
||||
{
|
||||
return GetListOut();
|
||||
}
|
||||
public Dictionary<int, PacketTypesOut> GetMappingOut() => GetListOut();
|
||||
|
||||
/// <summary>
|
||||
/// Public method for getting the type mapping for configuration packets
|
||||
/// </summary>
|
||||
/// <returns>PacketTypesIn with packet ID as index</returns>
|
||||
public Dictionary<int, ConfigurationPacketTypesIn> GetMappingInConfiguration() => GetConfigurationListIn();
|
||||
|
||||
/// <summary>
|
||||
/// Public method for getting the type mapping for configuration packets
|
||||
/// </summary>
|
||||
/// <returns>PacketTypesOut with packet ID as index</returns>
|
||||
public Dictionary<int, ConfigurationPacketTypesOut> GetMappingOutConfiguration() => GetConfigurationListOut();
|
||||
|
||||
/// <summary>
|
||||
/// Enable forge or disable forge
|
||||
|
|
|
|||
|
|
@ -389,32 +389,27 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
|
||||
// https://wiki.vg/Protocol#Configuration
|
||||
case CurrentState.Configuration:
|
||||
switch (packetId)
|
||||
switch (packetPalette.GetIncomingConfigurationTypeById(packetId))
|
||||
{
|
||||
// Disconnect
|
||||
case 0x01:
|
||||
case ConfigurationPacketTypesIn.Disconnect:
|
||||
handler.OnConnectionLost(ChatBot.DisconnectReason.InGameKick,
|
||||
ChatParser.ParseText(dataTypes.ReadNextString(packetData)));
|
||||
return false;
|
||||
|
||||
// Finish Configuration
|
||||
case 0x02:
|
||||
case ConfigurationPacketTypesIn.FinishConfiguration:
|
||||
currentState = CurrentState.Play;
|
||||
SendPacket(0x02, new List<byte>());
|
||||
SendPacket(ConfigurationPacketTypesOut.FinishConfiguration, new List<byte>());
|
||||
break;
|
||||
|
||||
// Keep Alive
|
||||
case 0x03:
|
||||
SendPacket(0x03, packetData);
|
||||
case ConfigurationPacketTypesIn.KeepAlive:
|
||||
SendPacket(ConfigurationPacketTypesOut.KeepAlive, packetData);
|
||||
break;
|
||||
|
||||
// Ping
|
||||
case 0x04:
|
||||
SendPacket(0x04, packetData);
|
||||
case ConfigurationPacketTypesIn.Ping:
|
||||
SendPacket(ConfigurationPacketTypesOut.Pong, packetData);
|
||||
break;
|
||||
|
||||
// Registry Codec
|
||||
case 0x05:
|
||||
case ConfigurationPacketTypesIn.RegistryData:
|
||||
var registryCodec = dataTypes.ReadNextNbt(packetData);
|
||||
ChatParser.ReadChatType(registryCodec);
|
||||
|
||||
|
|
@ -423,8 +418,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
|
||||
break;
|
||||
|
||||
// Resource Pack
|
||||
case 0x06:
|
||||
case ConfigurationPacketTypesIn.ResourcePack:
|
||||
var url = dataTypes.ReadNextString(packetData);
|
||||
var hash = dataTypes.ReadNextString(packetData);
|
||||
dataTypes.ReadNextBool(packetData); // Forced
|
||||
|
|
@ -441,9 +435,9 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
|
||||
//Send back "accepted" and "successfully loaded" responses for plugins or server config making use of resource pack mandatory
|
||||
var responseHeader = Array.Empty<byte>();
|
||||
SendPacket(0x05,
|
||||
SendPacket(ConfigurationPacketTypesOut.ResourcePackResponse,
|
||||
dataTypes.ConcatBytes(responseHeader, DataTypes.GetVarInt(3))); // Accepted pack
|
||||
SendPacket(0x05,
|
||||
SendPacket(ConfigurationPacketTypesOut.ResourcePackResponse,
|
||||
dataTypes.ConcatBytes(responseHeader,
|
||||
DataTypes.GetVarInt(0))); // Successfully loaded
|
||||
break;
|
||||
|
|
@ -471,7 +465,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
|
||||
throw new System.IO.InvalidDataException(
|
||||
string.Format(Translations.exception_packet_process,
|
||||
packetPalette.GetIncommingTypeById(packetId),
|
||||
packetPalette.GetIncomingTypeById(packetId),
|
||||
packetId,
|
||||
protocolVersion,
|
||||
currentState == CurrentState.Login,
|
||||
|
|
@ -484,7 +478,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
|
||||
private bool HandlePlayPackets(int packetId, Queue<byte> packetData)
|
||||
{
|
||||
switch (packetPalette.GetIncommingTypeById(packetId))
|
||||
switch (packetPalette.GetIncomingTypeById(packetId))
|
||||
{
|
||||
case PacketTypesIn.KeepAlive: // Keep Alive (Play)
|
||||
SendPacket(PacketTypesOut.KeepAlive, packetData);
|
||||
|
|
@ -2637,6 +2631,16 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
SendPacket(packetPalette.GetOutgoingIdByType(packet), packetData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send a configuration packet to the server. Packet ID, compression, and encryption will be handled automatically.
|
||||
/// </summary>
|
||||
/// <param name="packet">packet type</param>
|
||||
/// <param name="packetData">packet Data</param>
|
||||
private void SendPacket(ConfigurationPacketTypesOut packet, IEnumerable<byte> packetData)
|
||||
{
|
||||
SendPacket(packetPalette.GetOutgoingIdByTypeConfiguration(packet), packetData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send a packet to the server. Compression and encryption will be handled automatically.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ namespace MinecraftClient.Protocol
|
|||
private void HandleInBoundPacket(int packetID, IEnumerable<byte> packetData, bool isLogin)
|
||||
{
|
||||
Queue<byte> p = new(packetData);
|
||||
PacketTypesIn pType = packetType.GetIncommingTypeById(packetID);
|
||||
PacketTypesIn pType = packetType.GetIncomingTypeById(packetID);
|
||||
// Login success. Get player UUID
|
||||
if (isLogin && packetID == 0x02)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue