Improve documentation, fix file encoding (#1026)

This commit is contained in:
ORelio 2020-05-26 11:20:12 +02:00
parent 87b2d3bf4a
commit efb49fd05d
5 changed files with 3037 additions and 3022 deletions

View file

@ -660,15 +660,6 @@ namespace MinecraftClient
return Handler.GetEntityHandlingEnabled(); return Handler.GetEntityHandlingEnabled();
} }
public bool GetInventoryEnabled()
{
return Handler.GetInventoryEnabled();
}
public Dictionary<int, Container> GetInventories()
{
return Handler.GetInventories();
}
/// <summary> /// <summary>
/// start Sneaking /// start Sneaking
/// </summary> /// </summary>
@ -900,10 +891,10 @@ namespace MinecraftClient
} }
/// <summary> /// <summary>
/// Plays animation /// Plays animation (Player arm swing)
/// </summary> /// </summary>
/// <param name="animation"> <0|1></param> /// <param name="animation">0 for left arm, 1 for right arm</param>
/// <returns>TRUE animation done</returns> /// <returns>TRUE if animation successfully done</returns>
protected bool SendAnimation(int animation) protected bool SendAnimation(int animation)
{ {
return Handler.DoAnimation(animation); return Handler.DoAnimation(animation);
@ -919,7 +910,16 @@ namespace MinecraftClient
} }
/// <summary> /// <summary>
/// Get a copy of the player's inventory /// Check inventory handling enable status
/// </summary>
/// <returns></returns>
public bool GetInventoryEnabled()
{
return Handler.GetInventoryEnabled();
}
/// <summary>
/// Get the player's inventory. Do not write to it, will not have any effect server-side.
/// </summary> /// </summary>
/// <returns>Player inventory</returns> /// <returns>Player inventory</returns>
protected Container GetPlayerInventory() protected Container GetPlayerInventory()
@ -929,15 +929,28 @@ namespace MinecraftClient
} }
/// <summary> /// <summary>
/// Change player selected hotbar /// Get all inventories, player and container(s). Do not write to them. Will not have any effect server-side.
/// </summary> /// </summary>
/// <param name="slot"></param> /// <returns>All inventories</returns>
public Dictionary<int, Container> GetInventories()
{
return Handler.GetInventories();
}
/// <summary>
/// Change player selected hotbar slot
/// </summary>
/// <param name="slot">0-8</param>
/// <returns>True if success</returns> /// <returns>True if success</returns>
protected bool ChangeSlot(short slot) protected bool ChangeSlot(short slot)
{ {
return Handler.ChangeSlot(slot); return Handler.ChangeSlot(slot);
} }
/// <summary>
/// Get current player selected hotbar slot
/// </summary>
/// <returns>0-8</returns>
protected byte GetCurrentSlot() protected byte GetCurrentSlot()
{ {
return Handler.GetCurrentSlot(); return Handler.GetCurrentSlot();

View file

@ -8,7 +8,7 @@ namespace MinecraftClient.Commands
public class Animation : Command public class Animation : Command
{ {
public override string CMDName { get { return "animation"; } } public override string CMDName { get { return "animation"; } }
public override string CMDDesc { get { return "animation <<mainhand|offhand>|<0|1>>"; } } public override string CMDDesc { get { return "animation <mainhand|offhand>"; } }
public override string Run(McTcpClient handler, string command, Dictionary<string, object> localVars) public override string Run(McTcpClient handler, string command, Dictionary<string, object> localVars)
{ {

View file

@ -1484,10 +1484,10 @@ namespace MinecraftClient
} }
/// <summary> /// <summary>
/// Plays animation /// Plays animation (Player arm swing)
/// </summary> /// </summary>
/// <param name="animation"> <0|1></param> /// <param name="animation">0 for left arm, 1 for right arm</param>
/// <returns>TRUE if item given successfully</returns> /// <returns>TRUE if animation successfully done</returns>
public bool DoAnimation(int animation) public bool DoAnimation(int animation)
{ {
return handler.SendAnimation(animation); return handler.SendAnimation(animation);

View file

@ -692,10 +692,12 @@ namespace MinecraftClient.Protocol.Handlers
{ {
return false; //Currently not implemented return false; //Currently not implemented
} }
public bool SendAnimation(int animation) public bool SendAnimation(int animation)
{ {
return false; //Currently not implemented return false; //Currently not implemented
} }
public bool SendCreativeInventoryAction(int slot, ItemType item, int count) public bool SendCreativeInventoryAction(int slot, ItemType item, int count)
{ {
return false; //Currently not implemented return false; //Currently not implemented

View file

@ -722,8 +722,8 @@ namespace MinecraftClient.Protocol.Handlers
} }
catch (Exception innerException) catch (Exception innerException)
{ {
if (innerException is SocketException || innerException.InnerException is SocketException) if (innerException is ThreadAbortException || innerException is SocketException || innerException.InnerException is SocketException)
throw; //Connection lost rather than invalid data throw; //Thread abort or Connection lost rather than invalid data
throw new System.IO.InvalidDataException( throw new System.IO.InvalidDataException(
String.Format("Failed to process incoming packet of type {0}. (PacketID: {1}, Protocol: {2}, LoginPhase: {3}, InnerException: {4}).", String.Format("Failed to process incoming packet of type {0}. (PacketID: {1}, Protocol: {2}, LoginPhase: {3}, InnerException: {4}).",
Protocol18PacketTypes.GetPacketIncomingType(packetID, protocolversion), Protocol18PacketTypes.GetPacketIncomingType(packetID, protocolversion),
@ -762,7 +762,7 @@ namespace MinecraftClient.Protocol.Handlers
} }
/// <summary> /// <summary>
/// Send a packet to the server. Packet ID, compression, and encryption will be handled automatically. /// Send a packet to the server. Packet ID, compression, and encryption will be handled automatically.
/// </summary> /// </summary>
/// <param name="packet">packet type</param> /// <param name="packet">packet type</param>
/// <param name="packetData">packet Data</param> /// <param name="packetData">packet Data</param>
@ -772,7 +772,7 @@ namespace MinecraftClient.Protocol.Handlers
} }
/// <summary> /// <summary>
/// Send a packet to the server. Compression and encryption will be handled automatically. /// Send a packet to the server. Compression and encryption will be handled automatically.
/// </summary> /// </summary>
/// <param name="packetID">packet ID</param> /// <param name="packetID">packet ID</param>
/// <param name="packetData">packet Data</param> /// <param name="packetData">packet Data</param>