using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MinecraftClient.Mapping;
using MinecraftClient.Inventory;
namespace MinecraftClient.Protocol
{
///
/// 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.
///
public interface IMinecraftComHandler
{
/* The MinecraftCom Handler must
* provide these getters */
int GetServerPort();
string GetServerHost();
string GetUsername();
string GetUserUUID();
string GetSessionID();
string[] GetOnlinePlayers();
Dictionary GetOnlinePlayersWithUUID();
Location GetCurrentLocation();
World GetWorld();
bool GetTerrainEnabled();
bool SetTerrainEnabled(bool enabled);
bool GetInventoryEnabled();
bool SetInventoryEnabled(bool enabled);
bool GetEntityHandlingEnabled();
bool SetEntityHandlingEnabled(bool enabled);
Container GetInventory(int inventoryID);
///
/// Called when a server was successfully joined
///
void OnGameJoined();
///
/// This method is called when the protocol handler receives a chat message
///
/// Text received from the server
/// TRUE if the text is JSON-Encoded
void OnTextReceived(string text, bool isJson);
///
/// Called when receiving a connection keep-alive from the server
///
void OnServerKeepAlive();
///
/// Called when an inventory is opened
///
void OnInventoryOpen(int inventoryID, Container inventory);
///
/// Called when an inventory is closed
///
void OnInventoryClose(int inventoryID);
///
/// Called when the player respawns, which happens on login, respawn and world change.
///
void OnRespawn();
///
/// This method is called when a new player joins the game
///
/// UUID of the player
/// Name of the player
void OnPlayerJoin(Guid uuid, string name);
///
/// This method is called when a player has left the game
///
/// UUID of the player
void OnPlayerLeave(Guid uuid);
///
/// Called when the server sets the new location for the player
///
/// New location of the player
/// New yaw
/// New pitch
void UpdateLocation(Location location, float yaw, float pitch);
///
/// This method is called when the connection has been lost
///
void OnConnectionLost(ChatBot.DisconnectReason reason, string message);
///
/// Called ~10 times per second (10 ticks per second)
/// Useful for updating bots in other parts of the program
///
void OnUpdate();
///
/// Registers the given plugin channel for the given bot.
///
/// The channel to register.
/// The bot to register the channel for.
void RegisterPluginChannel(string channel, ChatBot bot);
///
/// Unregisters the given plugin channel for the given bot.
///
/// The channel to unregister.
/// The bot to unregister the channel for.
void UnregisterPluginChannel(string channel, ChatBot bot);
///
/// Sends a plugin channel packet to the server.
/// See http://wiki.vg/Plugin_channel for more information about plugin channels.
///
/// The channel to send the packet on.
/// The payload for the packet.
/// Whether the packet should be sent even if the server or the client hasn't registered it yet.
/// Whether the packet was sent: true if it was sent, false if there was a connection error or it wasn't registered.
bool SendPluginChannelMessage(string channel, byte[] data, bool sendEvenIfNotRegistered = false);
///
/// Called when a plugin channel message was sent from the server.
///
/// The channel the message was sent on
/// The data from the channel
void OnPluginChannelMessage(string channel, byte[] data);
///
/// Called when an entity has spawned
///
/// Spawned entity
void OnSpawnEntity(Entity entity);
///
/// Called when a player spawns or enters the client's render distance
///
/// Entity ID
/// Entity UUID
/// Entity location
/// Player head yaw
/// Player head pitch
void OnSpawnPlayer(int entityID, Guid uuid, Location location, byte yaw, byte pitch);
///
/// Called when entities have despawned
///
/// List of Entity ID that have despawned
void OnDestroyEntities(int[] EntityID);
///
/// Called when an entity moved by coordinate offset
///
/// Entity ID
/// X offset
/// Y offset
/// Z offset
/// TRUE if on ground
void OnEntityPosition(int entityID, Double dx, Double dy, Double dz, bool onGround);
///
/// Called when an entity moved to fixed coordinates
///
/// Entity ID
/// X
/// Y
/// Z
/// TRUE if on ground
void OnEntityTeleport(int entityID, Double x, Double y, Double z, bool onGround);
///
/// Called when additional properties have been received for an entity
///
/// Entity ID
/// Dictionary of properties
void OnEntityProperties(int entityID, Dictionary prop);
///
/// Called when the world age has been updated
///
/// World age
/// Time of Day
void OnTimeUpdate(long worldAge, long timeOfDay);
///
/// Called when inventory items have been received
///
/// Inventory ID
/// Item list
void OnWindowItems(byte inventoryID, Dictionary itemList);
///
/// Called when a single slot has been updated inside an inventory
///
/// Window ID
/// Slot ID
/// Item (may be null for empty slot)
void OnSetSlot(byte inventoryID, short slotID, Item item);
///
/// Called when player health or hunger changed.
///
///
///
void OnUpdateHealth(float health, int food);
///
/// Called when and explosion occurs on the server
///
/// Explosion location
/// Explosion strength
/// Amount of affected blocks
void OnExplosion(Location location, float strength, int affectedBlocks);
///
/// Called when a player's game mode has changed
///
/// Affected player's UUID
/// New game mode
void OnGamemodeUpdate(Guid uuid, int gamemode);
///
/// Called when Experience bar is updated
///
/// Experience bar level
/// Player Level
/// Total experience
void OnSetExperience(float Experiencebar, int Level, int TotalExperience);
///
/// Called when client need to change slot.
///
/// Used for setting player slot after joining game
///
void OnHeldItemChange(byte slot);
///
/// Called when the Player entity ID has been received from the server
///
/// Player entity ID
void SetPlayerEntityID(int EntityID);
}
}