diff --git a/MinecraftClient/Mapping/Dimension.cs b/MinecraftClient/Mapping/Dimension.cs
index 75642d51..72cdf844 100644
--- a/MinecraftClient/Mapping/Dimension.cs
+++ b/MinecraftClient/Mapping/Dimension.cs
@@ -22,6 +22,13 @@ namespace MinecraftClient.Mapping
///
public readonly bool piglinSafe = false;
+ ///
+ /// Possibly the light level(s) at which monsters can spawn.
+ ///
+ public readonly int monsterSpawnMinLightLevel = 0;
+ public readonly int monsterSpawnMaxLightLevel = 7;
+ public readonly int monsterSpawnBlockLightLimit = 0;
+
///
/// When false, compasses spin randomly. When true, nether portals can spawn zombified piglins.
///
@@ -132,6 +139,25 @@ namespace MinecraftClient.Mapping
if (nbt.ContainsKey("piglin_safe"))
this.piglinSafe = 1 == (byte)nbt["piglin_safe"];
+ if (nbt.ContainsKey("monster_spawn_light_level"))
+ {
+ try
+ {
+ var monsterSpawnLightLevelObj = nbt["monster_spawn_light_level"];
+ if (monsterSpawnLightLevelObj.GetType() == typeof(int))
+ this.monsterSpawnMinLightLevel = this.monsterSpawnMaxLightLevel = (int)monsterSpawnLightLevelObj;
+ else
+ {
+ var inclusive = (Dictionary)(((Dictionary)monsterSpawnLightLevelObj)["value"]);
+ this.monsterSpawnMinLightLevel = (int)inclusive["min_inclusive"];
+ this.monsterSpawnMaxLightLevel = (int)inclusive["max_inclusive"];
+ }
+
+ }
+ catch (KeyNotFoundException) { }
+ }
+ if (nbt.ContainsKey("monster_spawn_block_light_limit"))
+ this.monsterSpawnBlockLightLimit = (int)nbt["monster_spawn_block_light_limit"];
if (nbt.ContainsKey("natural"))
this.natural = 1 == (byte)nbt["natural"];
if (nbt.ContainsKey("ambient_light"))
diff --git a/MinecraftClient/Mapping/MaterialExtensions.cs b/MinecraftClient/Mapping/MaterialExtensions.cs
index 25e7a8b6..d10913c2 100644
--- a/MinecraftClient/Mapping/MaterialExtensions.cs
+++ b/MinecraftClient/Mapping/MaterialExtensions.cs
@@ -65,6 +65,9 @@ namespace MinecraftClient.Mapping
case Material.BlackShulkerBox:
case Material.BlackStainedGlass:
case Material.BlackStainedGlassPane:
+ case Material.Blackstone:
+ case Material.BlackstoneSlab:
+ case Material.BlackstoneStairs:
case Material.BlackTerracotta:
case Material.BlackWool:
case Material.BlastFurnace:
diff --git a/MinecraftClient/Mapping/World.cs b/MinecraftClient/Mapping/World.cs
index e29080dc..63ecb0c4 100644
--- a/MinecraftClient/Mapping/World.cs
+++ b/MinecraftClient/Mapping/World.cs
@@ -21,7 +21,9 @@ namespace MinecraftClient.Mapping
///
/// The dimension info of the world
///
- private static Dimension dimension = new();
+ private static Dimension curDimension = new Dimension();
+
+ private static Dictionary? dimensionList = null;
///
/// Chunk data parsing progress
@@ -52,24 +54,42 @@ namespace MinecraftClient.Mapping
}
}
+
///
- /// Set dimension type
+ /// Storage of all dimensional data - 1.19.1 and above
+ ///
+ /// Registry Codec nbt data
+ public static void StoreDimensionList(Dictionary registryCodec)
+ {
+ dimensionList = new();
+ var dimensionListNbt = (object[])(((Dictionary)registryCodec["minecraft:dimension_type"])["value"]);
+ foreach (Dictionary dimensionNbt in dimensionListNbt)
+ {
+ string dimensionName = (string)dimensionNbt["name"];
+ Dictionary element = (Dictionary)dimensionNbt["element"];
+ dimensionList.Add(dimensionName, new Dimension(dimensionName, element));
+ }
+ }
+
+
+ ///
+ /// Set current dimension - 1.16 and above
///
/// The name of the dimension type
/// The dimension type (NBT Tag Compound)
- public static void SetDimension(string name, Dictionary nbt)
+ public static void SetDimension(string name)
{
- // will change in 1.19 and above
- dimension = new Dimension(name, nbt);
+ curDimension = dimensionList![name]; // Should not fail
}
+
///
/// Get current dimension
///
/// Current dimension
public static Dimension GetDimension()
{
- return dimension;
+ return curDimension;
}
///
diff --git a/MinecraftClient/McClient.cs b/MinecraftClient/McClient.cs
index fccbe126..3d7cb684 100644
--- a/MinecraftClient/McClient.cs
+++ b/MinecraftClient/McClient.cs
@@ -15,6 +15,7 @@ using MinecraftClient.Inventory;
using MinecraftClient.Logger;
using MinecraftClient.Protocol.Keys;
using MinecraftClient.Protocol.Session;
+using MinecraftClient.Protocol.Message;
namespace MinecraftClient
{
@@ -69,7 +70,8 @@ namespace MinecraftClient
private int port;
private int protocolversion;
private string username;
- private string uuid;
+ private Guid uuid;
+ private string uuidStr;
private string sessionid;
private PlayerKeyPair? playerKeyPair;
private DateTime lastKeepAlive;
@@ -105,7 +107,8 @@ namespace MinecraftClient
public int GetServerPort() { return port; }
public string GetServerHost() { return host; }
public string GetUsername() { return username; }
- public string GetUserUUID() { return uuid; }
+ public Guid GetUserUuid() { return uuid; }
+ public string GetUserUuidStr() { return uuidStr; }
public string GetSessionID() { return sessionid; }
public Location GetCurrentLocation() { return location; }
public float GetYaw() { return playerYaw; }
@@ -151,7 +154,9 @@ namespace MinecraftClient
bool retry = false;
this.sessionid = session.ID;
- this.uuid = session.PlayerID;
+ if (!Guid.TryParse(session.PlayerID, out this.uuid))
+ this.uuid = Guid.Empty;
+ this.uuidStr = session.PlayerID;
this.username = session.PlayerName;
this.host = server_ip;
this.port = port;
@@ -2092,20 +2097,18 @@ namespace MinecraftClient
List links = new();
string messageText;
- if (message.isJson)
+ if (message.isSignedChat)
{
- if (message.isSignedChat)
- {
- if (!Settings.ShowIllegalSignedChat && !message.isSystemChat && !(bool)message.isSignatureLegal!)
- return;
- messageText = ChatParser.ParseSignedChat(message, links);
- }
- else
- messageText = ChatParser.ParseText(message.content, links);
+ if (!Settings.ShowIllegalSignedChat && !message.isSystemChat && !(bool)message.isSignatureLegal!)
+ return;
+ messageText = ChatParser.ParseSignedChat(message, links);
}
else
{
- messageText = message.content;
+ if (message.isJson)
+ messageText = ChatParser.ParseText(message.content, links);
+ else
+ messageText = message.content;
}
Log.Chat(messageText);
@@ -2242,15 +2245,16 @@ namespace MinecraftClient
if (player.Name == username)
{
// 1.19+ offline server is possible to return different uuid
- this.uuid = player.UUID.ToString().Replace("-", string.Empty);
+ this.uuid = player.Uuid;
+ this.uuidStr = player.Uuid.ToString().Replace("-", string.Empty);
}
lock (onlinePlayers)
{
- onlinePlayers[player.UUID] = player;
+ onlinePlayers[player.Uuid] = player;
}
- DispatchBotEvent(bot => bot.OnPlayerJoin(player.UUID, player.Name));
+ DispatchBotEvent(bot => bot.OnPlayerJoin(player.Uuid, player.Name));
}
///
diff --git a/MinecraftClient/Program.cs b/MinecraftClient/Program.cs
index 2860c05a..1facb07b 100644
--- a/MinecraftClient/Program.cs
+++ b/MinecraftClient/Program.cs
@@ -41,7 +41,7 @@ namespace MinecraftClient
public const string Version = MCHighestVersion;
public const string MCLowestVersion = "1.4.6";
- public const string MCHighestVersion = "1.19";
+ public const string MCHighestVersion = "1.19.2";
public static readonly string BuildInfo = null;
private static Tuple? offlinePrompt = null;
diff --git a/MinecraftClient/Protocol/Handlers/DataTypes.cs b/MinecraftClient/Protocol/Handlers/DataTypes.cs
index 4865923f..f9a75213 100644
--- a/MinecraftClient/Protocol/Handlers/DataTypes.cs
+++ b/MinecraftClient/Protocol/Handlers/DataTypes.cs
@@ -1161,9 +1161,58 @@ namespace MinecraftClient.Protocol.Handlers
///
/// Byte array
/// String representation
- public string ByteArrayToString(byte[] bytes)
+ public string ByteArrayToString(byte[]? bytes)
{
- return BitConverter.ToString(bytes).Replace("-", " ");
+ if (bytes == null)
+ return "null";
+ else
+ return BitConverter.ToString(bytes).Replace("-", " ");
+ }
+
+ ///
+ /// Write LastSeenMessageList
+ ///
+ /// Message.LastSeenMessageList
+ /// Whether the server is in online mode
+ /// Message.LastSeenMessageList Packet Data
+ public byte[] GetLastSeenMessageList(Message.LastSeenMessageList msgList, bool isOnlineMode)
+ {
+ if (!isOnlineMode)
+ return GetVarInt(0); // Message list size
+ else
+ {
+ List fields = new();
+ fields.AddRange(GetVarInt(msgList.entries.Length)); // Message list size
+ foreach (Message.LastSeenMessageList.Entry entry in msgList.entries)
+ {
+ fields.AddRange(entry.profileId.ToBigEndianBytes()); // UUID
+ fields.AddRange(GetVarInt(entry.lastSignature.Length)); // Signature length
+ fields.AddRange(entry.lastSignature); // Signature data
+ }
+ return fields.ToArray();
+ }
+ }
+
+ ///
+ /// Write LastSeenMessageList.Acknowledgment
+ ///
+ /// Acknowledgment
+ /// Whether the server is in online mode
+ /// Acknowledgment Packet Data
+ public byte[] GetAcknowledgment(Message.LastSeenMessageList.Acknowledgment ack, bool isOnlineMode)
+ {
+ List fields = new();
+ fields.AddRange(GetLastSeenMessageList(ack.lastSeen, isOnlineMode));
+ if (!isOnlineMode || ack.lastReceived == null)
+ fields.AddRange(GetBool(false)); // Has last received message
+ else
+ {
+ fields.AddRange(GetBool(true));
+ fields.AddRange(ack.lastReceived.profileId.ToBigEndianBytes()); // Has last received message
+ fields.AddRange(GetVarInt(ack.lastReceived.lastSignature.Length)); // Last received message signature length
+ fields.AddRange(ack.lastReceived.lastSignature); // Last received message signature data
+ }
+ return fields.ToArray();
}
}
}
diff --git a/MinecraftClient/Protocol/Handlers/PacketPalettes/PacketPalette119.cs b/MinecraftClient/Protocol/Handlers/PacketPalettes/PacketPalette119.cs
index 2b9ecd32..139e8dd4 100644
--- a/MinecraftClient/Protocol/Handlers/PacketPalettes/PacketPalette119.cs
+++ b/MinecraftClient/Protocol/Handlers/PacketPalettes/PacketPalette119.cs
@@ -6,165 +6,165 @@ namespace MinecraftClient.Protocol.Handlers.PacketPalettes
{
private Dictionary typeIn = new Dictionary()
{
- { 0x00, PacketTypesIn.SpawnEntity }, // Changed in 1.19 (Wiki name: Spawn Entity) - DONE
- { 0x01, PacketTypesIn.SpawnExperienceOrb }, //(Wiki name: Spawn Exeprience Orb)
- { 0x02, PacketTypesIn.SpawnPlayer },
- { 0x03, PacketTypesIn.EntityAnimation }, //(Wiki name: Entity Animation (clientbound))
- { 0x04, PacketTypesIn.Statistics }, //(Wiki name: Award Statistics)
- { 0x05, PacketTypesIn.BlockChangedAck }, //Added 1.19 (Wiki name: Acknowledge Block Change) - DONE
- { 0x06, PacketTypesIn.BlockBreakAnimation }, //(Wiki name: Set Block Destroy Stage)
- { 0x07, PacketTypesIn.BlockEntityData },
- { 0x08, PacketTypesIn.BlockAction },
- { 0x09, PacketTypesIn.BlockChange }, //(Wiki name: Block Update)
- { 0x0A, PacketTypesIn.BossBar },
- { 0x0B, PacketTypesIn.ServerDifficulty }, // (Wiki name: Change Difficulty)
- { 0x0C, PacketTypesIn.ChatPreview }, // Added 1.19
- { 0x0D, PacketTypesIn.ClearTiles },
- { 0x0E, PacketTypesIn.TabComplete }, // (Wiki name: Command Suggestions Response)
- { 0x0F, PacketTypesIn.DeclareCommands }, // (Wiki name: Commands)
- { 0x10, PacketTypesIn.CloseWindow }, // (Wiki name: Close Container (clientbound))
- { 0x11, PacketTypesIn.WindowItems }, // (Wiki name: Set Container Content)
- { 0x12, PacketTypesIn.WindowProperty }, // (Wiki name: Set Container Property)
- { 0x13, PacketTypesIn.SetSlot }, // (Wiki name: Set Container Slot)
- { 0x14, PacketTypesIn.SetCooldown },
- { 0x15, PacketTypesIn.PluginMessage }, // (Wiki name: Plugin Message (clientbound))
- { 0x16, PacketTypesIn.NamedSoundEffect }, // Changed in 1.19 (Added "Speed" field) (Wiki name: Custom Sound Effect) - DONE (No need to be implemented)
- { 0x17, PacketTypesIn.Disconnect },
- { 0x18, PacketTypesIn.EntityStatus }, // (Wiki name: Entity Event)
- { 0x19, PacketTypesIn.Explosion }, // Changed in 1.19 (Location fields are now Double instead of Float) (Wiki name: Explosion) - DONE
- { 0x1A, PacketTypesIn.UnloadChunk }, // (Wiki name: Forget Chunk)
- { 0x1B, PacketTypesIn.ChangeGameState }, // (Wiki name: Game Event)
- { 0x1C, PacketTypesIn.OpenHorseWindow }, // (Wiki name: Horse Screen Open)
- { 0x1D, PacketTypesIn.InitializeWorldBorder },
- { 0x1E, PacketTypesIn.KeepAlive },
- { 0x1F, PacketTypesIn.ChunkData },
- { 0x20, PacketTypesIn.Effect }, // (Wiki name: Level Event)
- { 0x21, PacketTypesIn.Particle }, // Changed in 1.19 ("Particle Data" field is now "Max Speed", it's the same Float data type) (Wiki name: Level Particle) - DONE (No need to be implemented)
- { 0x22, PacketTypesIn.UpdateLight }, // (Wiki name: Light Update)
- { 0x23, PacketTypesIn.JoinGame }, // Changed in 1.19 (lot's of changes) (Wiki name: Login (play)) - DONE
- { 0x24, PacketTypesIn.MapData }, // (Wiki name: Map Item Data)
- { 0x25, PacketTypesIn.TradeList }, // (Wiki name: Merchant Offers)
- { 0x26, PacketTypesIn.EntityPosition }, // (Wiki name: Move Entity Position)
- { 0x27, PacketTypesIn.EntityPositionAndRotation }, // (Wiki name: Move Entity Position and Rotation)
- { 0x28, PacketTypesIn.EntityRotation }, // (Wiki name: Move Entity Rotation)
- { 0x29, PacketTypesIn.VehicleMove }, // (Wiki name: Move Vehicle)
- { 0x2A, PacketTypesIn.OpenBook },
- { 0x2B, PacketTypesIn.OpenWindow }, // (Wiki name: Open Screen)
- { 0x2C, PacketTypesIn.OpenSignEditor },
- { 0x2D, PacketTypesIn.Ping }, // (Wiki name: Ping (play))
- { 0x2E, PacketTypesIn.CraftRecipeResponse }, // (Wiki name: Place Ghost Recipe)
- { 0x2F, PacketTypesIn.PlayerAbilities },
- { 0x30, PacketTypesIn.ChatMessage }, // Changed in 1.19 (Completely changed) (Wiki name: Player Chat Message)
- { 0x31, PacketTypesIn.EndCombatEvent }, // (Wiki name: Player Combat End)
- { 0x32, PacketTypesIn.EnterCombatEvent }, // (Wiki name: Player Combat Enter)
- { 0x33, PacketTypesIn.DeathCombatEvent }, // (Wiki name: Player Combat Kill)
- { 0x34, PacketTypesIn.PlayerInfo }, // Changed in 1.19 (Heavy changes) - DONE
- { 0x35, PacketTypesIn.FacePlayer }, // (Wiki name: Player Look At)
- { 0x36, PacketTypesIn.PlayerPositionAndLook }, // (Wiki name: Player Position)
- { 0x37, PacketTypesIn.UnlockRecipes }, // (Wiki name: Recipe)
- { 0x38, PacketTypesIn.DestroyEntities }, // (Wiki name: Remove Entites)
- { 0x39, PacketTypesIn.RemoveEntityEffect },
- { 0x3A, PacketTypesIn.ResourcePackSend }, // (Wiki name: Resource Pack)
- { 0x3B, PacketTypesIn.Respawn }, // Changed in 1.19 (Heavy changes) - DONE
- { 0x3C, PacketTypesIn.EntityHeadLook }, // (Wiki name: Rotate Head)
- { 0x3D, PacketTypesIn.MultiBlockChange }, // (Wiki name: Sections Block Update)
- { 0x3E, PacketTypesIn.SelectAdvancementTab },
- { 0x3F, PacketTypesIn.ServerData }, // Added in 1.19
- { 0x40, PacketTypesIn.ActionBar }, // (Wiki name: Set Action Bar Text)
- { 0x41, PacketTypesIn.WorldBorderCenter }, // (Wiki name: Set Border Center)
- { 0x42, PacketTypesIn.WorldBorderLerpSize },
- { 0x43, PacketTypesIn.WorldBorderSize }, // (Wiki name: Set World Border Size)
- { 0x44, PacketTypesIn.WorldBorderWarningDelay }, // (Wiki name: Set World Border Warning Delay)
- { 0x45, PacketTypesIn.WorldBorderWarningReach }, // (Wiki name: Set Border Warning Distance)
- { 0x46, PacketTypesIn.Camera }, // (Wiki name: Set Camera)
- { 0x47, PacketTypesIn.HeldItemChange }, // (Wiki name: Set Carried Item (clientbound))
- { 0x48, PacketTypesIn.UpdateViewPosition }, // (Wiki name: Set Chunk Cache Center)
- { 0x49, PacketTypesIn.UpdateViewDistance }, // (Wiki name: Set Chunk Cache Radius)
- { 0x4A, PacketTypesIn.SpawnPosition }, // (Wiki name: Set Default Spawn Position)
- { 0x4B, PacketTypesIn.SetDisplayChatPreview }, // Added in 1.19 (Wiki name: Set Display Chat Preview)
- { 0x4C, PacketTypesIn.DisplayScoreboard }, // (Wiki name: Set Display Objective)
- { 0x4D, PacketTypesIn.EntityMetadata }, // (Wiki name: Set Entity Metadata)
- { 0x4E, PacketTypesIn.AttachEntity }, // (Wiki name: Set Entity Link)
- { 0x4F, PacketTypesIn.EntityVelocity }, // (Wiki name: Set Entity Motion)
- { 0x50, PacketTypesIn.EntityEquipment }, // (Wiki name: Set Equipment)
- { 0x51, PacketTypesIn.SetExperience },
- { 0x52, PacketTypesIn.UpdateHealth }, // (Wiki name: Set Health)
- { 0x53, PacketTypesIn.ScoreboardObjective }, // (Wiki name: Set Objective)
- { 0x54, PacketTypesIn.SetPassengers },
- { 0x55, PacketTypesIn.Teams }, // (Wiki name: Set Player Team)
- { 0x56, PacketTypesIn.UpdateScore }, // (Wiki name: Set Score)
- { 0x57, PacketTypesIn.UpdateSimulationDistance }, // (Wiki name: Set Simulation Distance)
- { 0x58, PacketTypesIn.SetTitleSubTitle }, // (Wiki name: Set Subtitle Test)
- { 0x59, PacketTypesIn.TimeUpdate }, // (Wiki name: Set Time)
- { 0x5A, PacketTypesIn.SetTitleText }, // (Wiki name: Set Title)
- { 0x5B, PacketTypesIn.SetTitleTime }, // (Wiki name: Set Titles Animation)
- { 0x5C, PacketTypesIn.EntitySoundEffect }, // (Wiki name: Sound Entity)
- { 0x5D, PacketTypesIn.SoundEffect }, // Changed in 1.19 (Added "Seed" field) (Wiki name: Sound Effect) - DONE (No need to be implemented)
- { 0x5E, PacketTypesIn.StopSound },
- { 0x5F, PacketTypesIn.SystemChat }, // Added in 1.19 (Wiki name: System Chat Message)
- { 0x60, PacketTypesIn.PlayerListHeaderAndFooter }, // (Wiki name: Tab List)
- { 0x61, PacketTypesIn.NBTQueryResponse }, // (Wiki name: Tab Query)
- { 0x62, PacketTypesIn.CollectItem }, // (Wiki name: Take Item Entity)
- { 0x63, PacketTypesIn.EntityTeleport }, // (Wiki name: Teleport Entity)
- { 0x64, PacketTypesIn.Advancements }, // (Wiki name: Update Advancements)
- { 0x65, PacketTypesIn.EntityProperties }, // (Wiki name: Update Attributes)
- { 0x66, PacketTypesIn.EntityEffect }, // Changed in 1.19 (Added "Has Factor Data" and "Factor Codec" fields) (Wiki name: Entity Effect) - DONE
- { 0x67, PacketTypesIn.DeclareRecipes }, // (Wiki name: Update Recipes)
- { 0x68, PacketTypesIn.Tags }, // (Wiki name: Update Tags)
+ { 0x00, PacketTypesIn.SpawnEntity }, // Changed in 1.19 (Wiki name: Spawn Entity) - DONE
+ { 0x01, PacketTypesIn.SpawnExperienceOrb }, // (Wiki name: Spawn Exeprience Orb)
+ { 0x02, PacketTypesIn.SpawnPlayer }, //
+ { 0x03, PacketTypesIn.EntityAnimation }, // (Wiki name: Entity Animation (clientbound))
+ { 0x04, PacketTypesIn.Statistics }, // (Wiki name: Award Statistics)
+ { 0x05, PacketTypesIn.BlockChangedAck }, // Added 1.19 (Wiki name: Acknowledge Block Change) - DONE
+ { 0x06, PacketTypesIn.BlockBreakAnimation }, // (Wiki name: Set Block Destroy Stage)
+ { 0x07, PacketTypesIn.BlockEntityData }, //
+ { 0x08, PacketTypesIn.BlockAction }, //
+ { 0x09, PacketTypesIn.BlockChange }, // (Wiki name: Block Update)
+ { 0x0A, PacketTypesIn.BossBar }, //
+ { 0x0B, PacketTypesIn.ServerDifficulty }, // (Wiki name: Change Difficulty)
+ { 0x0C, PacketTypesIn.ChatPreview }, // Added 1.19
+ { 0x0D, PacketTypesIn.ClearTiles }, //
+ { 0x0E, PacketTypesIn.TabComplete }, // (Wiki name: Command Suggestions Response)
+ { 0x0F, PacketTypesIn.DeclareCommands }, // (Wiki name: Commands)
+ { 0x10, PacketTypesIn.CloseWindow }, // (Wiki name: Close Container (clientbound))
+ { 0x11, PacketTypesIn.WindowItems }, // (Wiki name: Set Container Content)
+ { 0x12, PacketTypesIn.WindowProperty }, // (Wiki name: Set Container Property)
+ { 0x13, PacketTypesIn.SetSlot }, // (Wiki name: Set Container Slot)
+ { 0x14, PacketTypesIn.SetCooldown }, //
+ { 0x15, PacketTypesIn.PluginMessage }, // (Wiki name: Plugin Message (clientbound))
+ { 0x16, PacketTypesIn.NamedSoundEffect }, // Changed in 1.19 (Added "Speed" field) (Wiki name: Custom Sound Effect) - DONE (No need to be implemented)
+ { 0x17, PacketTypesIn.Disconnect }, //
+ { 0x18, PacketTypesIn.EntityStatus }, // (Wiki name: Entity Event)
+ { 0x19, PacketTypesIn.Explosion }, // Changed in 1.19 (Location fields are now Double instead of Float) (Wiki name: Explosion) - DONE
+ { 0x1A, PacketTypesIn.UnloadChunk }, // (Wiki name: Forget Chunk)
+ { 0x1B, PacketTypesIn.ChangeGameState }, // (Wiki name: Game Event)
+ { 0x1C, PacketTypesIn.OpenHorseWindow }, // (Wiki name: Horse Screen Open)
+ { 0x1D, PacketTypesIn.InitializeWorldBorder }, //
+ { 0x1E, PacketTypesIn.KeepAlive }, //
+ { 0x1F, PacketTypesIn.ChunkData }, //
+ { 0x20, PacketTypesIn.Effect }, // (Wiki name: Level Event)
+ { 0x21, PacketTypesIn.Particle }, // Changed in 1.19 ("Particle Data" field is now "Max Speed", it's the same Float data type) (Wiki name: Level Particle) - DONE (No need to be implemented)
+ { 0x22, PacketTypesIn.UpdateLight }, // (Wiki name: Light Update)
+ { 0x23, PacketTypesIn.JoinGame }, // Changed in 1.19 (lot's of changes) (Wiki name: Login (play)) - DONE
+ { 0x24, PacketTypesIn.MapData }, // (Wiki name: Map Item Data)
+ { 0x25, PacketTypesIn.TradeList }, // (Wiki name: Merchant Offers)
+ { 0x26, PacketTypesIn.EntityPosition }, // (Wiki name: Move Entity Position)
+ { 0x27, PacketTypesIn.EntityPositionAndRotation }, // (Wiki name: Move Entity Position and Rotation)
+ { 0x28, PacketTypesIn.EntityRotation }, // (Wiki name: Move Entity Rotation)
+ { 0x29, PacketTypesIn.VehicleMove }, // (Wiki name: Move Vehicle)
+ { 0x2A, PacketTypesIn.OpenBook }, //
+ { 0x2B, PacketTypesIn.OpenWindow }, // (Wiki name: Open Screen)
+ { 0x2C, PacketTypesIn.OpenSignEditor }, //
+ { 0x2D, PacketTypesIn.Ping }, // (Wiki name: Ping (play))
+ { 0x2E, PacketTypesIn.CraftRecipeResponse }, // (Wiki name: Place Ghost Recipe)
+ { 0x2F, PacketTypesIn.PlayerAbilities }, //
+ { 0x30, PacketTypesIn.ChatMessage }, // Changed in 1.19 (Completely changed) (Wiki name: Player Chat Message)
+ { 0x31, PacketTypesIn.EndCombatEvent }, // (Wiki name: Player Combat End)
+ { 0x32, PacketTypesIn.EnterCombatEvent }, // (Wiki name: Player Combat Enter)
+ { 0x33, PacketTypesIn.DeathCombatEvent }, // (Wiki name: Player Combat Kill)
+ { 0x34, PacketTypesIn.PlayerInfo }, // Changed in 1.19 (Heavy changes) - DONE
+ { 0x35, PacketTypesIn.FacePlayer }, // (Wiki name: Player Look At)
+ { 0x36, PacketTypesIn.PlayerPositionAndLook }, // (Wiki name: Player Position)
+ { 0x37, PacketTypesIn.UnlockRecipes }, // (Wiki name: Recipe)
+ { 0x38, PacketTypesIn.DestroyEntities }, // (Wiki name: Remove Entites)
+ { 0x39, PacketTypesIn.RemoveEntityEffect }, //
+ { 0x3A, PacketTypesIn.ResourcePackSend }, // (Wiki name: Resource Pack)
+ { 0x3B, PacketTypesIn.Respawn }, // Changed in 1.19 (Heavy changes) - DONE
+ { 0x3C, PacketTypesIn.EntityHeadLook }, // (Wiki name: Rotate Head)
+ { 0x3D, PacketTypesIn.MultiBlockChange }, // (Wiki name: Sections Block Update)
+ { 0x3E, PacketTypesIn.SelectAdvancementTab }, //
+ { 0x3F, PacketTypesIn.ServerData }, // Added in 1.19
+ { 0x40, PacketTypesIn.ActionBar }, // (Wiki name: Set Action Bar Text)
+ { 0x41, PacketTypesIn.WorldBorderCenter }, // (Wiki name: Set Border Center)
+ { 0x42, PacketTypesIn.WorldBorderLerpSize }, //
+ { 0x43, PacketTypesIn.WorldBorderSize }, // (Wiki name: Set World Border Size)
+ { 0x44, PacketTypesIn.WorldBorderWarningDelay }, // (Wiki name: Set World Border Warning Delay)
+ { 0x45, PacketTypesIn.WorldBorderWarningReach }, // (Wiki name: Set Border Warning Distance)
+ { 0x46, PacketTypesIn.Camera }, // (Wiki name: Set Camera)
+ { 0x47, PacketTypesIn.HeldItemChange }, // (Wiki name: Set Carried Item (clientbound))
+ { 0x48, PacketTypesIn.UpdateViewPosition }, // (Wiki name: Set Chunk Cache Center)
+ { 0x49, PacketTypesIn.UpdateViewDistance }, // (Wiki name: Set Chunk Cache Radius)
+ { 0x4A, PacketTypesIn.SpawnPosition }, // (Wiki name: Set Default Spawn Position)
+ { 0x4B, PacketTypesIn.SetDisplayChatPreview }, // Added in 1.19 (Wiki name: Set Display Chat Preview)
+ { 0x4C, PacketTypesIn.DisplayScoreboard }, // (Wiki name: Set Display Objective)
+ { 0x4D, PacketTypesIn.EntityMetadata }, // (Wiki name: Set Entity Metadata)
+ { 0x4E, PacketTypesIn.AttachEntity }, // (Wiki name: Set Entity Link)
+ { 0x4F, PacketTypesIn.EntityVelocity }, // (Wiki name: Set Entity Motion)
+ { 0x50, PacketTypesIn.EntityEquipment }, // (Wiki name: Set Equipment)
+ { 0x51, PacketTypesIn.SetExperience }, //
+ { 0x52, PacketTypesIn.UpdateHealth }, // (Wiki name: Set Health)
+ { 0x53, PacketTypesIn.ScoreboardObjective }, // (Wiki name: Set Objective)
+ { 0x54, PacketTypesIn.SetPassengers }, //
+ { 0x55, PacketTypesIn.Teams }, // (Wiki name: Set Player Team)
+ { 0x56, PacketTypesIn.UpdateScore }, // (Wiki name: Set Score)
+ { 0x57, PacketTypesIn.UpdateSimulationDistance }, // (Wiki name: Set Simulation Distance)
+ { 0x58, PacketTypesIn.SetTitleSubTitle }, // (Wiki name: Set Subtitle Test)
+ { 0x59, PacketTypesIn.TimeUpdate }, // (Wiki name: Set Time)
+ { 0x5A, PacketTypesIn.SetTitleText }, // (Wiki name: Set Title)
+ { 0x5B, PacketTypesIn.SetTitleTime }, // (Wiki name: Set Titles Animation)
+ { 0x5C, PacketTypesIn.EntitySoundEffect }, // (Wiki name: Sound Entity)
+ { 0x5D, PacketTypesIn.SoundEffect }, // Changed in 1.19 (Added "Seed" field) (Wiki name: Sound Effect) - DONE (No need to be implemented)
+ { 0x5E, PacketTypesIn.StopSound }, //
+ { 0x5F, PacketTypesIn.SystemChat }, // Added in 1.19 (Wiki name: System Chat Message)
+ { 0x60, PacketTypesIn.PlayerListHeaderAndFooter }, // (Wiki name: Tab List)
+ { 0x61, PacketTypesIn.NBTQueryResponse }, // (Wiki name: Tab Query)
+ { 0x62, PacketTypesIn.CollectItem }, // (Wiki name: Take Item Entity)
+ { 0x63, PacketTypesIn.EntityTeleport }, // (Wiki name: Teleport Entity)
+ { 0x64, PacketTypesIn.Advancements }, // (Wiki name: Update Advancements)
+ { 0x65, PacketTypesIn.EntityProperties }, // (Wiki name: Update Attributes)
+ { 0x66, PacketTypesIn.EntityEffect }, // Changed in 1.19 (Added "Has Factor Data" and "Factor Codec" fields) (Wiki name: Entity Effect) - DONE
+ { 0x67, PacketTypesIn.DeclareRecipes }, // (Wiki name: Update Recipes)
+ { 0x68, PacketTypesIn.Tags }, // (Wiki name: Update Tags)
};
private Dictionary typeOut = new Dictionary()
{
- { 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.ChatCommand }, // Added in 1.19
- { 0x04, PacketTypesOut.ChatMessage }, // Changed in 1.19 (Completely changed) (Wiki name: Chat)
- { 0x05, PacketTypesOut.ChatPreview }, // Added in 1.19 (Wiki name: Chat Preview (serverbound))
- { 0x06, PacketTypesOut.ClientStatus }, // (Wiki name: Client Command)
- { 0x07, PacketTypesOut.ClientSettings }, // (Wiki name: Client Information)
- { 0x08, PacketTypesOut.TabComplete }, // (Wiki name: Command Suggestions Request)
- { 0x09, PacketTypesOut.ClickWindowButton }, // (Wiki name: Click Container Button)
- { 0x0A, PacketTypesOut.ClickWindow }, // (Wiki name: Click Container)
- { 0x0B, PacketTypesOut.CloseWindow }, // (Wiki name: Close Container (serverbound))
- { 0x0C, PacketTypesOut.PluginMessage }, // (Wiki name: Plugin Message (serverbound))
- { 0x0D, PacketTypesOut.EditBook },
- { 0x0E, PacketTypesOut.EntityNBTRequest }, // (Wiki name: Query Entity Tag)
- { 0x0F, PacketTypesOut.InteractEntity }, // (Wiki name: Interact)
- { 0x10, PacketTypesOut.GenerateStructure }, // (Wiki name: Jigsaw Generate)
- { 0x11, PacketTypesOut.KeepAlive },
- { 0x12, PacketTypesOut.LockDifficulty },
- { 0x13, PacketTypesOut.PlayerPosition }, // (Wiki name: Move Player Position)
- { 0x14, PacketTypesOut.PlayerPositionAndRotation }, // (Wiki name: Set Player Position and Rotation)
- { 0x15, PacketTypesOut.PlayerRotation }, // (Wiki name: Set Player Rotation)
- { 0x16, PacketTypesOut.PlayerMovement }, // (Wiki name: Set Player On Ground)
- { 0x17, PacketTypesOut.VehicleMove }, // (Wiki name: Move Vehicle (serverbound))
- { 0x18, PacketTypesOut.SteerBoat }, // (Wiki name: Paddle Boat)
- { 0x19, PacketTypesOut.PickItem },
- { 0x1A, PacketTypesOut.CraftRecipeRequest }, // (Wiki name: Place recipe)
- { 0x1B, PacketTypesOut.PlayerAbilities },
- { 0x1C, PacketTypesOut.PlayerDigging }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Player Action) - DONE
- { 0x1D, PacketTypesOut.EntityAction }, // (Wiki name: Player Command)
- { 0x1E, PacketTypesOut.SteerVehicle }, // (Wiki name: Player Input)
- { 0x1F, PacketTypesOut.Pong }, // (Wiki name: Pong (play))
- { 0x20, PacketTypesOut.SetDisplayedRecipe }, // (Wiki name: Recipe Book Change Settings)
- { 0x21, PacketTypesOut.SetRecipeBookState }, // (Wiki name: Recipe Book Seen Recipe)
- { 0x22, PacketTypesOut.NameItem }, // (Wiki name: Rename Item)
- { 0x23, PacketTypesOut.ResourcePackStatus }, // (Wiki name: Resource Pack (serverbound))
- { 0x24, PacketTypesOut.AdvancementTab }, // (Wiki name: Seen Advancements)
- { 0x25, PacketTypesOut.SelectTrade },
- { 0x26, PacketTypesOut.SetBeaconEffect }, // Changed in 1.19 (Added a "Secondary Effect Present" and "Secondary Effect" fields) (Wiki name: Set Beacon) - DONE - (No need to be implemented)
- { 0x27, PacketTypesOut.HeldItemChange }, // (Wiki name: Set Carried Item (serverbound))
- { 0x28, PacketTypesOut.UpdateCommandBlock }, // (Wiki name: Set Command Block)
- { 0x29, PacketTypesOut.UpdateCommandBlockMinecart },
- { 0x2A, PacketTypesOut.CreativeInventoryAction }, // (Wiki name: Set Creative Mode Slot)
- { 0x2B, PacketTypesOut.UpdateJigsawBlock }, // (Wiki name: Set Jigsaw Block)
- { 0x2C, PacketTypesOut.UpdateStructureBlock }, // (Wiki name: Set Structure Block)
- { 0x2D, PacketTypesOut.UpdateSign }, // (Wiki name: Sign Update)
- { 0x2E, PacketTypesOut.Animation }, // (Wiki name: Swing)
- { 0x2F, PacketTypesOut.Spectate }, // (Wiki name: Teleport To Entity)
- { 0x30, PacketTypesOut.PlayerBlockPlacement }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item On) - DONE
- { 0x31, PacketTypesOut.UseItem }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item) - DONE
+ { 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.ChatCommand }, // Added in 1.19
+ { 0x04, PacketTypesOut.ChatMessage }, // Changed in 1.19 (Completely changed) (Wiki name: Chat)
+ { 0x05, PacketTypesOut.ChatPreview }, // Added in 1.19 (Wiki name: Chat Preview (serverbound))
+ { 0x06, PacketTypesOut.ClientStatus }, // (Wiki name: Client Command)
+ { 0x07, PacketTypesOut.ClientSettings }, // (Wiki name: Client Information)
+ { 0x08, PacketTypesOut.TabComplete }, // (Wiki name: Command Suggestions Request)
+ { 0x09, PacketTypesOut.ClickWindowButton }, // (Wiki name: Click Container Button)
+ { 0x0A, PacketTypesOut.ClickWindow }, // (Wiki name: Click Container)
+ { 0x0B, PacketTypesOut.CloseWindow }, // (Wiki name: Close Container (serverbound))
+ { 0x0C, PacketTypesOut.PluginMessage }, // (Wiki name: Plugin Message (serverbound))
+ { 0x0D, PacketTypesOut.EditBook }, //
+ { 0x0E, PacketTypesOut.EntityNBTRequest }, // (Wiki name: Query Entity Tag)
+ { 0x0F, PacketTypesOut.InteractEntity }, // (Wiki name: Interact)
+ { 0x10, PacketTypesOut.GenerateStructure }, // (Wiki name: Jigsaw Generate)
+ { 0x11, PacketTypesOut.KeepAlive }, //
+ { 0x12, PacketTypesOut.LockDifficulty }, //
+ { 0x13, PacketTypesOut.PlayerPosition }, // (Wiki name: Move Player Position)
+ { 0x14, PacketTypesOut.PlayerPositionAndRotation }, // (Wiki name: Set Player Position and Rotation)
+ { 0x15, PacketTypesOut.PlayerRotation }, // (Wiki name: Set Player Rotation)
+ { 0x16, PacketTypesOut.PlayerMovement }, // (Wiki name: Set Player On Ground)
+ { 0x17, PacketTypesOut.VehicleMove }, // (Wiki name: Move Vehicle (serverbound))
+ { 0x18, PacketTypesOut.SteerBoat }, // (Wiki name: Paddle Boat)
+ { 0x19, PacketTypesOut.PickItem }, //
+ { 0x1A, PacketTypesOut.CraftRecipeRequest }, // (Wiki name: Place recipe)
+ { 0x1B, PacketTypesOut.PlayerAbilities }, //
+ { 0x1C, PacketTypesOut.PlayerDigging }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Player Action) - DONE
+ { 0x1D, PacketTypesOut.EntityAction }, // (Wiki name: Player Command)
+ { 0x1E, PacketTypesOut.SteerVehicle }, // (Wiki name: Player Input)
+ { 0x1F, PacketTypesOut.Pong }, // (Wiki name: Pong (play))
+ { 0x20, PacketTypesOut.SetDisplayedRecipe }, // (Wiki name: Recipe Book Change Settings)
+ { 0x21, PacketTypesOut.SetRecipeBookState }, // (Wiki name: Recipe Book Seen Recipe)
+ { 0x22, PacketTypesOut.NameItem }, // (Wiki name: Rename Item)
+ { 0x23, PacketTypesOut.ResourcePackStatus }, // (Wiki name: Resource Pack (serverbound))
+ { 0x24, PacketTypesOut.AdvancementTab }, // (Wiki name: Seen Advancements)
+ { 0x25, PacketTypesOut.SelectTrade }, //
+ { 0x26, PacketTypesOut.SetBeaconEffect }, // Changed in 1.19 (Added a "Secondary Effect Present" and "Secondary Effect" fields) (Wiki name: Set Beacon) - DONE - (No need to be implemented)
+ { 0x27, PacketTypesOut.HeldItemChange }, // (Wiki name: Set Carried Item (serverbound))
+ { 0x28, PacketTypesOut.UpdateCommandBlock }, // (Wiki name: Set Command Block)
+ { 0x29, PacketTypesOut.UpdateCommandBlockMinecart }, //
+ { 0x2A, PacketTypesOut.CreativeInventoryAction }, // (Wiki name: Set Creative Mode Slot)
+ { 0x2B, PacketTypesOut.UpdateJigsawBlock }, // (Wiki name: Set Jigsaw Block)
+ { 0x2C, PacketTypesOut.UpdateStructureBlock }, // (Wiki name: Set Structure Block)
+ { 0x2D, PacketTypesOut.UpdateSign }, // (Wiki name: Sign Update)
+ { 0x2E, PacketTypesOut.Animation }, // (Wiki name: Swing)
+ { 0x2F, PacketTypesOut.Spectate }, // (Wiki name: Teleport To Entity)
+ { 0x30, PacketTypesOut.PlayerBlockPlacement }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item On) - DONE
+ { 0x31, PacketTypesOut.UseItem }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item) - DONE
};
protected override Dictionary GetListIn()
diff --git a/MinecraftClient/Protocol/Handlers/PacketPalettes/PacketPalette1192.cs b/MinecraftClient/Protocol/Handlers/PacketPalettes/PacketPalette1192.cs
new file mode 100644
index 00000000..053bb300
--- /dev/null
+++ b/MinecraftClient/Protocol/Handlers/PacketPalettes/PacketPalette1192.cs
@@ -0,0 +1,184 @@
+using System.Collections.Generic;
+
+namespace MinecraftClient.Protocol.Handlers.PacketPalettes
+{
+ public class PacketPalette1192 : PacketTypePalette
+ {
+ private Dictionary typeIn = new Dictionary()
+ {
+ { 0x00, PacketTypesIn.SpawnEntity }, // Changed in 1.19 (Wiki name: Spawn Entity) - DONE
+ { 0x01, PacketTypesIn.SpawnExperienceOrb }, // (Wiki name: Spawn Exeprience Orb)
+ { 0x02, PacketTypesIn.SpawnPlayer }, //
+ { 0x03, PacketTypesIn.EntityAnimation }, // (Wiki name: Entity Animation (clientbound))
+ { 0x04, PacketTypesIn.Statistics }, // (Wiki name: Award Statistics)
+ { 0x05, PacketTypesIn.BlockChangedAck }, // Added 1.19 (Wiki name: Acknowledge Block Change) - DONE
+ { 0x06, PacketTypesIn.BlockBreakAnimation }, // (Wiki name: Set Block Destroy Stage)
+ { 0x07, PacketTypesIn.BlockEntityData }, //
+ { 0x08, PacketTypesIn.BlockAction }, //
+ { 0x09, PacketTypesIn.BlockChange }, // (Wiki name: Block Update)
+ { 0x0A, PacketTypesIn.BossBar }, //
+ { 0x0B, PacketTypesIn.ServerDifficulty }, // (Wiki name: Change Difficulty)
+ { 0x0C, PacketTypesIn.ChatPreview }, // Added 1.19
+ { 0x0D, PacketTypesIn.ClearTiles }, //
+ { 0x0E, PacketTypesIn.TabComplete }, // (Wiki name: Command Suggestions Response)
+ { 0x0F, PacketTypesIn.DeclareCommands }, // (Wiki name: Commands)
+ { 0x10, PacketTypesIn.CloseWindow }, // (Wiki name: Close Container (clientbound))
+ { 0x11, PacketTypesIn.WindowItems }, // (Wiki name: Set Container Content)
+ { 0x12, PacketTypesIn.WindowProperty }, // (Wiki name: Set Container Property)
+ { 0x13, PacketTypesIn.SetSlot }, // (Wiki name: Set Container Slot)
+ { 0x14, PacketTypesIn.SetCooldown }, //
+ { 0x15, PacketTypesIn.ChatSuggestions }, // Added 1.19.1
+ { 0x16, PacketTypesIn.PluginMessage }, // (Wiki name: Plugin Message (clientbound))
+ { 0x17, PacketTypesIn.NamedSoundEffect }, // Changed in 1.19 (Added "Speed" field) (Wiki name: Custom Sound Effect) - DONE (No need to be implemented)
+ { 0x18, PacketTypesIn.HideMessage }, // Added 1.19.1
+ { 0x19, PacketTypesIn.Disconnect }, //
+ { 0x1A, PacketTypesIn.EntityStatus }, // (Wiki name: Entity Event)
+ { 0x1B, PacketTypesIn.Explosion }, // Changed in 1.19 (Location fields are now Double instead of Float) (Wiki name: Explosion) - DONE
+ { 0x1C, PacketTypesIn.UnloadChunk }, // (Wiki name: Forget Chunk)
+ { 0x1D, PacketTypesIn.ChangeGameState }, // (Wiki name: Game Event)
+ { 0x1E, PacketTypesIn.OpenHorseWindow }, // (Wiki name: Horse Screen Open)
+ { 0x1F, PacketTypesIn.InitializeWorldBorder }, //
+ { 0x20, PacketTypesIn.KeepAlive }, //
+ { 0x21, PacketTypesIn.ChunkData }, //
+ { 0x22, PacketTypesIn.Effect }, // (Wiki name: Level Event)
+ { 0x23, PacketTypesIn.Particle }, // Changed in 1.19 ("Particle Data" field is now "Max Speed", it's the same Float data type) (Wiki name: Level Particle) - DONE (No need to be implemented)
+ { 0x24, PacketTypesIn.UpdateLight }, // (Wiki name: Light Update)
+ { 0x25, PacketTypesIn.JoinGame }, // Changed in 1.19 (lot's of changes) (Wiki name: Login (play)) - DONE
+ { 0x26, PacketTypesIn.MapData }, // (Wiki name: Map Item Data)
+ { 0x27, PacketTypesIn.TradeList }, // (Wiki name: Merchant Offers)
+ { 0x28, PacketTypesIn.EntityPosition }, // (Wiki name: Move Entity Position)
+ { 0x29, PacketTypesIn.EntityPositionAndRotation }, // (Wiki name: Move Entity Position and Rotation)
+ { 0x2A, PacketTypesIn.EntityRotation }, // (Wiki name: Move Entity Rotation)
+ { 0x2B, PacketTypesIn.VehicleMove }, // (Wiki name: Move Vehicle)
+ { 0x2C, PacketTypesIn.OpenBook }, //
+ { 0x2D, PacketTypesIn.OpenWindow }, // (Wiki name: Open Screen)
+ { 0x2E, PacketTypesIn.OpenSignEditor }, //
+ { 0x2F, PacketTypesIn.Ping }, // (Wiki name: Ping (play))
+ { 0x30, PacketTypesIn.CraftRecipeResponse }, // (Wiki name: Place Ghost Recipe)
+ { 0x31, PacketTypesIn.PlayerAbilities }, //
+ { 0x32, PacketTypesIn.MessageHeader }, // Added 1.19.1
+ { 0x33, PacketTypesIn.ChatMessage }, // Changed in 1.19 (Completely changed) (Wiki name: Player Chat Message)
+ { 0x34, PacketTypesIn.EndCombatEvent }, // (Wiki name: Player Combat End)
+ { 0x35, PacketTypesIn.EnterCombatEvent }, // (Wiki name: Player Combat Enter)
+ { 0x36, PacketTypesIn.DeathCombatEvent }, // (Wiki name: Player Combat Kill)
+ { 0x37, PacketTypesIn.PlayerInfo }, // Changed in 1.19 (Heavy changes) - DONE
+ { 0x38, PacketTypesIn.FacePlayer }, // (Wiki name: Player Look At)
+ { 0x39, PacketTypesIn.PlayerPositionAndLook }, // (Wiki name: Player Position)
+ { 0x3A, PacketTypesIn.UnlockRecipes }, // (Wiki name: Recipe)
+ { 0x3B, PacketTypesIn.DestroyEntities }, // (Wiki name: Remove Entites)
+ { 0x3C, PacketTypesIn.RemoveEntityEffect }, //
+ { 0x3D, PacketTypesIn.ResourcePackSend }, // (Wiki name: Resource Pack)
+ { 0x3E, PacketTypesIn.Respawn }, // Changed in 1.19 (Heavy changes) - DONE
+ { 0x3F, PacketTypesIn.EntityHeadLook }, // (Wiki name: Rotate Head)
+ { 0x40, PacketTypesIn.MultiBlockChange }, // (Wiki name: Sections Block Update)
+ { 0x41, PacketTypesIn.SelectAdvancementTab }, //
+ { 0x42, PacketTypesIn.ServerData }, // Added in 1.19
+ { 0x43, PacketTypesIn.ActionBar }, // (Wiki name: Set Action Bar Text)
+ { 0x44, PacketTypesIn.WorldBorderCenter }, // (Wiki name: Set Border Center)
+ { 0x45, PacketTypesIn.WorldBorderLerpSize }, //
+ { 0x46, PacketTypesIn.WorldBorderSize }, // (Wiki name: Set World Border Size)
+ { 0x47, PacketTypesIn.WorldBorderWarningDelay }, // (Wiki name: Set World Border Warning Delay)
+ { 0x48, PacketTypesIn.WorldBorderWarningReach }, // (Wiki name: Set Border Warning Distance)
+ { 0x49, PacketTypesIn.Camera }, // (Wiki name: Set Camera)
+ { 0x4A, PacketTypesIn.HeldItemChange }, // (Wiki name: Set Carried Item (clientbound))
+ { 0x4B, PacketTypesIn.UpdateViewPosition }, // (Wiki name: Set Chunk Cache Center)
+ { 0x4C, PacketTypesIn.UpdateViewDistance }, // (Wiki name: Set Chunk Cache Radius)
+ { 0x4D, PacketTypesIn.SpawnPosition }, // (Wiki name: Set Default Spawn Position)
+ { 0x4E, PacketTypesIn.SetDisplayChatPreview }, // Added in 1.19 (Wiki name: Set Display Chat Preview)
+ { 0x4F, PacketTypesIn.DisplayScoreboard }, // (Wiki name: Set Display Objective)
+ { 0x50, PacketTypesIn.EntityMetadata }, // (Wiki name: Set Entity Metadata)
+ { 0x51, PacketTypesIn.AttachEntity }, // (Wiki name: Set Entity Link)
+ { 0x52, PacketTypesIn.EntityVelocity }, // (Wiki name: Set Entity Motion)
+ { 0x53, PacketTypesIn.EntityEquipment }, // (Wiki name: Set Equipment)
+ { 0x54, PacketTypesIn.SetExperience }, //
+ { 0x55, PacketTypesIn.UpdateHealth }, // (Wiki name: Set Health)
+ { 0x56, PacketTypesIn.ScoreboardObjective }, // (Wiki name: Set Objective)
+ { 0x57, PacketTypesIn.SetPassengers }, //
+ { 0x58, PacketTypesIn.Teams }, // (Wiki name: Set Player Team)
+ { 0x59, PacketTypesIn.UpdateScore }, // (Wiki name: Set Score)
+ { 0x5A, PacketTypesIn.UpdateSimulationDistance }, // (Wiki name: Set Simulation Distance)
+ { 0x5B, PacketTypesIn.SetTitleSubTitle }, // (Wiki name: Set Subtitle Test)
+ { 0x5C, PacketTypesIn.TimeUpdate }, // (Wiki name: Set Time)
+ { 0x5D, PacketTypesIn.SetTitleText }, // (Wiki name: Set Title)
+ { 0x5E, PacketTypesIn.SetTitleTime }, // (Wiki name: Set Titles Animation)
+ { 0x5F, PacketTypesIn.EntitySoundEffect }, // (Wiki name: Sound Entity)
+ { 0x60, PacketTypesIn.SoundEffect }, // Changed in 1.19 (Added "Seed" field) (Wiki name: Sound Effect) - DONE (No need to be implemented)
+ { 0x61, PacketTypesIn.StopSound }, //
+ { 0x62, PacketTypesIn.SystemChat }, // Added in 1.19 (Wiki name: System Chat Message)
+ { 0x63, PacketTypesIn.PlayerListHeaderAndFooter }, // (Wiki name: Tab List)
+ { 0x64, PacketTypesIn.NBTQueryResponse }, // (Wiki name: Tab Query)
+ { 0x65, PacketTypesIn.CollectItem }, // (Wiki name: Take Item Entity)
+ { 0x66, PacketTypesIn.EntityTeleport }, // (Wiki name: Teleport Entity)
+ { 0x67, PacketTypesIn.Advancements }, // (Wiki name: Update Advancements)
+ { 0x68, PacketTypesIn.EntityProperties }, // (Wiki name: Update Attributes)
+ { 0x69, PacketTypesIn.EntityEffect }, // Changed in 1.19 (Added "Has Factor Data" and "Factor Codec" fields) (Wiki name: Entity Effect) - DONE
+ { 0x6A, PacketTypesIn.DeclareRecipes }, // (Wiki name: Update Recipes)
+ { 0x6B, PacketTypesIn.Tags }, // (Wiki name: Update Tags)
+ };
+
+ private Dictionary typeOut = new Dictionary()
+ {
+ { 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 }, // Added in 1.19.1
+ { 0x04, PacketTypesOut.ChatCommand }, // Added in 1.19
+ { 0x05, PacketTypesOut.ChatMessage }, // Changed in 1.19 (Completely changed) (Wiki name: Chat)
+ { 0x06, PacketTypesOut.ChatPreview }, // Added in 1.19 (Wiki name: Chat Preview (serverbound))
+ { 0x07, PacketTypesOut.ClientStatus }, // (Wiki name: Client Command)
+ { 0x08, PacketTypesOut.ClientSettings }, // (Wiki name: Client Information)
+ { 0x09, PacketTypesOut.TabComplete }, // (Wiki name: Command Suggestions Request)
+ { 0x0A, PacketTypesOut.ClickWindowButton }, // (Wiki name: Click Container Button)
+ { 0x0B, PacketTypesOut.ClickWindow }, // (Wiki name: Click Container)
+ { 0x0C, PacketTypesOut.CloseWindow }, // (Wiki name: Close Container (serverbound))
+ { 0x0D, PacketTypesOut.PluginMessage }, // (Wiki name: Plugin Message (serverbound))
+ { 0x0E, PacketTypesOut.EditBook }, //
+ { 0x0F, PacketTypesOut.EntityNBTRequest }, // (Wiki name: Query Entity Tag)
+ { 0x10, PacketTypesOut.InteractEntity }, // (Wiki name: Interact)
+ { 0x11, PacketTypesOut.GenerateStructure }, // (Wiki name: Jigsaw Generate)
+ { 0x12, PacketTypesOut.KeepAlive }, //
+ { 0x13, PacketTypesOut.LockDifficulty }, //
+ { 0x14, PacketTypesOut.PlayerPosition }, // (Wiki name: Move Player Position)
+ { 0x15, PacketTypesOut.PlayerPositionAndRotation }, // (Wiki name: Set Player Position and Rotation)
+ { 0x16, PacketTypesOut.PlayerRotation }, // (Wiki name: Set Player Rotation)
+ { 0x17, PacketTypesOut.PlayerMovement }, // (Wiki name: Set Player On Ground)
+ { 0x18, PacketTypesOut.VehicleMove }, // (Wiki name: Move Vehicle (serverbound))
+ { 0x19, PacketTypesOut.SteerBoat }, // (Wiki name: Paddle Boat)
+ { 0x1A, PacketTypesOut.PickItem }, //
+ { 0x1B, PacketTypesOut.CraftRecipeRequest }, // (Wiki name: Place recipe)
+ { 0x1C, PacketTypesOut.PlayerAbilities }, //
+ { 0x1D, PacketTypesOut.PlayerDigging }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Player Action) - DONE
+ { 0x1E, PacketTypesOut.EntityAction }, // (Wiki name: Player Command)
+ { 0x1F, PacketTypesOut.SteerVehicle }, // (Wiki name: Player Input)
+ { 0x20, PacketTypesOut.Pong }, // (Wiki name: Pong (play))
+ { 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)
+ { 0x24, PacketTypesOut.ResourcePackStatus }, // (Wiki name: Resource Pack (serverbound))
+ { 0x25, PacketTypesOut.AdvancementTab }, // (Wiki name: Seen Advancements)
+ { 0x26, PacketTypesOut.SelectTrade }, //
+ { 0x27, PacketTypesOut.SetBeaconEffect }, // Changed in 1.19 (Added a "Secondary Effect Present" and "Secondary Effect" fields) (Wiki name: Set Beacon) - DONE - (No need to be implemented)
+ { 0x28, PacketTypesOut.HeldItemChange }, // (Wiki name: Set Carried Item (serverbound))
+ { 0x29, PacketTypesOut.UpdateCommandBlock }, // (Wiki name: Set Command Block)
+ { 0x2A, PacketTypesOut.UpdateCommandBlockMinecart }, //
+ { 0x2B, PacketTypesOut.CreativeInventoryAction }, // (Wiki name: Set Creative Mode Slot)
+ { 0x2C, PacketTypesOut.UpdateJigsawBlock }, // (Wiki name: Set Jigsaw Block)
+ { 0x2D, PacketTypesOut.UpdateStructureBlock }, // (Wiki name: Set Structure Block)
+ { 0x2E, PacketTypesOut.UpdateSign }, // (Wiki name: Sign Update)
+ { 0x2F, PacketTypesOut.Animation }, // (Wiki name: Swing)
+ { 0x30, PacketTypesOut.Spectate }, // (Wiki name: Teleport To Entity)
+ { 0x31, PacketTypesOut.PlayerBlockPlacement }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item On) - DONE
+ { 0x32, PacketTypesOut.UseItem }, // Changed in 1.19 (Added a "Sequence" field) (Wiki name: Use Item) - DONE
+ };
+
+ protected override Dictionary GetListIn()
+ {
+ return typeIn;
+ }
+
+ protected override Dictionary GetListOut()
+ {
+ return typeOut;
+ }
+ }
+}
\ No newline at end of file
diff --git a/MinecraftClient/Protocol/Handlers/PacketType18Handler.cs b/MinecraftClient/Protocol/Handlers/PacketType18Handler.cs
index 9218ada8..4dff45a9 100644
--- a/MinecraftClient/Protocol/Handlers/PacketType18Handler.cs
+++ b/MinecraftClient/Protocol/Handlers/PacketType18Handler.cs
@@ -51,8 +51,9 @@ namespace MinecraftClient.Protocol.Handlers
public PacketTypePalette GetTypeHandler(int protocol)
{
PacketTypePalette p;
- if (protocol > Protocol18Handler.MC_1_19_Version)
+ if (protocol > Protocol18Handler.MC_1_19_2_Version)
throw new NotImplementedException(Translations.Get("exception.palette.packet"));
+
if (protocol <= Protocol18Handler.MC_1_8_Version)
p = new PacketPalette17();
else if (protocol <= Protocol18Handler.MC_1_11_2_Version)
@@ -75,8 +76,10 @@ namespace MinecraftClient.Protocol.Handlers
p = new PacketPalette117();
else if (protocol <= Protocol18Handler.MC_1_18_2_Version)
p = new PacketPalette118();
- else
+ else if (protocol <= Protocol18Handler.MC_1_19_Version)
p = new PacketPalette119();
+ else
+ p = new PacketPalette1192();
p.SetForgeEnabled(this.forgeEnabled);
return p;
diff --git a/MinecraftClient/Protocol/Handlers/PacketTypesIn.cs b/MinecraftClient/Protocol/Handlers/PacketTypesIn.cs
index 9001e0eb..e9177243 100644
--- a/MinecraftClient/Protocol/Handlers/PacketTypesIn.cs
+++ b/MinecraftClient/Protocol/Handlers/PacketTypesIn.cs
@@ -10,128 +10,129 @@ namespace MinecraftClient.Protocol.Handlers
///
public enum PacketTypesIn
{
- SpawnEntity,
- SpawnExperienceOrb,
- SpawnWeatherEntity,
- SpawnLivingEntity,
- SpawnPainting,
- SpawnPlayer,
- EntityAnimation,
- Statistics,
- AcknowledgePlayerDigging,
- BlockBreakAnimation,
- BlockEntityData,
- BlockAction,
- BlockChange,
- BossBar,
- ServerDifficulty,
- ChatMessage,
- MultiBlockChange,
- TabComplete,
- DeclareCommands,
- WindowConfirmation,
- CloseWindow,
- WindowItems,
- WindowProperty,
- SetSlot,
- SetCooldown,
- PluginMessage,
- NamedSoundEffect,
- Disconnect,
- EntityStatus,
- Explosion,
- UnloadChunk,
- ChangeGameState,
- OpenHorseWindow,
- KeepAlive,
- ChunkData,
- Effect,
- Particle,
- UpdateLight,
- JoinGame,
- MapData,
- TradeList,
- EntityPosition,
- EntityPositionAndRotation,
- EntityRotation,
- EntityMovement,
- VehicleMove,
- OpenBook,
- OpenWindow,
- OpenSignEditor,
- CraftRecipeResponse,
- PlayerAbilities,
- CombatEvent,
- PlayerInfo,
- FacePlayer,
- PlayerPositionAndLook,
- UnlockRecipes,
- DestroyEntities,
- RemoveEntityEffect,
- ResourcePackSend,
- Respawn,
- EntityHeadLook,
- SelectAdvancementTab,
- WorldBorder,
- Camera,
- HeldItemChange,
- UpdateViewPosition,
- UpdateViewDistance,
- DisplayScoreboard,
- EntityMetadata,
- AttachEntity,
- EntityVelocity,
- EntityEquipment,
- SetExperience,
- UpdateHealth,
- ScoreboardObjective,
- SetPassengers,
- Teams,
- UpdateScore,
- SpawnPosition,
- TimeUpdate,
- Title,
- EntitySoundEffect,
- SoundEffect,
- StopSound,
- PlayerListHeaderAndFooter,
- NBTQueryResponse,
- CollectItem,
- EntityTeleport,
- Advancements,
- EntityProperties,
- EntityEffect,
- DeclareRecipes,
- SetTitleTime,
- SetTitleText,
- SetTitleSubTitle,
- WorldBorderWarningReach,
- WorldBorderWarningDelay,
- WorldBorderSize,
- WorldBorderLerpSize,
- WorldBorderCenter,
- ActionBar,
- Tags,
- DeathCombatEvent,
- EnterCombatEvent,
- EndCombatEvent,
- Ping,
- InitializeWorldBorder,
- SkulkVibrationSignal,
- ClearTiles,
- UseBed, // For 1.13.2 or below
- MapChunkBulk, // For 1.8 or below
- SetCompression, // For 1.8 or below
- UpdateSign, // For 1.8 or below
- UpdateEntityNBT, // For 1.8 or below
- Unknown, // For old version packet that have been removed and not used by mcc
- UpdateSimulationDistance,
-
- // 1.19 Additions
- BlockChangedAck,
- ChatPreview,
- ServerData,
- SetDisplayChatPreview,
- SystemChat
+ AcknowledgePlayerDigging, //
+ ActionBar, //
+ Advancements, //
+ AttachEntity, //
+ BlockAction, //
+ BlockBreakAnimation, //
+ BlockChange, //
+ BlockChangedAck, // Added in 1.19
+ BlockEntityData, //
+ BossBar, //
+ Camera, //
+ ChangeGameState, //
+ ChatMessage, //
+ ChatPreview, // Added in 1.19
+ ChatSuggestions, // Added in 1.19.1 (1.19.2)
+ ChunkData, //
+ ClearTiles, //
+ CloseWindow, //
+ CollectItem, //
+ CombatEvent, //
+ CraftRecipeResponse, //
+ DeathCombatEvent, //
+ DeclareCommands, //
+ DeclareRecipes, //
+ DestroyEntities, //
+ Disconnect, //
+ DisplayScoreboard, //
+ Effect, //
+ EndCombatEvent, //
+ EnterCombatEvent, //
+ EntityAnimation, //
+ EntityEffect, //
+ EntityEquipment, //
+ EntityHeadLook, //
+ EntityMetadata, //
+ EntityMovement, //
+ EntityPosition, //
+ EntityPositionAndRotation, //
+ EntityProperties, //
+ EntityRotation, //
+ EntitySoundEffect, //
+ EntityStatus, //
+ EntityTeleport, //
+ EntityVelocity, //
+ Explosion, //
+ FacePlayer, //
+ HeldItemChange, //
+ HideMessage, // Added in 1.19.1 (1.19.2)
+ InitializeWorldBorder, //
+ JoinGame, //
+ KeepAlive, //
+ MapChunkBulk, // For 1.8 or below
+ MapData, //
+ MessageHeader, // Added in 1.19.1 (1.19.2)
+ MultiBlockChange, //
+ NamedSoundEffect, //
+ NBTQueryResponse, //
+ OpenBook, //
+ OpenHorseWindow, //
+ OpenSignEditor, //
+ OpenWindow, //
+ Particle, //
+ Ping, //
+ PlayerAbilities, //
+ PlayerInfo, //
+ PlayerListHeaderAndFooter, //
+ PlayerPositionAndLook, //
+ PluginMessage, //
+ RemoveEntityEffect, //
+ ResourcePackSend, //
+ Respawn, //
+ ScoreboardObjective, //
+ SelectAdvancementTab, //
+ ServerData, // Added in 1.19
+ ServerDifficulty, //
+ SetCompression, // For 1.8 or below
+ SetCooldown, //
+ SetDisplayChatPreview, // Added in 1.19
+ SetExperience, //
+ SetPassengers, //
+ SetSlot, //
+ SetTitleSubTitle, //
+ SetTitleText, //
+ SetTitleTime, //
+ SkulkVibrationSignal, //
+ SoundEffect, //
+ SpawnEntity, //
+ SpawnExperienceOrb, //
+ SpawnLivingEntity, //
+ SpawnPainting, //
+ SpawnPlayer, //
+ SpawnPosition, //
+ SpawnWeatherEntity, //
+ Statistics, //
+ StopSound, //
+ SystemChat, // Added in 1.19
+ TabComplete, //
+ Tags, //
+ Teams, //
+ TimeUpdate, //
+ Title, //
+ TradeList, //
+ Unknown, // For old version packet that have been removed and not used by mcc
+ UnloadChunk, //
+ UnlockRecipes, //
+ UpdateEntityNBT, // For 1.8 or below
+ UpdateHealth, //
+ UpdateLight, //
+ UpdateScore, //
+ UpdateSign, // For 1.8 or below
+ UpdateSimulationDistance, //
+ UpdateViewDistance, //
+ UpdateViewPosition, //
+ UseBed, // For 1.13.2 or below
+ VehicleMove, //
+ WindowConfirmation, //
+ WindowItems, //
+ WindowProperty, //
+ WorldBorder, //
+ WorldBorderCenter, //
+ WorldBorderLerpSize, //
+ WorldBorderSize, //
+ WorldBorderWarningDelay, //
+ WorldBorderWarningReach, //
}
}
diff --git a/MinecraftClient/Protocol/Handlers/PacketTypesOut.cs b/MinecraftClient/Protocol/Handlers/PacketTypesOut.cs
index e65c6d90..a2e8eecc 100644
--- a/MinecraftClient/Protocol/Handlers/PacketTypesOut.cs
+++ b/MinecraftClient/Protocol/Handlers/PacketTypesOut.cs
@@ -10,62 +10,61 @@ namespace MinecraftClient.Protocol.Handlers
///
public enum PacketTypesOut
{
- TeleportConfirm,
- QueryBlockNBT,
- SetDifficulty,
- ChatMessage,
- ClientStatus,
- ClientSettings,
- TabComplete,
- WindowConfirmation,
- ClickWindowButton,
- ClickWindow,
- CloseWindow,
- PluginMessage,
- EditBook,
- EntityNBTRequest,
- InteractEntity,
- KeepAlive,
- LockDifficulty,
- PlayerPosition,
- PlayerPositionAndRotation,
- PlayerRotation,
- PlayerMovement,
- VehicleMove,
- SteerBoat,
- PickItem,
- CraftRecipeRequest,
- PlayerAbilities,
- PlayerDigging,
- EntityAction,
- SteerVehicle,
- RecipeBookData,
- NameItem,
- ResourcePackStatus,
- AdvancementTab,
- SelectTrade,
- SetBeaconEffect,
- HeldItemChange,
- UpdateCommandBlock,
- UpdateCommandBlockMinecart,
- CreativeInventoryAction,
- UpdateJigsawBlock,
- UpdateStructureBlock,
- UpdateSign,
- Animation,
- Spectate,
- PlayerBlockPlacement,
- UseItem,
- Pong,
- PrepareCraftingGrid, // For 1.12 - 1.12.1 only
- EnchantItem, // For 1.13.2 or below
- GenerateStructure, // Added in 1.16
- SetDisplayedRecipe, // Added in 1.16.2
- SetRecipeBookState, // Added in 1.16.2
- Unknown, // For old version packet that have been removed and not used by mcc
-
- // Added in 1.19
- ChatCommand,
- ChatPreview,
+ AdvancementTab, //
+ Animation, //
+ ChatCommand, // Added in 1.19
+ ChatMessage, //
+ ChatPreview, // Added in 1.19
+ ClickWindow, //
+ ClickWindowButton, //
+ ClientSettings, //
+ ClientStatus, //
+ CloseWindow, //
+ CraftRecipeRequest, //
+ CreativeInventoryAction, //
+ EditBook, //
+ EnchantItem, // For 1.13.2 or below
+ EntityAction, //
+ EntityNBTRequest, //
+ GenerateStructure, // Added in 1.16
+ HeldItemChange, //
+ InteractEntity, //
+ KeepAlive, //
+ LockDifficulty, //
+ MessageAcknowledgment, // Added in 1.19.1 (1.19.2)
+ NameItem, //
+ PickItem, //
+ PlayerAbilities, //
+ PlayerBlockPlacement, //
+ PlayerDigging, //
+ PlayerMovement, //
+ PlayerPosition, //
+ PlayerPositionAndRotation, //
+ PlayerRotation, //
+ PluginMessage, //
+ Pong, //
+ PrepareCraftingGrid, // For 1.12 - 1.12.1 only
+ QueryBlockNBT, //
+ RecipeBookData, //
+ ResourcePackStatus, //
+ SelectTrade, //
+ SetBeaconEffect, //
+ SetDifficulty, //
+ SetDisplayedRecipe, // Added in 1.16.2
+ SetRecipeBookState, // Added in 1.16.2
+ Spectate, //
+ SteerBoat, //
+ SteerVehicle, //
+ TabComplete, //
+ TeleportConfirm, //
+ Unknown, // For old version packet that have been removed and not used by mcc
+ UpdateCommandBlock, //
+ UpdateCommandBlockMinecart, //
+ UpdateJigsawBlock, //
+ UpdateSign, //
+ UpdateStructureBlock, //
+ UseItem, //
+ VehicleMove, //
+ WindowConfirmation, //
}
}
diff --git a/MinecraftClient/Protocol/Handlers/Protocol16.cs b/MinecraftClient/Protocol/Handlers/Protocol16.cs
index 1d8dd59c..602b1b8d 100644
--- a/MinecraftClient/Protocol/Handlers/Protocol16.cs
+++ b/MinecraftClient/Protocol/Handlers/Protocol16.cs
@@ -11,6 +11,7 @@ using MinecraftClient.Mapping;
using MinecraftClient.Inventory;
using MinecraftClient.Protocol.Keys;
using MinecraftClient.Protocol.Session;
+using MinecraftClient.Protocol.Message;
namespace MinecraftClient.Protocol.Handlers
{
@@ -581,7 +582,7 @@ namespace MinecraftClient.Protocol.Handlers
public bool Login(PlayerKeyPair? playerKeyPair, SessionToken session)
{
- if (Handshake(handler.GetUserUUID(), handler.GetUsername(), handler.GetSessionID(), handler.GetServerHost(), handler.GetServerPort(), session))
+ if (Handshake(handler.GetUserUuidStr(), handler.GetUsername(), handler.GetSessionID(), handler.GetServerHost(), handler.GetServerPort()))
{
Send(new byte[] { 0xCD, 0 });
try
diff --git a/MinecraftClient/Protocol/Handlers/Protocol18.cs b/MinecraftClient/Protocol/Handlers/Protocol18.cs
index 57c49211..6b0b39af 100644
--- a/MinecraftClient/Protocol/Handlers/Protocol18.cs
+++ b/MinecraftClient/Protocol/Handlers/Protocol18.cs
@@ -21,6 +21,7 @@ using MinecraftClient.Protocol.Keys;
using System.Text.RegularExpressions;
using MinecraftClient.Protocol.Session;
using System.Collections.Concurrent;
+using MinecraftClient.Protocol.Message;
namespace MinecraftClient.Protocol.Handlers
{
@@ -57,6 +58,7 @@ namespace MinecraftClient.Protocol.Handlers
internal const int MC_1_18_1_Version = 757;
internal const int MC_1_18_2_Version = 758;
internal const int MC_1_19_Version = 759;
+ internal const int MC_1_19_2_Version = 760;
private int compression_treshold = 0;
private bool autocomplete_received = false;
@@ -66,8 +68,13 @@ namespace MinecraftClient.Protocol.Handlers
private bool login_phase = true;
private int protocolVersion;
private int currentDimension;
+ private bool isOnlineMode = false;
private readonly BlockingCollection>> packetQueue = new();
+ private int pendingAcknowledgments = 0;
+ private LastSeenMessagesCollector lastSeenMessagesCollector = new(5);
+ private LastSeenMessageList.Entry? lastReceivedMessage = null;
+
Protocol18Forge pForge;
Protocol18Terrain pTerrain;
IMinecraftComHandler handler;
@@ -95,86 +102,105 @@ namespace MinecraftClient.Protocol.Handlers
this.log = handler.GetLogger();
this.randomGen = RandomNumberGenerator.Create();
- if (handler.GetTerrainEnabled() && protocolVersion > MC_1_18_2_Version)
+ if (handler.GetTerrainEnabled() && protocolVersion > MC_1_19_2_Version)
{
log.Error(Translations.Get("extra.terrainandmovement_disabled"));
handler.SetTerrainEnabled(false);
}
- if (handler.GetInventoryEnabled() && (protocolVersion < MC_1_10_Version || protocolVersion > MC_1_18_2_Version))
+ if (handler.GetInventoryEnabled() && (protocolVersion < MC_1_10_Version || protocolVersion > MC_1_19_2_Version))
{
log.Error(Translations.Get("extra.inventory_disabled"));
handler.SetInventoryEnabled(false);
}
-
- if (handler.GetEntityHandlingEnabled() && (protocolVersion < MC_1_10_Version || protocolVersion > MC_1_18_2_Version))
+ if (handler.GetEntityHandlingEnabled() && (protocolVersion < MC_1_10_Version || protocolVersion > MC_1_19_2_Version))
{
log.Error(Translations.Get("extra.entity_disabled"));
handler.SetEntityHandlingEnabled(false);
}
// Block palette
- if (protocolVersion >= MC_1_13_Version)
- {
- if (protocolVersion > MC_1_19_Version && handler.GetTerrainEnabled())
- throw new NotImplementedException(Translations.Get("exception.palette.block"));
+ if (protocolVersion > MC_1_19_2_Version && handler.GetTerrainEnabled())
+ throw new NotImplementedException(Translations.Get("exception.palette.block"));
- if (protocolVersion == MC_1_19_Version)
- Block.Palette = new Palette119();
- else if (protocolVersion >= MC_1_17_Version)
- Block.Palette = new Palette117();
- else if (protocolVersion >= MC_1_16_Version)
- Block.Palette = new Palette116();
- else if (protocolVersion >= MC_1_15_Version)
- Block.Palette = new Palette115();
- else if (protocolVersion >= MC_1_14_Version)
- Block.Palette = new Palette114();
- else Block.Palette = new Palette113();
-
- }
- else Block.Palette = new Palette112();
+ if (protocolVersion >= MC_1_19_Version)
+ Block.Palette = new Palette119();
+ else if (protocolVersion >= MC_1_17_Version)
+ Block.Palette = new Palette117();
+ else if (protocolVersion >= MC_1_16_Version)
+ Block.Palette = new Palette116();
+ else if (protocolVersion >= MC_1_15_Version)
+ Block.Palette = new Palette115();
+ else if (protocolVersion >= MC_1_14_Version)
+ Block.Palette = new Palette114();
+ else if (protocolVersion >= MC_1_13_Version)
+ Block.Palette = new Palette113();
+ else
+ Block.Palette = new Palette112();
// Entity palette
- if (protocolVersion >= MC_1_13_Version)
- {
- if (protocolVersion > MC_1_19_Version && handler.GetEntityHandlingEnabled())
- throw new NotImplementedException(Translations.Get("exception.palette.entity"));
+ if (protocolVersion > MC_1_19_2_Version && handler.GetEntityHandlingEnabled())
+ throw new NotImplementedException(Translations.Get("exception.palette.entity"));
- if (protocolVersion == MC_1_19_Version)
- entityPalette = new EntityPalette119();
- else if (protocolVersion >= MC_1_17_Version)
- entityPalette = new EntityPalette117();
- else if (protocolVersion >= MC_1_16_2_Version)
- entityPalette = new EntityPalette1162();
- else if (protocolVersion >= MC_1_16_Version)
- entityPalette = new EntityPalette1161();
- else if (protocolVersion >= MC_1_15_Version)
- entityPalette = new EntityPalette115();
- else if (protocolVersion >= MC_1_14_Version)
- entityPalette = new EntityPalette114();
- else
- entityPalette = new EntityPalette113();
- }
- else entityPalette = new EntityPalette112();
+ if (protocolVersion >= MC_1_19_Version)
+ entityPalette = new EntityPalette119();
+ else if (protocolVersion >= MC_1_17_Version)
+ entityPalette = new EntityPalette117();
+ else if (protocolVersion >= MC_1_16_2_Version)
+ entityPalette = new EntityPalette1162();
+ else if (protocolVersion >= MC_1_16_Version)
+ entityPalette = new EntityPalette1161();
+ else if (protocolVersion >= MC_1_15_Version)
+ entityPalette = new EntityPalette115();
+ else if (protocolVersion >= MC_1_14_Version)
+ entityPalette = new EntityPalette114();
+ else if (protocolVersion >= MC_1_13_Version)
+ entityPalette = new EntityPalette113();
+ else
+ entityPalette = new EntityPalette112();
// Item palette
- if (protocolVersion >= MC_1_16_2_Version)
- {
- if (protocolVersion > MC_1_19_Version && handler.GetInventoryEnabled())
- throw new NotImplementedException(Translations.Get("exception.palette.item"));
+ if (protocolVersion > MC_1_19_2_Version && handler.GetInventoryEnabled())
+ throw new NotImplementedException(Translations.Get("exception.palette.item"));
- if (protocolVersion == MC_1_19_Version)
- itemPalette = new ItemPalette119();
- else if (protocolVersion >= MC_1_18_1_Version)
- itemPalette = new ItemPalette118();
- else if (protocolVersion >= MC_1_17_Version)
- itemPalette = new ItemPalette117();
- else if (protocolVersion >= MC_1_16_2_Version)
- if (protocolVersion >= MC_1_16_2_Version)
- itemPalette = new ItemPalette1162();
- else itemPalette = new ItemPalette1161();
- }
- else itemPalette = new ItemPalette115();
+ if (protocolVersion >= MC_1_19_Version)
+ itemPalette = new ItemPalette119();
+ else if (protocolVersion >= MC_1_18_1_Version)
+ itemPalette = new ItemPalette118();
+ else if (protocolVersion >= MC_1_17_Version)
+ itemPalette = new ItemPalette117();
+ else if (protocolVersion >= MC_1_16_2_Version)
+ itemPalette = new ItemPalette1162();
+ else if (protocolVersion >= MC_1_16_1_Version)
+ itemPalette = new ItemPalette1161();
+ else
+ itemPalette = new ItemPalette115();
+
+ // MessageType
+ // You can find it in https://wiki.vg/Protocol#Player_Chat_Message or /net/minecraft/network/message/MessageType.java
+ if (this.protocolVersion >= MC_1_19_2_Version)
+ ChatParser.ChatId2Type = new()
+ {
+ { 0, ChatParser.MessageType.CHAT },
+ { 1, ChatParser.MessageType.SAY_COMMAND },
+ { 2, ChatParser.MessageType.MSG_COMMAND_INCOMING },
+ { 3, ChatParser.MessageType.MSG_COMMAND_OUTGOING },
+ { 4, ChatParser.MessageType.TEAM_MSG_COMMAND_INCOMING },
+ { 5, ChatParser.MessageType.TEAM_MSG_COMMAND_OUTGOING },
+ { 6, ChatParser.MessageType.EMOTE_COMMAND },
+ };
+ else if (this.protocolVersion == MC_1_19_Version)
+ ChatParser.ChatId2Type = new()
+ {
+ { 0, ChatParser.MessageType.CHAT },
+ { 1, ChatParser.MessageType.RAW_MSG },
+ { 2, ChatParser.MessageType.RAW_MSG },
+ { 3, ChatParser.MessageType.SAY_COMMAND },
+ { 4, ChatParser.MessageType.MSG_COMMAND_INCOMING },
+ { 5, ChatParser.MessageType.TEAM_MSG_COMMAND_INCOMING },
+ { 6, ChatParser.MessageType.EMOTE_COMMAND },
+ { 7, ChatParser.MessageType.RAW_MSG },
+ };
}
///
@@ -344,26 +370,22 @@ namespace MinecraftClient.Protocol.Handlers
int worldCount = dataTypes.ReadNextVarInt(packetData); // Dimension Count (World Count) - 1.16 and above
for (int i = 0; i < worldCount; i++)
dataTypes.ReadNextString(packetData); // Dimension Names (World Names) - 1.16 and above
- dataTypes.ReadNextNbt(packetData); // Registry Codec (Dimension Codec) - 1.16 and above
+ var registryCodec = dataTypes.ReadNextNbt(packetData); // Registry Codec (Dimension Codec) - 1.16 and above
+ World.StoreDimensionList(registryCodec);
}
- string? currentDimensionName = null;
- Dictionary? currentDimensionType = null;
-
// Current dimension
- // NBT Tag Compound: 1.16.2 and above
+ // String: 1.19 and above
+ // NBT Tag Compound: [1.16.2 to 1.18.2]
// String identifier: 1.16 and 1.16.1
// varInt: [1.9.1 to 1.15.2]
// byte: below 1.9.1
if (protocolVersion >= MC_1_16_Version)
{
if (protocolVersion >= MC_1_19_Version)
- {
- dataTypes.ReadNextString(packetData); // Dimension Type: Identifier
- currentDimensionType = new Dictionary();
- }
+ dataTypes.ReadNextString(packetData); // Dimension Type: Identifier
else if (protocolVersion >= MC_1_16_2_Version)
- currentDimensionType = dataTypes.ReadNextNbt(packetData); // Dimension Type: NBT Tag Compound
+ dataTypes.ReadNextNbt(packetData); // Dimension Type: NBT Tag Compound
else
dataTypes.ReadNextString(packetData);
this.currentDimension = 0;
@@ -377,10 +399,10 @@ namespace MinecraftClient.Protocol.Handlers
dataTypes.ReadNextByte(packetData); // Difficulty - 1.13 and below
if (protocolVersion >= MC_1_16_Version)
- currentDimensionName = dataTypes.ReadNextString(packetData); // Dimension Name (World Name) - 1.16 and above
-
- if (protocolVersion >= MC_1_16_2_Version)
- World.SetDimension(currentDimensionName, currentDimensionType);
+ {
+ string dimensionName = dataTypes.ReadNextString(packetData); // Dimension Name (World Name) - 1.16 and above
+ World.SetDimension(dimensionName);
+ }
if (protocolVersion >= MC_1_15_Version)
dataTypes.ReadNextLong(packetData); // Hashed world seed - 1.15 and above
@@ -438,7 +460,7 @@ namespace MinecraftClient.Protocol.Handlers
handler.OnTextReceived(new(message, true, messageType, senderUUID));
}
- else // 1.19+
+ else if (protocolVersion == MC_1_19_Version) // 1.19
{
string signedChat = dataTypes.ReadNextString(packetData);
@@ -462,38 +484,134 @@ namespace MinecraftClient.Protocol.Handlers
byte[] messageSignature = dataTypes.ReadNextByteArray(packetData);
- PlayerInfo? player = handler.GetPlayerInfo(senderUUID);
- bool verifyResult = player == null ? false : player.VerifyMessage(signedChat, senderUUID, timestamp, salt, ref messageSignature);
+ bool verifyResult;
+ if (!isOnlineMode)
+ verifyResult = false;
+ else if (senderUUID == handler.GetUserUuid())
+ verifyResult = true;
+ else
+ {
+ PlayerInfo? player = handler.GetPlayerInfo(senderUUID);
+ verifyResult = player == null ? false : player.VerifyMessage(signedChat, timestamp, salt, ref messageSignature);
+ }
- handler.OnTextReceived(new(signedChat, true, messageType, senderUUID, unsignedChatContent, senderDisplayName, senderTeamName, timestamp, verifyResult));
+ ChatMessage chat = new(signedChat, true, messageType, senderUUID, unsignedChatContent, senderDisplayName, senderTeamName, timestamp, messageSignature, verifyResult);
+ handler.OnTextReceived(chat);
+ }
+ else // 1.19.1 +
+ {
+ byte[]? precedingSignature = dataTypes.ReadNextBool(packetData) ? dataTypes.ReadNextByteArray(packetData) : null;
+ Guid senderUUID = dataTypes.ReadNextUUID(packetData);
+ byte[] headerSignature = dataTypes.ReadNextByteArray(packetData);
+
+ string signedChat = dataTypes.ReadNextString(packetData);
+ string? decorated = dataTypes.ReadNextBool(packetData) ? dataTypes.ReadNextString(packetData) : null;
+
+ long timestamp = dataTypes.ReadNextLong(packetData);
+ long salt = dataTypes.ReadNextLong(packetData);
+
+ int lastSeenMessageListLen = dataTypes.ReadNextVarInt(packetData);
+ LastSeenMessageList.Entry[] lastSeenMessageList = new LastSeenMessageList.Entry[lastSeenMessageListLen];
+ for (int i = 0; i < lastSeenMessageListLen; ++i)
+ {
+ Guid user = dataTypes.ReadNextUUID(packetData);
+ byte[] lastSignature = dataTypes.ReadNextByteArray(packetData);
+ lastSeenMessageList[i] = new(user, lastSignature);
+ }
+ LastSeenMessageList lastSeenMessages = new(lastSeenMessageList);
+
+ string? unsignedChatContent = dataTypes.ReadNextBool(packetData) ? dataTypes.ReadNextString(packetData) : null;
+
+ int filterEnum = dataTypes.ReadNextVarInt(packetData);
+ if (filterEnum == 2) // PARTIALLY_FILTERED
+ dataTypes.ReadNextULongArray(packetData);
+
+ int chatTypeId = dataTypes.ReadNextVarInt(packetData);
+ string chatName = dataTypes.ReadNextString(packetData);
+ string? targetName = dataTypes.ReadNextBool(packetData) ? dataTypes.ReadNextString(packetData) : null;
+
+ Dictionary chatInfo = Json.ParseJson(chatName).Properties;
+ string senderDisplayName = (chatInfo.ContainsKey("insertion") ? chatInfo["insertion"] : chatInfo["text"]).StringValue;
+ string? senderTeamName = null;
+ ChatParser.MessageType messageTypeEnum = ChatParser.ChatId2Type!.GetValueOrDefault(chatTypeId, ChatParser.MessageType.CHAT);
+ if (targetName != null &&
+ (messageTypeEnum == ChatParser.MessageType.TEAM_MSG_COMMAND_INCOMING || messageTypeEnum == ChatParser.MessageType.TEAM_MSG_COMMAND_OUTGOING))
+ senderTeamName = Json.ParseJson(targetName).Properties["with"].DataArray[0].Properties["text"].StringValue;
+
+ bool verifyResult;
+ if (!isOnlineMode)
+ verifyResult = false;
+ else if (senderUUID == handler.GetUserUuid())
+ verifyResult = true;
+ else
+ {
+ PlayerInfo? player = handler.GetPlayerInfo(senderUUID);
+ if (player == null || !player.IsMessageChainLegal())
+ verifyResult = false;
+ else
+ {
+ bool lastVerifyResult = player.IsMessageChainLegal();
+ verifyResult = player.VerifyMessage(signedChat, timestamp, salt, ref headerSignature, ref precedingSignature, lastSeenMessages);
+ if (lastVerifyResult && !verifyResult)
+ log.Warn(Translations.Get("chat.message_chain_broken", senderDisplayName));
+ }
+ }
+
+ ChatMessage chat = new(signedChat, false, chatTypeId, senderUUID, unsignedChatContent, senderDisplayName, senderTeamName, timestamp, headerSignature, verifyResult);
+ if (isOnlineMode && !chat.lacksSender())
+ this.acknowledge(chat);
+ handler.OnTextReceived(chat);
+ }
+ break;
+ case PacketTypesIn.MessageHeader:
+ if (protocolVersion >= MC_1_19_2_Version)
+ {
+ byte[]? precedingSignature = dataTypes.ReadNextBool(packetData) ? dataTypes.ReadNextByteArray(packetData) : null;
+ Guid senderUUID = dataTypes.ReadNextUUID(packetData);
+ byte[] headerSignature = dataTypes.ReadNextByteArray(packetData);
+ byte[] bodyDigest = dataTypes.ReadNextByteArray(packetData);
+
+ bool verifyResult;
+ if (!isOnlineMode)
+ verifyResult = false;
+ else if (senderUUID == handler.GetUserUuid())
+ verifyResult = true;
+ else
+ {
+ PlayerInfo? player = handler.GetPlayerInfo(senderUUID);
+ if (player == null || !player.IsMessageChainLegal())
+ verifyResult = false;
+ else
+ {
+ bool lastVerifyResult = player.IsMessageChainLegal();
+ verifyResult = player.VerifyMessageHead(ref precedingSignature, ref headerSignature, ref bodyDigest);
+ if (lastVerifyResult && !verifyResult)
+ log.Warn("Player " + player.DisplayName + "'s message chain is broken!");
+ }
+ }
}
break;
case PacketTypesIn.Respawn:
- string? dimensionNameInRespawn = null;
- Dictionary dimensionTypeInRespawn = null;
if (protocolVersion >= MC_1_16_Version)
{
if (protocolVersion >= MC_1_19_Version)
- {
- dataTypes.ReadNextString(packetData); // Dimension Type: Identifier
- dimensionTypeInRespawn = new Dictionary();
- }
+ dataTypes.ReadNextString(packetData); // Dimension Type: Identifier
else if (protocolVersion >= MC_1_16_2_Version)
- dimensionTypeInRespawn = dataTypes.ReadNextNbt(packetData); // Dimension Type: NBT Tag Compound
+ dataTypes.ReadNextNbt(packetData); // Dimension Type: NBT Tag Compound
else
dataTypes.ReadNextString(packetData);
this.currentDimension = 0;
}
else
- {
- // 1.15 and below
+ { // 1.15 and below
this.currentDimension = dataTypes.ReadNextInt(packetData);
}
- if (protocolVersion >= MC_1_16_Version)
- dimensionNameInRespawn = dataTypes.ReadNextString(packetData); // Dimension Name (World Name) - 1.16 and above
- if (protocolVersion >= MC_1_16_2_Version)
- World.SetDimension(dimensionNameInRespawn, dimensionTypeInRespawn);
+ if (protocolVersion >= MC_1_16_Version)
+ {
+ string dimensionName = dataTypes.ReadNextString(packetData); // Dimension Name (World Name) - 1.16 and above
+ World.SetDimension(dimensionName);
+ }
if (protocolVersion < MC_1_14_Version)
dataTypes.ReadNextByte(packetData); // Difficulty - 1.13 and below
@@ -515,8 +633,8 @@ namespace MinecraftClient.Protocol.Handlers
bool hasDeathLocation = dataTypes.ReadNextBool(packetData); // Has death location
if (hasDeathLocation)
{
- dataTypes.ReadNextString(packetData); // Death dimension name: Identifier
- dataTypes.ReadNextLocation(packetData); // Death location
+ dataTypes.ReadNextString(packetData); // Death dimension name: Identifier
+ dataTypes.ReadNextLocation(packetData); // Death location
}
}
handler.OnRespawn();
@@ -842,6 +960,8 @@ namespace MinecraftClient.Protocol.Handlers
//handler.OnTextReceived(message, true);
}
+ break;
+ case PacketTypesIn.ChatSuggestions:
break;
case PacketTypesIn.MapChunkBulk:
if (protocolVersion < MC_1_9_Version && handler.GetTerrainEnabled())
@@ -921,14 +1041,20 @@ namespace MinecraftClient.Protocol.Handlers
string name = dataTypes.ReadNextString(packetData); // Player name
int propNum = dataTypes.ReadNextVarInt(packetData); // Number of properties in the following array
- Tuple[]? property = null; // Property: Tuple[]? properties = useProperty ?
+ new Tuple[propNum] : null;
for (int p = 0; p < propNum; p++)
{
- string key = dataTypes.ReadNextString(packetData); // Name
- string val = dataTypes.ReadNextString(packetData); // Value
-
+ string propertyName = dataTypes.ReadNextString(packetData); // Name: String (32767)
+ string val = dataTypes.ReadNextString(packetData); // Value: String (32767)
+ string? propertySignature = null;
if (dataTypes.ReadNextBool(packetData)) // Is Signed
- dataTypes.ReadNextString(packetData); // Signature
+ propertySignature = dataTypes.ReadNextString(packetData); // Signature: String (32767)
+ if (useProperty)
+ properties![p] = new(propertyName, val, propertySignature);
}
int gameMode = dataTypes.ReadNextVarInt(packetData); // Gamemode
@@ -959,7 +1085,7 @@ namespace MinecraftClient.Protocol.Handlers
}
}
- handler.OnPlayerJoin(new PlayerInfo(uuid, name, property, gameMode, ping, displayName, keyExpiration, publicKey, signature));
+ handler.OnPlayerJoin(new PlayerInfo(uuid, name, properties, gameMode, ping, displayName, keyExpiration, publicKey, signature));
break;
case 0x01: //Update gamemode
handler.OnGamemodeUpdate(uuid, dataTypes.ReadNextVarInt(packetData));
@@ -1315,13 +1441,16 @@ namespace MinecraftClient.Protocol.Handlers
int EntityID = dataTypes.ReadNextVarInt(packetData);
Dictionary metadata = dataTypes.ReadNextMetadata(packetData, itemPalette);
- // See https://wiki.vg/Entity_metadata#Living_Entity
- int healthField = 7; // From 1.10 to 1.13.2
- if (protocolVersion >= MC_1_14_Version)
- healthField = 8; // 1.14 and above
- if (protocolVersion >= MC_1_17_Version)
- healthField = 9; // 1.17 and above
- if (protocolVersion > MC_1_19_Version)
+ int healthField; // See https://wiki.vg/Entity_metadata#Living_Entity
+ if (protocolVersion > MC_1_19_2_Version)
+ throw new NotImplementedException(Translations.Get("exception.palette.healthfield"));
+ else if (protocolVersion >= MC_1_17_Version) // 1.17 and above
+ healthField = 9;
+ else if (protocolVersion >= MC_1_14_Version) // 1.14 and above
+ healthField = 8;
+ else if (protocolVersion >= MC_1_10_Version) // 1.10 and above
+ healthField = 7;
+ else
throw new NotImplementedException(Translations.Get("exception.palette.healthfield"));
if (metadata.ContainsKey(healthField) && metadata[healthField] != null && metadata[healthField].GetType() == typeof(float))
@@ -1573,7 +1702,21 @@ namespace MinecraftClient.Protocol.Handlers
fullLoginPacket.AddRange(dataTypes.GetBool(true)); // Has Sig Data
fullLoginPacket.AddRange(dataTypes.GetLong(playerKeyPair.GetExpirationMilliseconds())); // Expiration time
fullLoginPacket.AddRange(dataTypes.GetArray(playerKeyPair.PublicKey.Key)); // Public key received from Microsoft API
- fullLoginPacket.AddRange(dataTypes.GetArray(playerKeyPair.PublicKey.Signature)); // Public key signature received from Microsoft API
+ if (protocolVersion >= MC_1_19_2_Version)
+ fullLoginPacket.AddRange(dataTypes.GetArray(playerKeyPair.PublicKey.SignatureV2!)); // Public key signature received from Microsoft API
+ else
+ fullLoginPacket.AddRange(dataTypes.GetArray(playerKeyPair.PublicKey.Signature!)); // Public key signature received from Microsoft API
+ }
+ }
+ if (protocolVersion >= MC_1_19_2_Version)
+ {
+ Guid uuid = handler.GetUserUuid();
+ if (uuid == Guid.Empty)
+ fullLoginPacket.AddRange(dataTypes.GetBool(false)); // Has UUID
+ else
+ {
+ fullLoginPacket.AddRange(dataTypes.GetBool(true)); // Has UUID
+ fullLoginPacket.AddRange(dataTypes.GetUUID(uuid)); // UUID
}
}
SendPacket(0x00, fullLoginPacket);
@@ -1588,10 +1731,11 @@ namespace MinecraftClient.Protocol.Handlers
}
else if (packetID == 0x01) //Encryption request
{
+ this.isOnlineMode = true;
string serverID = dataTypes.ReadNextString(packetData);
byte[] serverPublicKey = dataTypes.ReadNextByteArray(packetData);
byte[] token = dataTypes.ReadNextByteArray(packetData);
- return StartEncryption(handler.GetUserUUID(), handler.GetSessionID(), token, serverID, serverPublicKey, playerKeyPair, session);
+ return StartEncryption(handler.GetUserUuidStr(), handler.GetSessionID(), token, serverID, serverPublicKey, playerKeyPair, session);
}
else if (packetID == 0x02) //Login successful
{
@@ -1890,41 +2034,87 @@ namespace MinecraftClient.Protocol.Handlers
return protocolVersion;
}
+ ///
+ /// Send MessageAcknowledgment packet
+ ///
+ /// Message acknowledgment
+ /// True if properly sent
+ public bool SendMessageAcknowledgment(LastSeenMessageList.Acknowledgment acknowledgment)
+ {
+ try
+ {
+ byte[] fields = dataTypes.GetAcknowledgment(acknowledgment, isOnlineMode);
+
+ SendPacket(PacketTypesOut.MessageAcknowledgment, fields);
+
+ return true;
+ }
+ catch (SocketException) { return false; }
+ catch (System.IO.IOException) { return false; }
+ catch (ObjectDisposedException) { return false; }
+ }
+
+ public LastSeenMessageList.Acknowledgment consumeAcknowledgment()
+ {
+ this.pendingAcknowledgments = 0;
+ return new LastSeenMessageList.Acknowledgment(this.lastSeenMessagesCollector.GetLastSeenMessages(), this.lastReceivedMessage);
+ }
+
+ public void acknowledge(ChatMessage message)
+ {
+ LastSeenMessageList.Entry? entry = message.toLastSeenMessageEntry();
+
+ if (entry != null)
+ {
+ lastSeenMessagesCollector.Add(entry);
+ lastReceivedMessage = null;
+
+ if (pendingAcknowledgments++ > 64)
+ SendMessageAcknowledgment(this.consumeAcknowledgment());
+ }
+ }
///
/// The signable argument names and their values from command
/// Signature will used in Vanilla's say, me, msg, teammsg, ban, banip, and kick commands.
/// https://gist.github.com/kennytv/ed783dd244ca0321bbd882c347892874#signed-command-arguments
+ /// You can find all the commands that need to be signed by searching for "MessageArgumentType.getSignedMessage" in the source code.
+ /// Don't forget to handle the redirected commands, e.g. /tm, /w
+ ///
///
/// Command
/// List< Argument Name, Argument Value >
- private List> collectCommandArguments(string command)
+ private List>? CollectCommandArguments(string command)
{
- List> needSigned = new();
+ if (!isOnlineMode || !Settings.SignMessageInCommand)
+ return null;
- if (!Settings.SignMessageInCommand)
- return needSigned;
+ List> needSigned = new();
string[] argStage1 = command.Split(' ', 2, StringSplitOptions.None);
if (argStage1.Length == 2)
{
/* /me
/say
- /teammsg */
+ /teammsg
+ /tm */
if (argStage1[0] == "me")
needSigned.Add(new("action", argStage1[1]));
- else if (argStage1[0] == "say" || argStage1[0] == "teammsg")
+ else if (argStage1[0] == "say" || argStage1[0] == "teammsg" || argStage1[0] == "tm")
needSigned.Add(new("message", argStage1[1]));
- else if (argStage1[0] == "msg" || argStage1[0] == "ban" || argStage1[0] == "ban-ip" || argStage1[0] == "kick")
+ else if (argStage1[0] == "msg" || argStage1[0] == "tell" || argStage1[0] == "w" ||
+ argStage1[0] == "ban" || argStage1[0] == "ban-ip" || argStage1[0] == "kick")
{
/* /msg
+ /tell
+ /w
/ban []
/ban-ip []
/kick [] */
string[] argStage2 = argStage1[1].Split(' ', 2, StringSplitOptions.None);
if (argStage2.Length == 2)
{
- if (argStage1[0] == "msg")
+ if (argStage1[0] == "msg" || argStage1[0] == "tell" || argStage1[0] == "w")
needSigned.Add(new("message", argStage2[1]));
else if (argStage1[0] == "ban" || argStage1[0] == "ban-ip" || argStage1[0] == "kick")
needSigned.Add(new("reason", argStage2[1]));
@@ -1936,7 +2126,7 @@ namespace MinecraftClient.Protocol.Handlers
}
///
- /// Send a chat command to the server
+ /// Send a chat command to the server - 1.19 and above
///
/// Command
/// PlayerKeyPair
@@ -1953,6 +2143,9 @@ namespace MinecraftClient.Protocol.Handlers
try
{
+ LastSeenMessageList.Acknowledgment? acknowledgment =
+ (protocolVersion >= MC_1_19_2_Version) ? this.consumeAcknowledgment() : null;
+
List fields = new();
// Command: String
@@ -1962,24 +2155,25 @@ namespace MinecraftClient.Protocol.Handlers
DateTimeOffset timeNow = DateTimeOffset.UtcNow;
fields.AddRange(dataTypes.GetLong(timeNow.ToUnixTimeMilliseconds()));
- List> needSigned = collectCommandArguments(command); // List< Argument Name, Argument Value >
- // foreach (var msg in needSigned)
- // log.Info("<" + msg.Item1 + ">: " + msg.Item2);
- if (needSigned.Count == 0 || playerKeyPair == null || !Settings.SignMessageInCommand)
+ List>? needSigned =
+ playerKeyPair != null ? CollectCommandArguments(command) : null; // List< Argument Name, Argument Value >
+ if (needSigned == null || needSigned!.Count == 0)
{
fields.AddRange(dataTypes.GetLong(0)); // Salt: Long
fields.AddRange(dataTypes.GetVarInt(0)); // Signature Length: VarInt
}
else
{
- string uuid = handler.GetUserUUID()!;
+ Guid uuid = handler.GetUserUuid();
byte[] salt = GenerateSalt();
fields.AddRange(salt); // Salt: Long
fields.AddRange(dataTypes.GetVarInt(needSigned.Count)); // Signature Length: VarInt
foreach (var argument in needSigned)
{
fields.AddRange(dataTypes.GetString(argument.Item1)); // Argument name: String
- byte[] sign = playerKeyPair.PrivateKey.SignMessage(argument.Item2, uuid, timeNow, ref salt);
+ byte[] sign = (protocolVersion >= MC_1_19_2_Version) ?
+ playerKeyPair!.PrivateKey.SignMessage(argument.Item2, uuid, timeNow, ref salt, acknowledgment!.lastSeen) :
+ playerKeyPair!.PrivateKey.SignMessage(argument.Item2, uuid, timeNow, ref salt);
fields.AddRange(dataTypes.GetVarInt(sign.Length)); // Signature length: VarInt
fields.AddRange(sign); // Signature: Byte Array
}
@@ -1988,6 +2182,12 @@ namespace MinecraftClient.Protocol.Handlers
// Signed Preview: Boolean
fields.AddRange(dataTypes.GetBool(false));
+ if (protocolVersion >= MC_1_19_2_Version)
+ {
+ // Message Acknowledgment
+ fields.AddRange(dataTypes.GetAcknowledgment(acknowledgment!, isOnlineMode));
+ }
+
SendPacket(PacketTypesOut.ChatCommand, fields);
return true;
}
@@ -2020,11 +2220,14 @@ namespace MinecraftClient.Protocol.Handlers
if (protocolVersion >= MC_1_19_Version)
{
+ LastSeenMessageList.Acknowledgment? acknowledgment =
+ (protocolVersion >= MC_1_19_2_Version) ? this.consumeAcknowledgment() : null;
+
// Timestamp: Instant(Long)
DateTimeOffset timeNow = DateTimeOffset.UtcNow;
fields.AddRange(dataTypes.GetLong(timeNow.ToUnixTimeMilliseconds()));
- if (playerKeyPair == null || !Settings.SignChat)
+ if (!isOnlineMode || playerKeyPair == null || !Settings.SignChat)
{
fields.AddRange(dataTypes.GetLong(0)); // Salt: Long
fields.AddRange(dataTypes.GetVarInt(0)); // Signature Length: VarInt
@@ -2036,14 +2239,22 @@ namespace MinecraftClient.Protocol.Handlers
fields.AddRange(salt);
// Signature Length & Signature: (VarInt) and Byte Array
- string uuid = handler.GetUserUUID()!;
- byte[] sign = playerKeyPair.PrivateKey.SignMessage(message, uuid, timeNow, ref salt);
+ Guid uuid = handler.GetUserUuid();
+ byte[] sign = (protocolVersion >= MC_1_19_2_Version) ?
+ playerKeyPair.PrivateKey.SignMessage(message, uuid, timeNow, ref salt, acknowledgment!.lastSeen) :
+ playerKeyPair.PrivateKey.SignMessage(message, uuid, timeNow, ref salt);
fields.AddRange(dataTypes.GetVarInt(sign.Length));
fields.AddRange(sign);
}
// Signed Preview: Boolean
fields.AddRange(dataTypes.GetBool(false));
+
+ if (protocolVersion >= MC_1_19_2_Version)
+ {
+ // Message Acknowledgment
+ fields.AddRange(dataTypes.GetAcknowledgment(acknowledgment!, isOnlineMode));
+ }
}
SendPacket(PacketTypesOut.ChatMessage, fields);
return true;
@@ -2124,9 +2335,12 @@ namespace MinecraftClient.Protocol.Handlers
List fields = new List();
fields.AddRange(dataTypes.GetString(language));
fields.Add(viewDistance);
- fields.AddRange(protocolVersion >= MC_1_9_Version
- ? dataTypes.GetVarInt(chatMode)
- : new byte[] { chatMode });
+
+ if (protocolVersion >= MC_1_9_Version)
+ fields.AddRange(dataTypes.GetVarInt(chatMode));
+ else
+ fields.AddRange(new byte[] { chatMode });
+
fields.Add(chatColors ? (byte)1 : (byte)0);
if (protocolVersion < MC_1_8_Version)
{
diff --git a/MinecraftClient/Protocol/IMinecraftComHandler.cs b/MinecraftClient/Protocol/IMinecraftComHandler.cs
index 96b4e4b7..4e0de511 100644
--- a/MinecraftClient/Protocol/IMinecraftComHandler.cs
+++ b/MinecraftClient/Protocol/IMinecraftComHandler.cs
@@ -5,6 +5,7 @@ using System.Text;
using MinecraftClient.Mapping;
using MinecraftClient.Inventory;
using MinecraftClient.Logger;
+using MinecraftClient.Protocol.Message;
namespace MinecraftClient.Protocol
{
@@ -22,7 +23,8 @@ namespace MinecraftClient.Protocol
int GetServerPort();
string GetServerHost();
string GetUsername();
- string GetUserUUID();
+ Guid GetUserUuid();
+ string GetUserUuidStr();
string GetSessionID();
string[] GetOnlinePlayers();
Dictionary GetOnlinePlayersWithUUID();
diff --git a/MinecraftClient/Protocol/ChatMessage.cs b/MinecraftClient/Protocol/Message/ChatMessage.cs
similarity index 69%
rename from MinecraftClient/Protocol/ChatMessage.cs
rename to MinecraftClient/Protocol/Message/ChatMessage.cs
index 1a4b961a..28d4c650 100644
--- a/MinecraftClient/Protocol/ChatMessage.cs
+++ b/MinecraftClient/Protocol/Message/ChatMessage.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace MinecraftClient.Protocol
+namespace MinecraftClient.Protocol.Message
{
public class ChatMessage
{
@@ -17,7 +17,7 @@ namespace MinecraftClient.Protocol
// 0: chat (chat box), 1: system message (chat box), 2: game info (above hotbar), 3: say command,
// 4: msg command, 5: team msg command, 6: emote command, 7: tellraw command
- public readonly int chatType;
+ public readonly int chatTypeId;
public readonly Guid senderUUID;
@@ -31,31 +31,44 @@ namespace MinecraftClient.Protocol
public readonly DateTime? timestamp;
+ public readonly byte[]? signature;
+
public readonly bool? isSignatureLegal;
- public ChatMessage(string content, bool isJson, int chatType, Guid senderUUID, string? unsignedContent, string displayName, string? teamName, long timestamp, bool isSignatureLegal)
+ public ChatMessage(string content, bool isJson, int chatType, Guid senderUUID, string? unsignedContent, string displayName, string? teamName, long timestamp, byte[] signature, bool isSignatureLegal)
{
- this.isSignedChat = true;
- this.isSystemChat = false;
+ isSignedChat = true;
+ isSystemChat = false;
this.content = content;
this.isJson = isJson;
- this.chatType = chatType;
+ this.chatTypeId = chatType;
this.senderUUID = senderUUID;
this.unsignedContent = unsignedContent;
this.displayName = displayName;
this.teamName = teamName;
- this.timestamp = DateTimeOffset.FromUnixTimeMilliseconds(timestamp).DateTime;
+ this.timestamp = DateTimeOffset.FromUnixTimeMilliseconds(timestamp).DateTime;
+ this.signature = signature;
this.isSignatureLegal = isSignatureLegal;
}
public ChatMessage(string content, bool isJson, int chatType, Guid senderUUID, bool isSystemChat = false)
{
- this.isSignedChat = isSystemChat;
+ isSignedChat = isSystemChat;
this.isSystemChat = isSystemChat;
this.content = content;
this.isJson = isJson;
- this.chatType = chatType;
+ this.chatTypeId = chatType;
this.senderUUID = senderUUID;
}
+
+ public LastSeenMessageList.Entry? toLastSeenMessageEntry()
+ {
+ return signature != null ? new LastSeenMessageList.Entry(senderUUID, signature) : null;
+ }
+
+ public bool lacksSender()
+ {
+ return this.senderUUID == Guid.Empty;
+ }
}
}
diff --git a/MinecraftClient/Protocol/ChatParser.cs b/MinecraftClient/Protocol/Message/ChatParser.cs
similarity index 85%
rename from MinecraftClient/Protocol/ChatParser.cs
rename to MinecraftClient/Protocol/Message/ChatParser.cs
index d5b8c76a..650a005d 100644
--- a/MinecraftClient/Protocol/ChatParser.cs
+++ b/MinecraftClient/Protocol/Message/ChatParser.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
+using MinecraftClient.Protocol.Message;
namespace MinecraftClient.Protocol
{
@@ -12,6 +13,20 @@ namespace MinecraftClient.Protocol
static class ChatParser
{
+ public enum MessageType
+ {
+ CHAT,
+ SAY_COMMAND,
+ MSG_COMMAND_INCOMING,
+ MSG_COMMAND_OUTGOING,
+ TEAM_MSG_COMMAND_INCOMING,
+ TEAM_MSG_COMMAND_OUTGOING,
+ EMOTE_COMMAND,
+ RAW_MSG
+ };
+
+ public static Dictionary? ChatId2Type;
+
///
/// The main function to convert text from MC 1.6+ JSON to MC 1.5.2 formatted text
///
@@ -31,60 +46,68 @@ namespace MinecraftClient.Protocol
/// Returns the translated text
public static string ParseSignedChat(ChatMessage message, List? links = null)
{
- string content;
- if (Settings.ShowModifiedChat && message.unsignedContent != null)
- content = ChatParser.ParseText(message.unsignedContent, links);
- else
- content = ChatParser.ParseText(message.content, links);
+ string chatContent = Settings.ShowModifiedChat && message.unsignedContent != null ? message.unsignedContent : message.content;
+ string content = message.isJson ? ParseText(chatContent, links) : chatContent;
string sender = message.displayName!;
+
string text;
List usingData = new();
- switch (message.chatType)
+
+ MessageType chatType;
+ if (message.isSystemChat)
+ chatType = MessageType.RAW_MSG;
+ else if (!ChatId2Type!.TryGetValue(message.chatTypeId, out chatType))
+ chatType = MessageType.CHAT;
+ switch (chatType)
{
- case 0: // chat (chat box)
+ case MessageType.CHAT:
usingData.Add(sender);
usingData.Add(content);
text = TranslateString("chat.type.text", usingData);
break;
- case 1: // system message (chat box)
- text = content;
- break;
- case 2: // game info (above hotbar)
- text = content;
- break;
- case 3: // say command
+ case MessageType.SAY_COMMAND:
usingData.Add(sender);
usingData.Add(content);
text = TranslateString("chat.type.announcement", usingData);
break;
- case 4: // msg command
+ case MessageType.MSG_COMMAND_INCOMING:
usingData.Add(sender);
usingData.Add(content);
text = TranslateString("commands.message.display.incoming", usingData);
break;
- case 5: // team msg command (/teammsg)
+ case MessageType.MSG_COMMAND_OUTGOING:
+ usingData.Add(sender);
+ usingData.Add(content);
+ text = TranslateString("commands.message.display.outgoing", usingData);
+ break;
+ case MessageType.TEAM_MSG_COMMAND_INCOMING:
usingData.Add(message.teamName!);
usingData.Add(sender);
usingData.Add(content);
text = TranslateString("chat.type.team.text", usingData);
break;
- case 6: // emote command (/me)
+ case MessageType.TEAM_MSG_COMMAND_OUTGOING:
+ usingData.Add(message.teamName!);
+ usingData.Add(sender);
+ usingData.Add(content);
+ text = TranslateString("chat.type.team.sent", usingData);
+ break;
+ case MessageType.EMOTE_COMMAND:
usingData.Add(sender);
usingData.Add(content);
text = TranslateString("chat.type.emote", usingData);
break;
- case 7: // tellraw command
+ case MessageType.RAW_MSG:
text = content;
break;
default:
- text = $"{sender}: {content}";
- break;
+ goto case MessageType.CHAT;
}
- string color = String.Empty;
+ string color = string.Empty;
if (message.isSystemChat)
{
if (Settings.MarkSystemMessage)
- color = "§z §r "; // Custom: Background Gray
+ color = "§z §r "; // Custom color code §z : Background Gray
}
else
{
@@ -93,18 +116,18 @@ namespace MinecraftClient.Protocol
if (Settings.ShowModifiedChat && message.unsignedContent != null)
{
if (Settings.MarkModifiedMsg)
- color = "§x §r "; // Custom: Background Yellow
+ color = "§x §r "; // Custom color code §x : Background Yellow
}
else
{
if (Settings.MarkLegallySignedMsg)
- color = "§y §r "; // Custom: Background Green
+ color = "§y §r "; // Custom color code §y : Background Green
}
}
else
{
if (Settings.MarkIllegallySignedMsg)
- color = "§w §r "; // Custom: Background Red
+ color = "§w §r "; // Custom color code §w : Background Red
}
}
return color + text;
@@ -172,13 +195,13 @@ namespace MinecraftClient.Protocol
TranslationRules["commands.message.display.outgoing"] = "§7You whisper to %s: %s";
//Language file in a subfolder, depending on the language setting
- if (!System.IO.Directory.Exists("lang"))
- System.IO.Directory.CreateDirectory("lang");
+ if (!Directory.Exists("lang"))
+ Directory.CreateDirectory("lang");
string Language_File = "lang" + Path.DirectorySeparatorChar + Settings.Language + ".lang";
//File not found? Try downloading language file from Mojang's servers?
- if (!System.IO.File.Exists(Language_File))
+ if (!File.Exists(Language_File))
{
ConsoleIO.WriteLineFormatted(Translations.Get("chat.download", Settings.Language));
try
@@ -197,7 +220,7 @@ namespace MinecraftClient.Protocol
stringBuilder.Append(entry.Key + "=" + entry.Value.StringValue + Environment.NewLine);
}
- System.IO.File.WriteAllText(Language_File, stringBuilder.ToString());
+ File.WriteAllText(Language_File, stringBuilder.ToString());
ConsoleIO.WriteLineFormatted(Translations.Get("chat.done", Language_File));
}
catch
@@ -207,15 +230,15 @@ namespace MinecraftClient.Protocol
}
//Download Failed? Defaulting to en_GB.lang if the game is installed
- if (!System.IO.File.Exists(Language_File) //Try en_GB.lang
- && System.IO.File.Exists(Settings.TranslationsFile_FromMCDir))
+ if (!File.Exists(Language_File) //Try en_GB.lang
+ && File.Exists(Settings.TranslationsFile_FromMCDir))
{
Language_File = Settings.TranslationsFile_FromMCDir;
Translations.WriteLineFormatted("chat.from_dir");
}
//Load the external dictionnary of translation rules or display an error message
- if (System.IO.File.Exists(Language_File))
+ if (File.Exists(Language_File))
{
foreach (var line in File.ReadLines(Language_File))
{
@@ -288,7 +311,7 @@ namespace MinecraftClient.Protocol
}
return result.ToString();
}
- else return "[" + rulename + "] " + String.Join(" ", using_data);
+ else return "[" + rulename + "] " + string.Join(" ", using_data);
}
///
@@ -314,11 +337,11 @@ namespace MinecraftClient.Protocol
if (clickEvent.Properties.ContainsKey("action")
&& clickEvent.Properties.ContainsKey("value")
&& clickEvent.Properties["action"].StringValue == "open_url"
- && !String.IsNullOrEmpty(clickEvent.Properties["value"].StringValue))
+ && !string.IsNullOrEmpty(clickEvent.Properties["value"].StringValue))
{
links.Add(clickEvent.Properties["value"].StringValue);
}
- }
+ }
if (data.Properties.ContainsKey("extra"))
{
Json.JSONData[] extras = data.Properties["extra"].DataArray.ToArray();
@@ -371,7 +394,7 @@ namespace MinecraftClient.Protocol
System.Net.HttpWebRequest myRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);
myRequest.Method = "GET";
System.Net.WebResponse myResponse = myRequest.GetResponse();
- System.IO.StreamReader sr = new System.IO.StreamReader(myResponse.GetResponseStream(), System.Text.Encoding.UTF8);
+ StreamReader sr = new StreamReader(myResponse.GetResponseStream(), Encoding.UTF8);
string result = sr.ReadToEnd();
sr.Close();
myResponse.Close();
diff --git a/MinecraftClient/Protocol/Message/LastSeenMessageList.cs b/MinecraftClient/Protocol/Message/LastSeenMessageList.cs
new file mode 100644
index 00000000..262b1b55
--- /dev/null
+++ b/MinecraftClient/Protocol/Message/LastSeenMessageList.cs
@@ -0,0 +1,117 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MinecraftClient.Protocol.Message
+{
+ ///
+ /// A list of messages a client has seen.
+ ///
+ public class LastSeenMessageList
+ {
+ public static readonly LastSeenMessageList EMPTY = new(new Entry[0]);
+ public static readonly int MAX_ENTRIES = 5;
+
+ public Entry[] entries;
+
+ public LastSeenMessageList(Entry[] list)
+ {
+ entries = list;
+ }
+
+ public void WriteForSign(List data)
+ {
+ foreach (Entry entry in entries)
+ {
+ data.Add(70);
+ data.AddRange(entry.profileId.ToBigEndianBytes());
+ data.AddRange(entry.lastSignature);
+ }
+ }
+
+ ///
+ /// A pair of a player's UUID and the signature of the last message they saw, used as an entry of LastSeenMessageList.
+ ///
+ public class Entry
+ {
+ public Guid profileId;
+ public byte[] lastSignature;
+
+ public Entry(Guid profileId, byte[] lastSignature)
+ {
+ this.profileId = profileId;
+ this.lastSignature = lastSignature;
+ }
+ }
+
+ ///
+ /// A record of messages acknowledged by a client.
+ /// This holds the messages the client has recently seen, as well as the last message they received, if any.
+ ///
+ public class Acknowledgment
+ {
+ public LastSeenMessageList lastSeen;
+ public Entry? lastReceived;
+
+ public Acknowledgment(LastSeenMessageList lastSeenMessageList, Entry? lastReceivedMessage)
+ {
+ lastSeen = lastSeenMessageList;
+ lastReceived = lastReceivedMessage;
+ }
+ }
+ }
+
+ ///
+ /// Collects the message that are last seen by a client.
+ /// The message, along with the "last received" message, forms an "acknowledgment" of received messages.
+ /// They are sent to the server when the client has enough messages received or when they send a message.
+ /// The maximum amount of message entries are specified in the constructor.The vanilla clients collect 5 entries.
+ /// Calling add adds the message to the beginning of the entries list, and evicts the oldest message.
+ /// If there are entries with the same sender profile ID, the older entry will be replaced with null instead of filling the hole.
+ ///
+ public class LastSeenMessagesCollector
+ {
+ private readonly LastSeenMessageList.Entry[] entries;
+ private int size = 0;
+ private LastSeenMessageList lastSeenMessages;
+
+ public LastSeenMessagesCollector(int size)
+ {
+ lastSeenMessages = LastSeenMessageList.EMPTY;
+ entries = new LastSeenMessageList.Entry[size];
+ }
+
+ public void Add(LastSeenMessageList.Entry entry)
+ {
+ LastSeenMessageList.Entry? lastEntry = entry;
+
+ for (int i = 0; i < size; ++i)
+ {
+ LastSeenMessageList.Entry curEntry = entries[i];
+ entries[i] = lastEntry;
+ lastEntry = curEntry;
+ if (curEntry.profileId == entry.profileId)
+ {
+ lastEntry = null;
+ break;
+ }
+ }
+
+ if (lastEntry != null && size < entries.Length)
+ entries[size++] = lastEntry;
+
+ LastSeenMessageList.Entry[] msgList = new LastSeenMessageList.Entry[size];
+ for (int i = 0; i < size; ++i)
+ msgList[i] = entries[i];
+ lastSeenMessages = new LastSeenMessageList(msgList);
+ }
+
+ public LastSeenMessageList GetLastSeenMessages()
+ {
+ return lastSeenMessages;
+ }
+
+ }
+}
diff --git a/MinecraftClient/Protocol/PlayerInfo.cs b/MinecraftClient/Protocol/PlayerInfo.cs
index f810b763..aa482b89 100644
--- a/MinecraftClient/Protocol/PlayerInfo.cs
+++ b/MinecraftClient/Protocol/PlayerInfo.cs
@@ -4,17 +4,18 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MinecraftClient.Protocol.Keys;
+using MinecraftClient.Protocol.Message;
namespace MinecraftClient.Protocol
{
public class PlayerInfo
{
- public readonly Guid UUID;
+ public readonly Guid Uuid;
public readonly string Name;
// Tuple[]? Property;
+ public readonly Tuple[]? Property;
public int Gamemode;
@@ -26,9 +27,13 @@ namespace MinecraftClient.Protocol
private readonly DateTime? KeyExpiresAt;
- public PlayerInfo(Guid uuid, string name, Tuple[]? property, int gamemode, int ping, string? displayName, long? timeStamp, byte[]? publicKey, byte[]? signature)
+ private bool lastMessageVerified;
+
+ private byte[]? precedingSignature;
+
+ public PlayerInfo(Guid uuid, string name, Tuple[]? property, int gamemode, int ping, string? displayName, long? timeStamp, byte[]? publicKey, byte[]? signature)
{
- UUID = uuid;
+ Uuid = uuid;
Name = name;
if (property != null)
Property = property;
@@ -48,36 +53,107 @@ namespace MinecraftClient.Protocol
PublicKey = null;
}
}
+ lastMessageVerified = true;
+ precedingSignature = null;
}
public PlayerInfo(string name, Guid uuid)
{
Name = name;
- UUID = uuid;
+ Uuid = uuid;
Gamemode = -1;
Ping = 0;
+ lastMessageVerified = true;
+ precedingSignature = null;
}
- public bool IsKeyVaild()
+ public bool IsMessageChainLegal()
{
- return PublicKey != null && DateTime.Now.ToUniversalTime() > this.KeyExpiresAt;
+ return this.lastMessageVerified;
}
- public bool VerifyMessage(string message, Guid uuid, long timestamp, long salt, ref byte[] signature)
+ public bool IsKeyExpired()
{
- if (PublicKey == null)
+ return DateTime.Now.ToUniversalTime() > this.KeyExpiresAt;
+ }
+
+ ///
+ /// Verify message - 1.19
+ ///
+ /// Message content
+ /// Timestamp
+ /// Salt
+ /// Message signature
+ /// Is this message vaild
+ public bool VerifyMessage(string message, long timestamp, long salt, ref byte[] signature)
+ {
+ if (PublicKey == null || IsKeyExpired())
return false;
else
{
- string uuidString = uuid.ToString().Replace("-", string.Empty);
-
DateTimeOffset timeOffset = DateTimeOffset.FromUnixTimeMilliseconds(timestamp);
byte[] saltByte = BitConverter.GetBytes(salt);
Array.Reverse(saltByte);
- return PublicKey.VerifyMessage(message, uuidString, timeOffset, ref saltByte, ref signature);
+ return PublicKey.VerifyMessage(message, Uuid, timeOffset, ref saltByte, ref signature);
}
}
+
+ ///
+ /// Verify message - 1.19.1 and above
+ ///
+ /// Message content
+ /// Timestamp
+ /// Salt
+ /// Message signature
+ /// Preceding message signature
+ /// LastSeenMessages
+ /// Is this message chain vaild
+ public bool VerifyMessage(string message, long timestamp, long salt, ref byte[] signature, ref byte[]? precedingSignature, LastSeenMessageList lastSeenMessages)
+ {
+ if (this.lastMessageVerified == false)
+ return false;
+ if (PublicKey == null || IsKeyExpired() || (this.precedingSignature != null && precedingSignature == null))
+ return false;
+ if (this.precedingSignature != null && !this.precedingSignature.SequenceEqual(precedingSignature!))
+ return false;
+
+ DateTimeOffset timeOffset = DateTimeOffset.FromUnixTimeMilliseconds(timestamp);
+
+ byte[] saltByte = BitConverter.GetBytes(salt);
+ Array.Reverse(saltByte);
+
+ bool res = PublicKey.VerifyMessage(message, Uuid, timeOffset, ref saltByte, ref signature, ref precedingSignature, lastSeenMessages);
+
+ this.lastMessageVerified = res;
+ this.precedingSignature = signature;
+
+ return res;
+ }
+
+ ///
+ /// Verify message head - 1.19.1 and above
+ ///
+ /// Preceding message signature
+ /// Message signature
+ /// Message body hash
+ /// Is this message chain vaild
+ public bool VerifyMessageHead(ref byte[]? precedingSignature, ref byte[] headerSignature, ref byte[] bodyDigest)
+ {
+ if (this.lastMessageVerified == false)
+ return false;
+ if (PublicKey == null || IsKeyExpired() || (this.precedingSignature != null && precedingSignature == null))
+ return false;
+ if (this.precedingSignature != null && !this.precedingSignature.SequenceEqual(precedingSignature!))
+ return false;
+
+ bool res = PublicKey.VerifyHeader(ref bodyDigest, ref headerSignature);
+
+ this.lastMessageVerified = res;
+ this.precedingSignature = headerSignature;
+
+ return res;
+ }
}
}
diff --git a/MinecraftClient/Protocol/ProfileKey/KeyUtils.cs b/MinecraftClient/Protocol/ProfileKey/KeyUtils.cs
index 0265e19d..9bf348fb 100644
--- a/MinecraftClient/Protocol/ProfileKey/KeyUtils.cs
+++ b/MinecraftClient/Protocol/ProfileKey/KeyUtils.cs
@@ -1,14 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
+using MinecraftClient.Protocol.Handlers;
+using MinecraftClient.Protocol.Message;
namespace MinecraftClient.Protocol.Keys
{
static class KeyUtils
{
- private static string certificates = "https://api.minecraftservices.com/player/certificates";
+ private static readonly SHA256 sha256Hash = SHA256.Create();
+
+ private static readonly string certificates = "https://api.minecraftservices.com/player/certificates";
public static PlayerKeyPair? GetNewProfileKeys(string accessToken)
{
@@ -67,19 +72,18 @@ namespace MinecraftClient.Protocol.Keys
return Convert.FromBase64String(key);
}
- public static byte[] GetSignatureData(string message, string uuid, DateTimeOffset timestamp, ref byte[] salt)
+ public static byte[] ComputeHash(byte[] data)
+ {
+ return sha256Hash.ComputeHash(data);
+ }
+
+ public static byte[] GetSignatureData(string message, Guid uuid, DateTimeOffset timestamp, ref byte[] salt)
{
List data = new();
data.AddRange(salt);
- byte[] UUIDLeastSignificantBits = BitConverter.GetBytes(Convert.ToInt64(uuid[..16], 16));
- Array.Reverse(UUIDLeastSignificantBits);
- data.AddRange(UUIDLeastSignificantBits);
-
- byte[] UUIDMostSignificantBits = BitConverter.GetBytes(Convert.ToInt64(uuid.Substring(16, 16), 16));
- Array.Reverse(UUIDMostSignificantBits);
- data.AddRange(UUIDMostSignificantBits);
+ data.AddRange(uuid.ToBigEndianBytes());
byte[] timestampByte = BitConverter.GetBytes(timestamp.ToUnixTimeSeconds());
Array.Reverse(timestampByte);
@@ -90,6 +94,39 @@ namespace MinecraftClient.Protocol.Keys
return data.ToArray();
}
+ public static byte[] GetSignatureData(string message, DateTimeOffset timestamp, ref byte[] salt, LastSeenMessageList lastSeenMessages)
+ {
+ List data = new();
+
+ data.AddRange(salt);
+
+ byte[] timestampByte = BitConverter.GetBytes(timestamp.ToUnixTimeSeconds());
+ Array.Reverse(timestampByte);
+ data.AddRange(timestampByte);
+
+ data.AddRange(Encoding.UTF8.GetBytes(message));
+
+ data.Add(70);
+
+ lastSeenMessages.WriteForSign(data);
+
+ return data.ToArray();
+ }
+
+ public static byte[] GetSignatureData(byte[]? precedingSignature, Guid sender, byte[] bodySign)
+ {
+ List data = new();
+
+ if (precedingSignature != null)
+ data.AddRange(precedingSignature);
+
+ data.AddRange(sender.ToBigEndianBytes());
+
+ data.AddRange(bodySign);
+
+ return data.ToArray();
+ }
+
// https://github.com/mono/mono/blob/master/mcs/class/System.Json/System.Json/JsonValue.cs
public static string EscapeString(string src)
{
diff --git a/MinecraftClient/Protocol/ProfileKey/PlayerKeyPair.cs b/MinecraftClient/Protocol/ProfileKey/PlayerKeyPair.cs
index 5690c78f..94921e6c 100644
--- a/MinecraftClient/Protocol/ProfileKey/PlayerKeyPair.cs
+++ b/MinecraftClient/Protocol/ProfileKey/PlayerKeyPair.cs
@@ -65,7 +65,10 @@ namespace MinecraftClient.Protocol.Keys
{
List datas = new List();
datas.Add(Convert.ToBase64String(PublicKey.Key));
- datas.Add(Convert.ToBase64String(PublicKey.Signature));
+ if (PublicKey.Signature == null)
+ datas.Add(String.Empty);
+ else
+ datas.Add(Convert.ToBase64String(PublicKey.Signature));
if (PublicKey.SignatureV2 == null)
datas.Add(String.Empty);
else
diff --git a/MinecraftClient/Protocol/ProfileKey/PrivateKey.cs b/MinecraftClient/Protocol/ProfileKey/PrivateKey.cs
index b02be93f..0683ef46 100644
--- a/MinecraftClient/Protocol/ProfileKey/PrivateKey.cs
+++ b/MinecraftClient/Protocol/ProfileKey/PrivateKey.cs
@@ -4,6 +4,7 @@ using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
+using MinecraftClient.Protocol.Message;
namespace MinecraftClient.Protocol.Keys
{
@@ -13,6 +14,8 @@ namespace MinecraftClient.Protocol.Keys
private readonly RSA rsa;
+ private byte[]? precedingSignature = null;
+
public PrivateKey(string pemKey)
{
this.Key = KeyUtils.DecodePemKey(pemKey, "-----BEGIN RSA PRIVATE KEY-----", "-----END RSA PRIVATE KEY-----");
@@ -26,7 +29,15 @@ namespace MinecraftClient.Protocol.Keys
return rsa.SignData(data, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1);
}
- public byte[] SignMessage(string message, string uuid, DateTimeOffset timestamp, ref byte[] salt)
+ ///
+ /// Sign message - 1.19
+ ///
+ /// Message content
+ /// Sender uuid
+ /// Timestamp
+ /// Salt
+ /// Signature data
+ public byte[] SignMessage(string message, Guid uuid, DateTimeOffset timestamp, ref byte[] salt)
{
string messageJson = "{\"text\":\"" + KeyUtils.EscapeString(message) + "\"}";
@@ -35,5 +46,27 @@ namespace MinecraftClient.Protocol.Keys
return SignData(data);
}
+ ///
+ /// Sign message - 1.19.1 and above
+ ///
+ /// Message content
+ /// Sender uuid
+ /// Timestamp
+ /// Salt
+ /// LastSeenMessageList
+ /// Signature data
+ public byte[] SignMessage(string message, Guid uuid, DateTimeOffset timestamp, ref byte[] salt, LastSeenMessageList lastSeenMessages)
+ {
+ byte[] bodySignData = KeyUtils.GetSignatureData(message, timestamp, ref salt, lastSeenMessages);
+ byte[] bodyDigest = KeyUtils.ComputeHash(bodySignData);
+
+ byte[] msgSignData = KeyUtils.GetSignatureData(precedingSignature, uuid, bodyDigest);
+ byte[] msgSign = SignData(msgSignData);
+
+ this.precedingSignature = msgSign;
+
+ return msgSign;
+ }
+
}
}
diff --git a/MinecraftClient/Protocol/ProfileKey/PublicKey.cs b/MinecraftClient/Protocol/ProfileKey/PublicKey.cs
index 763fc569..6bec8ae9 100644
--- a/MinecraftClient/Protocol/ProfileKey/PublicKey.cs
+++ b/MinecraftClient/Protocol/ProfileKey/PublicKey.cs
@@ -4,25 +4,27 @@ using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
+using MinecraftClient.Protocol.Message;
namespace MinecraftClient.Protocol.Keys
{
public class PublicKey
{
public byte[] Key { get; set; }
- public byte[] Signature { get; set; }
+ public byte[]? Signature { get; set; }
public byte[]? SignatureV2 { get; set; }
private readonly RSA rsa;
- public PublicKey(string pemKey, string sig, string? sigV2 = null)
+ public PublicKey(string pemKey, string? sig = null, string? sigV2 = null)
{
this.Key = KeyUtils.DecodePemKey(pemKey, "-----BEGIN RSA PUBLIC KEY-----", "-----END RSA PUBLIC KEY-----");
this.rsa = RSA.Create();
rsa.ImportSubjectPublicKeyInfo(this.Key, out _);
- this.Signature = Convert.FromBase64String(sig);
+ if (!string.IsNullOrEmpty(sig))
+ this.Signature = Convert.FromBase64String(sig);
if (!string.IsNullOrEmpty(sigV2))
this.SignatureV2 = Convert.FromBase64String(sigV2!);
@@ -43,12 +45,53 @@ namespace MinecraftClient.Protocol.Keys
return rsa.VerifyData(data, signature, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1);
}
- public bool VerifyMessage(string message, string uuid, DateTimeOffset timestamp, ref byte[] salt, ref byte[] signature)
+ ///
+ /// Verify message - 1.19
+ ///
+ /// Message content
+ /// Sender uuid
+ /// Timestamp
+ /// Salt
+ /// Message signature
+ /// Is this message vaild
+ public bool VerifyMessage(string message, Guid uuid, DateTimeOffset timestamp, ref byte[] salt, ref byte[] signature)
{
byte[] data = KeyUtils.GetSignatureData(message, uuid, timestamp, ref salt);
return VerifyData(data, signature);
}
+ ///
+ /// Verify message - 1.19.1 and above
+ ///
+ /// Message content
+ /// Sender uuid
+ /// Timestamp
+ /// Salt
+ /// Message signature
+ /// Preceding message signature
+ /// LastSeenMessages
+ /// Is this message vaild
+ public bool VerifyMessage(string message, Guid uuid, DateTimeOffset timestamp, ref byte[] salt, ref byte[] signature, ref byte[]? precedingSignature, LastSeenMessageList lastSeenMessages)
+ {
+ byte[] bodySignData = KeyUtils.GetSignatureData(message, timestamp, ref salt, lastSeenMessages);
+ byte[] bodyDigest = KeyUtils.ComputeHash(bodySignData);
+
+ byte[] msgSignData = KeyUtils.GetSignatureData(precedingSignature, uuid, bodyDigest);
+
+ return VerifyData(msgSignData, signature);
+ }
+
+ ///
+ /// Verify message head - 1.19.1 and above
+ ///
+ /// Message body hash
+ /// Message signature
+ /// Is this message header vaild
+ public bool VerifyHeader(ref byte[] bodyDigest, ref byte[] signature)
+ {
+ return VerifyData(bodyDigest, signature);
+ }
+
}
}
diff --git a/MinecraftClient/Protocol/ProtocolHandler.cs b/MinecraftClient/Protocol/ProtocolHandler.cs
index b03df4ce..eedf2002 100644
--- a/MinecraftClient/Protocol/ProtocolHandler.cs
+++ b/MinecraftClient/Protocol/ProtocolHandler.cs
@@ -131,7 +131,7 @@ namespace MinecraftClient.Protocol
if (Array.IndexOf(supportedVersions_Protocol16, ProtocolVersion) > -1)
return new Protocol16Handler(Client, ProtocolVersion, Handler);
- int[] supportedVersions_Protocol18 = { 4, 5, 47, 107, 108, 109, 110, 210, 315, 316, 335, 338, 340, 393, 401, 404, 477, 480, 485, 490, 498, 573, 575, 578, 735, 736, 751, 753, 754, 755, 756, 757, 758, 759 };
+ int[] supportedVersions_Protocol18 = { 4, 5, 47, 107, 108, 109, 110, 210, 315, 316, 335, 338, 340, 393, 401, 404, 477, 480, 485, 490, 498, 573, 575, 578, 735, 736, 751, 753, 754, 755, 756, 757, 758, 759, 760 };
if (Array.IndexOf(supportedVersions_Protocol18, ProtocolVersion) > -1)
return new Protocol18Handler(Client, ProtocolVersion, Handler, forgeInfo);
@@ -263,6 +263,9 @@ namespace MinecraftClient.Protocol
return 758;
case "1.19":
return 759;
+ case "1.19.1":
+ case "1.19.2":
+ return 760;
default:
return 0;
}
@@ -329,6 +332,7 @@ namespace MinecraftClient.Protocol
case 757: return "1.18.1";
case 758: return "1.18.2";
case 759: return "1.19";
+ case 760: return "1.19.2";
default: return "0.0";
}
}
diff --git a/MinecraftClient/Resources/lang/en.ini b/MinecraftClient/Resources/lang/en.ini
index c006d112..49bbfd8f 100644
--- a/MinecraftClient/Resources/lang/en.ini
+++ b/MinecraftClient/Resources/lang/en.ini
@@ -205,6 +205,7 @@ chat.fail=§8Failed to download the file.
chat.from_dir=§8Defaulting to en_GB.lang from your Minecraft directory.
chat.loaded=§8Translations file loaded.
chat.not_found=§8Translations file not found: '{0}'\nSome messages won't be properly printed without this file.
+chat.message_chain_broken=Player {0}'s message chain is broken!
[general]
# General message/information (i.e. Done)
diff --git a/MinecraftClient/Scripting/ChatBot.cs b/MinecraftClient/Scripting/ChatBot.cs
index 650bcf8c..4fc59e1e 100644
--- a/MinecraftClient/Scripting/ChatBot.cs
+++ b/MinecraftClient/Scripting/ChatBot.cs
@@ -1110,7 +1110,7 @@ namespace MinecraftClient
/// UserUUID of the current account
protected string GetUserUUID()
{
- return Handler.GetUserUUID();
+ return Handler.GetUserUuidStr();
}
///
diff --git a/MinecraftClient/config/ChatBots/DiscordWebhook.cs b/MinecraftClient/config/ChatBots/DiscordWebhook.cs
index 7460827d..987ed9bf 100644
--- a/MinecraftClient/config/ChatBots/DiscordWebhook.cs
+++ b/MinecraftClient/config/ChatBots/DiscordWebhook.cs
@@ -279,6 +279,12 @@ class HTTP
{
public static byte[] Post(string url, NameValueCollection pairs)
{
+ ServicePointManager.Expect100Continue = true;
+ ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
+ | SecurityProtocolType.Tls11
+ | SecurityProtocolType.Tls12
+ | SecurityProtocolType.Ssl3;
+
using (WebClient webClient = new WebClient())
{
return webClient.UploadValues(url, pairs);
diff --git a/MinecraftClient/config/README.md b/MinecraftClient/config/README.md
index 4901a4e8..fad3d324 100644
--- a/MinecraftClient/config/README.md
+++ b/MinecraftClient/config/README.md
@@ -1,517 +1,4 @@
Minecraft Console Client User Manual
======
-**Thanks for dowloading Minecraft Console Client!**
-
-Minecraft Console Client is a lightweight app able to connect to any minecraft server,
-both offline and online mode. It enables you to send commands and receive text messages
-in a fast and easy way without having to open the main Minecraft game.
-
-How to use
-------
-
-First, extract the archive if not already extracted.
-On Windows, simply open MinecraftClient.exe by double-clicking on it.
-On Mac or Linux you need to install the Mono Runtime:
- - On Mac: http://www.mono-project.com/download/#download-mac
- - On Linux: sudo apt-get install mono-runtime libmono-reflection-cil
-Then, open a terminal in this folder and run "mono MinecraftClient.exe".
-If you cannot authenticate on Mono because you have TLS/HTTPS/Certificate errors, you'll need to run `mozroots --import --ask-remove` once or install `ca-certificates-mono` (See [#1708](https://github.com/MCCTeam/Minecraft-Console-Client/issues/1708#issuecomment-893768862)).
-If Mono crashes, retry with `mono-complete` instead of `mono-runtime`. Use at least Mono v4.0.
-
-Docker
-------
-
-Using Docker do the following:
-
-**Building the Image:**
-```bash
-# Using HTTPS
-git clone https://github.com/MCCTeam/Minecraft-Console-Client.git
-
-# Using SSH
-git clone git@github.com:MCCTeam/Minecraft-Console-Client.git
-
-cd Minecraft-Console-Client/Docker
-
-docker build -t minecraft-console-client:latest .
-```
-
-**Start the container using Docker:**
-```bash
-# You could also ignore the -v parameter if you dont want to mount the volume that is up to you. If you don't it's harder to edit the .ini file if thats something you want to do
-docker run -it -v :/opt/data minecraft-console-client:latest
-```
-Now you could login and the Client is running. To detach from the Client but still keep it running in the Background press: `CTRL + P`, `CTRL + Q`.
-To reattach use the `docker attach` command.
-
-**Start the container using docker-compose:**
-
-By default, the volume of the container gets mapped into a new folder named `data` in the same folder the `docker-compose.yml` is stored.
-
-If you don't want to map a volume, you have to comment out or delete the entire volumes section:
-```yml
-#volumes:
-#- './data:/opt/data'
-```
-Make sure you are in the directory the `docker-compose.yml` is stored before you attempt to start. If you do so, you can start the container:
-```bash
-docker-compose run MCC
-```
-Remember to remove the container after usage:
-```bash
-docker-compose down
-```
-
-If you use the INI file and entered your data (username, password, server) there, you can start your container using
-```bash
-docker-compose up
-docker-compose up -d #for deamonized running in the background
-```
-Note that you won't be able to interact with the client using `docker-compose up`. If you want that functionality, please use the first method: `docker-compose run MCC`.
-As above, you can stop and remove the container using
-```bash
-docker-compose down
-```
-
-Using Configuration files & Enabling bots
-------
-
-Simply open the INI configuration file with a text editor and change the values.
-To enable a bot change the `enabled` value in the INI file from `false` to `true`.
-You will still be able to send and receive chat messages when a bot is loaded.
-You can remove or comment some lines from the INI file to use the default values instead.
-You can have several INI files and drag & drop one of them over MinecraftClient.exe
-
-Command-line usage
-------
-
-Quick usage:
-
-```
-MinecraftClient.exe --help
-MinecraftClient.exe
-MinecraftClient.exe "/mycommand"
-MinecraftClient.exe --setting=value [--other settings]
-MinecraftClient.exe --section.setting=value [--other settings]
-MinecraftClient.exe [--other settings]
-```
-You can mix and match arguments by following theses rules:
- * First positional argument may be either the login or settings file
- * Other positional arguments are read in order: login, password, server, command
- * Arguments starting with `--` can be in any order and position
-
-Examples and further explanations:
-
-```
-MinecraftClient.exe
-```
-
-* This will automatically connect you to the chosen server.
-* You may omit password and/or server to specify e.g. only the login
-* To specify a server but ask password interactively, use `""` as password.
-* To specify offline mode with no password, use `-` as password.
-
-```
-MinecraftClient.exe "/mycommand"
-```
-
-* This will automatically send `/mycommand` to the server and close.
-* To send several commands and/or stay connected, use the ScriptScheduler bot instead.
-
-```
-MinecraftClient.exe
-```
-
-* This will load the specified configuration file
-* If the file contains login / password / server ip, it will automatically connect.
-
-```
-MinecraftClient.exe --setting=value [--other settings]
-```
-
-* Specify settings on the command-line, see possible value in the configuration file
-* Use `--section.setting=value` for settings outside the `[Main]` section
-* Example: `--antiafk.enabled=true` for enabling the AntiAFK bot
-
-```
-MinecraftClient.exe [--other settings]
-```
-
-* Load the specified configuration file and override some settings from the file
-
-Internal commands
-------
-
-These commands can be performed from the chat prompt, scripts or remote control.
-From chat prompt, commands must by default be prepended with a slash, eg. `/quit`.
-In scripts and remote control, no slash is needed to perform the command, eg. `quit`.
-
- - `quit` or `exit`: disconnect from the server and close the application
- - `reco [account]`: disconnect and reconnect to the server
- - `connect [account]`: go to the given server and resume the script
- - `script