2022-11-28 13:55:05 +08:00
using System ;
2014-05-31 01:59:03 +02:00
using System.Collections.Generic ;
2020-03-26 15:01:42 +08:00
using MinecraftClient.Inventory ;
2021-03-07 14:23:26 +08:00
using MinecraftClient.Logger ;
2022-10-02 18:31:08 +08:00
using MinecraftClient.Mapping ;
2022-08-27 02:10:44 +08:00
using MinecraftClient.Protocol.Message ;
2023-01-14 20:43:32 +08:00
using MinecraftClient.Protocol.ProfileKey ;
2022-12-06 15:50:17 +08:00
using MinecraftClient.Scripting ;
2014-05-31 01:59:03 +02:00
namespace MinecraftClient.Protocol
{
/// <summary>
/// Interface for the MinecraftCom Handler.
/// It defines some callbacks that the MinecraftCom handler must have.
/// It allows the protocol handler to abstract from the other parts of the program.
/// </summary>
public interface IMinecraftComHandler
{
2016-02-07 14:24:01 -08:00
/ * The MinecraftCom Handler must
2014-05-31 01:59:03 +02:00
* provide these getters * /
2015-06-20 22:58:18 +02:00
int GetServerPort ( ) ;
string GetServerHost ( ) ;
string GetUsername ( ) ;
2022-08-27 02:10:44 +08:00
Guid GetUserUuid ( ) ;
string GetUserUuidStr ( ) ;
2015-06-20 22:58:18 +02:00
string GetSessionID ( ) ;
2016-08-27 15:46:34 +02:00
string [ ] GetOnlinePlayers ( ) ;
2019-03-30 10:47:59 -04:00
Dictionary < string , string > GetOnlinePlayersWithUUID ( ) ;
2022-08-15 23:55:44 +08:00
PlayerInfo ? GetPlayerInfo ( Guid uuid ) ;
2023-01-11 17:25:25 +08:00
PlayerKeyPair ? GetPlayerKeyPair ( ) ;
2015-11-27 17:16:33 +01:00
Location GetCurrentLocation ( ) ;
2015-11-30 15:30:49 +01:00
World GetWorld ( ) ;
2022-08-15 23:55:44 +08:00
bool GetIsSupportPreviewsChat ( ) ;
2019-04-28 21:32:03 +02:00
bool GetTerrainEnabled ( ) ;
bool SetTerrainEnabled ( bool enabled ) ;
2019-05-26 10:36:46 -04:00
bool GetInventoryEnabled ( ) ;
2019-05-30 11:34:08 +02:00
bool SetInventoryEnabled ( bool enabled ) ;
2020-03-23 19:59:00 +08:00
bool GetEntityHandlingEnabled ( ) ;
2020-03-31 20:36:45 +08:00
bool SetEntityHandlingEnabled ( bool enabled ) ;
2020-09-07 03:51:42 +08:00
bool GetNetworkPacketCaptureEnabled ( ) ;
void SetNetworkPacketCaptureEnabled ( bool enabled ) ;
int GetProtocolVersion ( ) ;
2022-09-08 14:04:23 +08:00
Container ? GetInventory ( int inventoryID ) ;
2021-01-29 07:45:18 +08:00
ILogger GetLogger ( ) ;
2014-11-11 00:32:32 +11:00
2021-05-13 02:07:53 +08:00
/// <summary>
2021-05-15 16:31:02 +02:00
/// Invoke a task on the main thread, wait for completion and retrieve return value.
2021-05-13 02:07:53 +08:00
/// </summary>
2021-05-15 16:31:02 +02:00
/// <param name="task">Task to run with any type or return value</param>
/// <returns>Any result returned from task, result type is inferred from the task</returns>
/// <example>bool result = InvokeOnMainThread(methodThatReturnsAbool);</example>
/// <example>bool result = InvokeOnMainThread(() => methodThatReturnsAbool(argument));</example>
/// <example>int result = InvokeOnMainThread(() => { yourCode(); return 42; });</example>
/// <typeparam name="T">Type of the return value</typeparam>
T InvokeOnMainThread < T > ( Func < T > task ) ;
/// <summary>
/// Invoke a task on the main thread and wait for completion
/// </summary>
/// <param name="task">Task to run without return value</param>
/// <example>InvokeOnMainThread(methodThatReturnsNothing);</example>
/// <example>InvokeOnMainThread(() => methodThatReturnsNothing(argument));</example>
/// <example>InvokeOnMainThread(() => { yourCode(); });</example>
void InvokeOnMainThread ( Action task ) ;
2021-05-13 02:07:53 +08:00
2020-09-07 03:51:42 +08:00
/// <summary>
/// Called when a network packet received or sent
/// </summary>
/// <remarks>
/// Only called if <see cref="McClient.networkPacketEventEnabled"/> is set to True
/// </remarks>
/// <param name="packetID">Packet ID</param>
/// <param name="packetData">A copy of Packet Data</param>
/// <param name="isLogin">The packet is login phase or playing phase</param>
/// <param name="isInbound">The packet is received from server or sent by client</param>
void OnNetworkPacket ( int packetID , List < byte > packetData , bool isLogin , bool isInbound ) ;
2015-09-30 20:01:57 +02:00
/// <summary>
/// Called when a server was successfully joined
/// </summary>
2023-01-17 20:16:35 +08:00
void OnGameJoined ( bool isOnlineMode ) ;
2015-09-30 20:01:57 +02:00
2014-05-31 01:59:03 +02:00
/// <summary>
2022-08-15 23:55:44 +08:00
/// Received chat/system message from the server
2014-05-31 01:59:03 +02:00
/// </summary>
2022-08-15 23:55:44 +08:00
/// <param name="message">Message received</param>
public void OnTextReceived ( ChatMessage message ) ;
2021-07-04 11:26:41 +05:00
/// <summary>
/// Will be called every animations of the hit and place block
/// </summary>
/// <param name="entityID">Player ID</param>
/// <param name="animation">0 = LMB, 1 = RMB (RMB Corrent not work)</param>
void OnEntityAnimation ( int entityID , byte animation ) ;
2022-08-15 23:55:44 +08:00
/// <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 ) ;
2021-07-04 11:26:41 +05:00
/// <summary>
/// Will be called every player break block in gamemode 0
/// </summary>
/// <param name="entityId">Player ID</param>
/// <param name="location">Block location</param>
/// <param name="stage">Destroy stage, maximum 255</param>
void OnBlockBreakAnimation ( int entityID , Location location , byte stage ) ;
2020-06-20 17:57:07 +05:00
/// <summary>
/// This method is called when the protocol handler receives a title
/// </summary>
void OnTitle ( int action , string titletext , string subtitletext , string actionbartext , int fadein , int stay , int fadeout , string json ) ;
2022-09-18 00:18:27 +02:00
2019-09-15 17:01:53 +02:00
/// <summary>
/// Called when receiving a connection keep-alive from the server
/// </summary>
void OnServerKeepAlive ( ) ;
2022-08-15 23:55:44 +08:00
/// <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 ) ;
2019-05-26 10:36:46 -04:00
/// <summary>
/// Called when an inventory is opened
/// </summary>
2020-03-29 18:41:26 +02:00
void OnInventoryOpen ( int inventoryID , Container inventory ) ;
2019-05-26 10:36:46 -04:00
/// <summary>
/// Called when an inventory is closed
2019-05-25 17:45:59 -04:00
/// </summary>
2020-03-29 18:41:26 +02:00
void OnInventoryClose ( int inventoryID ) ;
2019-05-25 17:45:59 -04:00
2019-04-28 21:32:03 +02:00
/// <summary>
/// Called when the player respawns, which happens on login, respawn and world change.
/// </summary>
void OnRespawn ( ) ;
2014-11-10 20:43:00 +01:00
/// <summary>
2022-08-15 23:55:44 +08:00
/// Triggered when a new player joins the game
2014-11-10 20:43:00 +01:00
/// </summary>
2022-08-15 23:55:44 +08:00
/// <param name="player">player info</param>
public void OnPlayerJoin ( PlayerInfo player ) ;
2014-11-10 20:43:00 +01:00
/// <summary>
/// This method is called when a player has left the game
/// </summary>
/// <param name="uuid">UUID of the player</param>
void OnPlayerLeave ( Guid uuid ) ;
2022-10-26 20:53:09 +02:00
/// <summary>
/// This method is called when a player has been killed by another entity
/// </summary>
/// <param name="killerEntityId">Killer's entity if</param>
/// <param name="chatMessage">message sent in chat when player is killed</param>
void OnPlayerKilled ( int killerEntityId , string chatMessage ) ;
2015-11-27 17:16:33 +01:00
/// <summary>
/// Called when the server sets the new location for the player
/// </summary>
/// <param name="location">New location of the player</param>
2019-04-09 18:01:00 -07:00
/// <param name="yaw">New yaw</param>
/// <param name="pitch">New pitch</param>
void UpdateLocation ( Location location , float yaw , float pitch ) ;
2015-11-27 17:16:33 +01:00
2014-05-31 01:59:03 +02:00
/// <summary>
/// This method is called when the connection has been lost
/// </summary>
void OnConnectionLost ( ChatBot . DisconnectReason reason , string message ) ;
/// <summary>
/// Called ~10 times per second (10 ticks per second)
/// Useful for updating bots in other parts of the program
/// </summary>
void OnUpdate ( ) ;
2016-02-07 14:24:01 -08:00
/// <summary>
/// Registers the given plugin channel for the given bot.
/// </summary>
/// <param name="channel">The channel to register.</param>
/// <param name="bot">The bot to register the channel for.</param>
void RegisterPluginChannel ( string channel , ChatBot bot ) ;
/// <summary>
/// Unregisters the given plugin channel for the given bot.
/// </summary>
/// <param name="channel">The channel to unregister.</param>
/// <param name="bot">The bot to unregister the channel for.</param>
void UnregisterPluginChannel ( string channel , ChatBot bot ) ;
/// <summary>
2016-03-10 13:29:05 +01:00
/// Sends a plugin channel packet to the server.
/// See http://wiki.vg/Plugin_channel for more information about plugin channels.
2016-02-07 14:24:01 -08:00
/// </summary>
/// <param name="channel">The channel to send the packet on.</param>
/// <param name="data">The payload for the packet.</param>
/// <param name="sendEvenIfNotRegistered">Whether the packet should be sent even if the server or the client hasn't registered it yet.</param>
/// <returns>Whether the packet was sent: true if it was sent, false if there was a connection error or it wasn't registered.</returns>
bool SendPluginChannelMessage ( string channel , byte [ ] data , bool sendEvenIfNotRegistered = false ) ;
/// <summary>
/// Called when a plugin channel message was sent from the server.
/// </summary>
/// <param name="channel">The channel the message was sent on</param>
/// <param name="data">The data from the channel</param>
void OnPluginChannelMessage ( string channel , byte [ ] data ) ;
2020-03-21 18:41:48 +08:00
2020-03-28 00:48:41 +01:00
/// <summary>
2020-05-24 18:21:22 +02:00
/// Called when an entity has spawned
2020-03-28 00:48:41 +01:00
/// </summary>
2020-05-24 18:21:22 +02:00
/// <param name="entity">Spawned entity</param>
void OnSpawnEntity ( Entity entity ) ;
2022-09-18 00:18:27 +02:00
2020-06-20 17:57:07 +05:00
/// <summary>
/// Called when an entity has spawned
/// </summary>
/// <param name="entityid">Entity id</param>
/// <param name="slot">Equipment slot. 0: main hand, 1: off hand, 2– 5: armor slot (2: boots, 3: leggings, 4: chestplate, 5: helmet)/param>
/// <param name="item">Item/param>
2022-10-02 18:31:08 +08:00
void OnEntityEquipment ( int entityid , int slot , Item ? item ) ;
2022-09-18 00:18:27 +02:00
2020-03-28 00:48:41 +01:00
/// <summary>
2020-05-25 21:39:24 +02:00
/// Called when a player spawns or enters the client's render distance
2020-03-28 00:48:41 +01:00
/// </summary>
2020-05-25 21:39:24 +02:00
/// <param name="entityID">Entity ID</param>
/// <param name="uuid">Entity UUID</param>
2020-03-28 00:48:41 +01:00
/// <param name="location">Entity location</param>
2020-05-25 21:39:24 +02:00
/// <param name="yaw">Player head yaw</param>
/// <param name="pitch">Player head pitch</param>
2020-05-24 18:21:22 +02:00
void OnSpawnPlayer ( int entityID , Guid uuid , Location location , byte yaw , byte pitch ) ;
2020-03-26 15:01:42 +08:00
2020-03-28 00:48:41 +01:00
/// <summary>
/// Called when entities have despawned
/// </summary>
/// <param name="EntityID">List of Entity ID that have despawned</param>
2020-03-21 18:41:48 +08:00
void OnDestroyEntities ( int [ ] EntityID ) ;
2020-03-28 00:48:41 +01:00
/// <summary>
/// Called when an entity moved by coordinate offset
/// </summary>
/// <param name="EntityID">Entity ID</param>
/// <param name="Dx">X offset</param>
/// <param name="Dy">Y offset</param>
/// <param name="Dz">Z offset</param>
/// <param name="onGround">TRUE if on ground</param>
2020-05-25 21:39:24 +02:00
void OnEntityPosition ( int entityID , Double dx , Double dy , Double dz , bool onGround ) ;
2020-03-21 18:41:48 +08:00
2020-03-28 00:48:41 +01:00
/// <summary>
/// Called when an entity moved to fixed coordinates
/// </summary>
/// <param name="EntityID">Entity ID</param>
/// <param name="Dx">X</param>
/// <param name="Dy">Y</param>
/// <param name="Dz">Z</param>
/// <param name="onGround">TRUE if on ground</param>
2020-05-24 18:21:22 +02:00
void OnEntityTeleport ( int entityID , Double x , Double y , Double z , bool onGround ) ;
2020-03-28 00:48:41 +01:00
/// <summary>
/// Called when additional properties have been received for an entity
/// </summary>
/// <param name="EntityID">Entity ID</param>
/// <param name="prop">Dictionary of properties</param>
2020-05-24 18:21:22 +02:00
void OnEntityProperties ( int entityID , Dictionary < string , Double > prop ) ;
2020-03-21 18:41:48 +08:00
2021-03-21 22:17:19 +08:00
/// <summary>
/// Called when the status of an entity have been changed
/// </summary>
/// <param name="entityID">Entity ID</param>
/// <param name="status">Status ID</param>
void OnEntityStatus ( int entityID , byte status ) ;
2020-03-28 00:48:41 +01:00
/// <summary>
/// Called when the world age has been updated
/// </summary>
/// <param name="WorldAge">World age</param>
/// <param name="TimeOfDay">Time of Day</param>
2020-05-24 18:21:22 +02:00
void OnTimeUpdate ( long worldAge , long timeOfDay ) ;
2020-03-21 18:41:48 +08:00
2022-10-12 19:51:01 +02:00
/// <summary>
/// When received window properties from server.
///
/// </summary>
/// <param name="inventoryID">Inventory ID</param>
/// <param name="propertyId">Property ID</param>
/// <param name="propertyValue">Property Value</param>
public void OnWindowProperties ( byte inventoryID , short propertyId , short propertyValue ) ;
2020-03-28 00:48:41 +01:00
/// <summary>
/// Called when inventory items have been received
/// </summary>
2020-03-29 18:41:26 +02:00
/// <param name="inventoryID">Inventory ID</param>
2020-03-28 00:48:41 +01:00
/// <param name="itemList">Item list</param>
2022-07-01 18:59:58 +02:00
/// <param name="stateId">State ID</param>
void OnWindowItems ( byte inventoryID , Dictionary < int , Item > itemList , int stateId ) ;
2020-03-22 23:19:31 +08:00
2020-03-28 00:48:41 +01:00
/// <summary>
/// Called when a single slot has been updated inside an inventory
/// </summary>
2020-03-29 18:41:26 +02:00
/// <param name="inventoryID">Window ID</param>
/// <param name="slotID">Slot ID</param>
/// <param name="item">Item (may be null for empty slot)</param>
2022-07-25 01:13:41 +08:00
/// <param name="stateId">State ID</param>
2022-10-02 18:31:08 +08:00
void OnSetSlot ( byte inventoryID , short slotID , Item ? item , int stateId ) ;
2020-03-28 00:48:41 +01:00
2020-04-08 00:28:03 +08:00
/// <summary>
/// Called when player health or hunger changed.
/// </summary>
/// <param name="health"></param>
/// <param name="food"></param>
2020-04-04 19:18:18 +08:00
void OnUpdateHealth ( float health , int food ) ;
2020-04-01 18:28:00 +08:00
2020-08-20 21:36:50 +05:00
/// <summary>
/// Called when the health of an entity changed
/// </summary>
/// <param name="entityID">Entity ID</param>
/// <param name="health">The health of the entity</param>
void OnEntityHealth ( int entityID , float health ) ;
2022-09-18 00:18:27 +02:00
2020-08-20 21:36:50 +05:00
/// <summary>
/// Called when entity metadata or metadata changed.
/// </summary>
/// <param name="EntityID">Entity ID</param>
/// <param name="metadata">Entity metadata</param>
2022-09-15 21:11:47 +08:00
void OnEntityMetadata ( int EntityID , Dictionary < int , object? > metadata ) ;
2020-08-20 21:36:50 +05:00
2020-05-29 23:18:34 +05:00
/// <summary>
/// Called when and explosion occurs on the server
/// </summary>
/// <param name="location">Explosion location</param>
/// <param name="strength">Explosion strength</param>
/// <param name="affectedBlocks">Amount of affected blocks</param>
void OnExplosion ( Location location , float strength , int affectedBlocks ) ;
/// <summary>
/// Called when a player's game mode has changed
/// </summary>
/// <param name="uuid">Affected player's UUID</param>
/// <param name="gamemode">New game mode</param>
void OnGamemodeUpdate ( Guid uuid , int gamemode ) ;
2022-09-18 00:18:27 +02:00
2020-06-07 16:16:49 +05:00
/// <summary>
/// Called when a player's latency has changed
/// </summary>
/// <param name="uuid">Affected player's UUID</param>
/// <param name="latency">latency</param>
void OnLatencyUpdate ( Guid uuid , int latency ) ;
2022-09-18 00:18:27 +02:00
2020-05-29 23:18:34 +05:00
/// <summary>
/// Called when Experience bar is updated
/// </summary>
/// <param name="Experiencebar">Experience bar level</param>
/// <param name="Level">Player Level</param>
/// <param name="TotalExperience">Total experience</param>
void OnSetExperience ( float Experiencebar , int Level , int TotalExperience ) ;
2020-04-08 00:28:03 +08:00
/// <summary>
/// Called when client need to change slot.
/// </summary>
/// <remarks>Used for setting player slot after joining game</remarks>
/// <param name="slot"></param>
void OnHeldItemChange ( byte slot ) ;
2022-09-18 00:18:27 +02:00
2020-06-20 17:57:07 +05:00
/// <summary>
2022-09-18 00:18:27 +02:00
/// Called when an update of the map is sent by the server, take a look at https://wiki.vg/Protocol#Map_Data for more info on the fields
2023-10-07 04:59:08 -05:00
/// Map format and colors: https://minecraft.wiki/w/Map_item_format
2020-06-20 17:57:07 +05:00
/// </summary>
2022-09-18 00:18:27 +02:00
/// <param name="mapid">Map ID of the map being modified</param>
/// <param name="scale">A scale of the Map, from 0 for a fully zoomed-in map (1 block per pixel) to 4 for a fully zoomed-out map (16 blocks per pixel)</param>
/// <param name="trackingposition">Specifies whether player and item frame icons are shown </param>
/// <param name="locked">True if the map has been locked in a cartography table </param>
/// <param name="icons">A list of MapIcon objects of map icons, send only if trackingPosition is true</param>
/// <param name="columnsUpdated">Numbs of columns that were updated (map width) (NOTE: If it is 0, the next fields are not used/are set to default values of 0 and null respectively)</param>
/// <param name="rowsUpdated">Map height</param>
/// <param name="mapCoulmnX">x offset of the westernmost column</param>
/// <param name="mapRowZ">z offset of the northernmost row</param>
/// <param name="colors">a byte array of colors on the map</param>
void OnMapData ( int mapid , byte scale , bool trackingPosition , bool locked , List < MapIcon > icons , byte columnsUpdated , byte rowsUpdated , byte mapCoulmnX , byte mapRowZ , byte [ ] ? colors ) ;
2020-03-28 00:48:41 +01:00
/// <summary>
/// Called when the Player entity ID has been received from the server
/// </summary>
/// <param name="EntityID">Player entity ID</param>
2020-06-20 15:18:34 +02:00
void OnReceivePlayerEntityID ( int EntityID ) ;
2022-08-15 23:55:44 +08:00
2020-07-04 13:45:51 +05:00
/// <summary>
/// Called when the Entity use effects
/// </summary>
/// <param name="entityid">entity ID</param>
/// <param name="effect">effect id</param>
/// <param name="amplifier">effect amplifier</param>
/// <param name="duration">effect duration</param>
/// <param name="flags">effect flags</param>
2022-08-15 23:55:44 +08:00
/// <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 ) ;
2020-07-04 13:45:51 +05:00
/// <summary>
/// Called when coreboardObjective
/// </summary>
/// <param name="objectivename">objective name</param>
/// <param name="mode">0 to create the scoreboard. 1 to remove the scoreboard. 2 to update the display text.</param>
/// <param name="objectivevalue">Only if mode is 0 or 2. The text to be displayed for the score</param>
/// <param name="type">Only if mode is 0 or 2. 0 = "integer", 1 = "hearts".</param>
void OnScoreboardObjective ( string objectivename , byte mode , string objectivevalue , int type ) ;
2022-09-18 00:18:27 +02:00
2020-07-04 13:45:51 +05:00
/// <summary>
/// Called when DisplayScoreboard
/// </summary>
/// <param name="entityname">The entity whose score this is. For players, this is their username; for other entities, it is their UUID.</param>
/// <param name="action">0 to create/update an item. 1 to remove an item.</param>
/// <param name="objectivename">The name of the objective the score belongs to</param>
/// <param name="value">he score to be displayed next to the entry. Only sent when Action does not equal 1.</param>
2022-07-24 22:21:15 +08:00
void OnUpdateScore ( string entityname , int action , string objectivename , int value ) ;
2020-11-08 23:39:07 +01:00
/// <summary>
/// Called when tradeList is received from server
/// </summary>
/// <param name="windowID">Window ID</param>
/// <param name="trades">List of trades.</param>
/// <param name="villagerLevel">The level the villager is.</param>
/// <param name="experience">The amount of experience the villager has.</param>
/// <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 ) ;
2022-08-15 23:55:44 +08:00
/// <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 ) ;
2022-10-03 11:39:25 +08:00
/// <summary>
/// Used for a wide variety of game events, from weather to bed use to gamemode to demo messages.
/// </summary>
/// <param name="reason">Event type</param>
/// <param name="value">Depends on Reason</param>
public void OnGameEvent ( byte reason , float value ) ;
2022-10-08 17:56:32 +08:00
/// <summary>
/// Called when a block is changed.
/// </summary>
/// <param name="location">The location of the block.</param>
/// <param name="block">The block</param>
public void OnBlockChange ( Location location , Block block ) ;
2022-10-12 19:51:01 +02:00
2022-12-06 15:50:17 +08:00
/// <summary>
/// Called when "AutoComplete" completes.
/// </summary>
/// <param name="transactionId">The number of this result.</param>
/// <param name="result">All commands.</param>
public void OnAutoCompleteDone ( int transactionId , string [ ] result ) ;
2023-01-29 22:39:11 +08:00
public void SetCanSendMessage ( bool canSendMessage ) ;
2023-01-16 04:04:56 +08:00
2022-10-12 19:51:01 +02:00
/// <summary>
/// Send a click container button packet to the server.
/// Used for Enchanting table, Lectern, stone cutter and loom
/// </summary>
/// <param name="windowId">Id of the window being clicked</param>
/// <param name="buttonId">Id of the clicked button</param>
/// <returns>True if packet was successfully sent</returns>
bool ClickContainerButton ( int windowId , int buttonId ) ;
2023-06-03 16:12:17 +02:00
/// <summary>
/// Send a rename item packet when the anvil inventory is open and there is an item in the first slot
/// </summary>
/// <param name="itemName">New name (max 50 characters)</param>
/// <returns>True if packet was successfully sent</returns>
bool SendRenameItem ( string itemName ) ;
2014-05-31 01:59:03 +02:00
}
}