Basic support for minecraft 1.19 (#2084)

* merge commit from milutinke
* chat signature & encrypted login
* Bug fix :EncryptionResponse format error below 1.18.2
* Implemented chat command signature
* Chat message parsing and verification for 1.19
* Add signature settings
* Update Simplified Chinese Translation
* Clear up comments
* Fix wrong variable naming
* Bug fix: SignatureV2 Processing
This commit is contained in:
BruceChen 2022-08-15 23:55:44 +08:00 committed by GitHub
parent d9f1a77ac2
commit a8bbb1ac76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
55 changed files with 5218 additions and 1174 deletions

View file

@ -26,8 +26,10 @@ namespace MinecraftClient.Protocol
string GetSessionID();
string[] GetOnlinePlayers();
Dictionary<string, string> GetOnlinePlayersWithUUID();
PlayerInfo? GetPlayerInfo(Guid uuid);
Location GetCurrentLocation();
World GetWorld();
bool GetIsSupportPreviewsChat();
bool GetTerrainEnabled();
bool SetTerrainEnabled(bool enabled);
bool GetInventoryEnabled();
@ -78,11 +80,10 @@ namespace MinecraftClient.Protocol
void OnGameJoined();
/// <summary>
/// This method is called when the protocol handler receives a chat message
/// Received chat/system message from the server
/// </summary>
/// <param name="text">Text received from the server</param>
/// <param name="isJson">TRUE if the text is JSON-Encoded</param>
void OnTextReceived(string text, bool isJson);
/// <param name="message">Message received</param>
public void OnTextReceived(ChatMessage message);
/// <summary>
/// Will be called every animations of the hit and place block
@ -91,6 +92,12 @@ namespace MinecraftClient.Protocol
/// <param name="animation">0 = LMB, 1 = RMB (RMB Corrent not work)</param>
void OnEntityAnimation(int entityID, byte animation);
/// <summary>
/// Will be called when a Synchronization sequence is recevied, this sequence need to be sent when breaking or placing blocks
/// </summary>
/// <param name="sequenceId">Sequence ID</param>
void OnBlockChangeAck(int sequenceId);
/// <summary>
/// Will be called every player break block in gamemode 0
/// </summary>
@ -109,6 +116,22 @@ namespace MinecraftClient.Protocol
/// </summary>
void OnServerKeepAlive();
/// <summary>
/// This method is called when the protocol handler receives server data
/// </summary>
/// <param name="hasMotd">Indicates if the server has a motd message</param>
/// <param name="motd">Server MOTD message</param>
/// <param name="hasIcon">Indicates if the server has a an icon</param>
/// <param name="iconBase64">Server icon in Base 64 format</param>
/// <param name="previewsChat">Indicates if the server previews chat</param>
void OnServerDataRecived(bool hasMotd, string motd, bool hasIcon, string iconBase64, bool previewsChat);
/// <summary>
/// This method is called when the protocol handler receives "Set Display Chat Preview" packet
/// </summary>
/// <param name="previewsChat">Indicates if the server previews chat</param>
public void OnChatPreviewSettingUpdate(bool previewsChat);
/// <summary>
/// Called when an inventory is opened
/// </summary>
@ -125,11 +148,10 @@ namespace MinecraftClient.Protocol
void OnRespawn();
/// <summary>
/// This method is called when a new player joins the game
/// Triggered when a new player joins the game
/// </summary>
/// <param name="uuid">UUID of the player</param>
/// <param name="name">Name of the player</param>
void OnPlayerJoin(Guid uuid, string name);
/// <param name="player">player info</param>
public void OnPlayerJoin(PlayerInfo player);
/// <summary>
/// This method is called when a player has left the game
@ -346,7 +368,7 @@ namespace MinecraftClient.Protocol
/// </summary>
/// <param name="EntityID">Player entity ID</param>
void OnReceivePlayerEntityID(int EntityID);
/// <summary>
/// Called when the Entity use effects
/// </summary>
@ -355,8 +377,10 @@ namespace MinecraftClient.Protocol
/// <param name="amplifier">effect amplifier</param>
/// <param name="duration">effect duration</param>
/// <param name="flags">effect flags</param>
void OnEntityEffect(int entityid, Effects effect, int amplifier, int duration, byte flags);
/// <param name="hasFactorData">has factor data</param>
/// <param name="factorCodec">factorCodec</param>
void OnEntityEffect(int entityid, Effects effect, int amplifier, int duration, byte flags, bool hasFactorData, Dictionary<String, object>? factorCodec);
/// <summary>
/// Called when coreboardObjective
/// </summary>
@ -385,5 +409,13 @@ namespace MinecraftClient.Protocol
/// <param name="isRegularVillager">True if regular villagers and false if the wandering trader.</param>
/// <param name="canRestock">If the villager can restock his trades at a workstation, True for regular villagers and false for the wandering trader.</param>
void OnTradeList(int windowID, List<VillagerTrade> trades, VillagerInfo villagerInfo);
/// <summary>
/// This method is called when the protocol handler receives "Login Success" packet
/// </summary>
/// <param name="uuid">The player's UUID received from the server</param>
/// <param name="userName">The player's username received from the server</param>
/// <param name="playerProperty">Tuple<Name, Value, Signature(empty if there is no signature)></param>
public void OnLoginSuccess(Guid uuid, string userName, Tuple<string, string, string>[]? playerProperty);
}
}