mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
Add code documentation, move and rename a few methods
This commit is contained in:
parent
90c6e776e1
commit
195e162c7d
10 changed files with 286 additions and 96 deletions
|
|
@ -641,30 +641,34 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
return false; //Currently not implemented
|
||||
}
|
||||
|
||||
//Currently not implemented
|
||||
public bool SendInteractEntityPacket(int EntityID, int type)
|
||||
{
|
||||
return false;
|
||||
return false; //Currently not implemented
|
||||
}
|
||||
|
||||
public bool SendInteractEntityPacket(int EntityID, int type, float X, float Y, float Z, int hand)
|
||||
{
|
||||
return false;
|
||||
return false; //Currently not implemented
|
||||
}
|
||||
|
||||
public bool SendInteractEntityPacket(int EntityID, int type, float X, float Y, float Z)
|
||||
{
|
||||
return false;
|
||||
return false; //Currently not implemented
|
||||
}
|
||||
|
||||
public bool SendUseItemPacket(int hand)
|
||||
{
|
||||
return false;
|
||||
return false; //Currently not implemented
|
||||
}
|
||||
|
||||
public bool SendPlayerBlockPlacement(int hand, Location location, int face, float CursorX, float CursorY, float CursorZ, bool insideBlock)
|
||||
{
|
||||
return false;
|
||||
return false; //Currently not implemented
|
||||
}
|
||||
|
||||
public bool SendHeldItemChange(short slot)
|
||||
{
|
||||
return false;
|
||||
return false; //Currently not implemented
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -672,7 +676,6 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
/// </summary>
|
||||
/// <param name="channel">Channel to send packet on</param>
|
||||
/// <param name="data">packet Data</param>
|
||||
|
||||
public bool SendPluginChannelPacket(string channel, byte[] data)
|
||||
{
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -589,7 +589,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
short ItemID = dataTypes.ReadNextShort(packetData);
|
||||
if (ItemID == -1)
|
||||
{
|
||||
handler.OnSetSlot(WindowID, SlotID, false);
|
||||
handler.OnSlotClear(WindowID, SlotID);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -601,7 +601,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
{
|
||||
NBT = dataTypes.ReadNextNbt(packetData);
|
||||
}
|
||||
handler.OnSetSlot(WindowID, SlotID, true, ItemID, Count, NBT);
|
||||
handler.OnSetSlot(WindowID, SlotID, ItemID, Count, NBT);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -615,11 +615,11 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
int ItemID = dataTypes.ReadNextVarInt(packetData);
|
||||
byte Count = dataTypes.ReadNextByte(packetData);
|
||||
Dictionary<string, object> NBT = dataTypes.ReadNextNbt(packetData);
|
||||
handler.OnSetSlot(WindowID, SlotID, Present, ItemID, Count, NBT);
|
||||
handler.OnSetSlot(WindowID, SlotID, ItemID, Count, NBT);
|
||||
}
|
||||
else
|
||||
{
|
||||
handler.OnSetSlot(WindowID, SlotID, Present);
|
||||
handler.OnSlotClear(WindowID, SlotID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,14 +85,62 @@ namespace MinecraftClient.Protocol
|
|||
/// <returns>True if message was successfully sent</returns>
|
||||
bool SendPluginChannelPacket(string channel, byte[] data);
|
||||
|
||||
/// <summary>
|
||||
/// Send a held item change packet to the server.
|
||||
/// </summary>
|
||||
/// <param name="slot">New active slot in the inventory hotbar</param>
|
||||
/// <returns>True if packet was successfully sent</returns>
|
||||
bool SendHeldItemChange(short slot);
|
||||
|
||||
/// <summary>
|
||||
/// Send an entity interaction packet to the server.
|
||||
/// </summary>
|
||||
/// <param name="EntityID">Entity ID to interact with</param>
|
||||
/// <param name="type">Type of interaction (0: interact, 1: attack, 2: interact at)</param>
|
||||
/// <returns>True if packet was successfully sent</returns>
|
||||
bool SendInteractEntityPacket(int EntityID, int type);
|
||||
|
||||
/// <summary>
|
||||
/// Send an entity interaction packet to the server.
|
||||
/// </summary>
|
||||
/// <param name="EntityID">Entity ID to interact with</param>
|
||||
/// <param name="type">Type of interaction (0: interact, 1: attack, 2: interact at)</param>
|
||||
/// <param name="X">X coordinate for "interact at"</param>
|
||||
/// <param name="Y">Y coordinate for "interact at"</param>
|
||||
/// <param name="Z">Z coordinate for "interact at"</param>
|
||||
/// <param name="hand">Player hand (0: main hand, 1: off hand)</param>
|
||||
/// <returns>True if packet was successfully sent</returns>
|
||||
bool SendInteractEntityPacket(int EntityID, int type, float X, float Y, float Z, int hand);
|
||||
|
||||
/// <summary>
|
||||
/// Send an entity interaction packet to the server.
|
||||
/// </summary>
|
||||
/// <param name="EntityID">Entity ID to interact with</param>
|
||||
/// <param name="type">Type of interaction (0: interact, 1: attack, 2: interact at)</param>
|
||||
/// <param name="X">X coordinate for "interact at"</param>
|
||||
/// <param name="Y">Y coordinate for "interact at"</param>
|
||||
/// <param name="Z">Z coordinate for "interact at"</param>
|
||||
/// <returns>True if packet was successfully sent</returns>
|
||||
bool SendInteractEntityPacket(int EntityID, int type, float X, float Y, float Z);
|
||||
|
||||
/// <summary>
|
||||
/// Send a use item packet to the server
|
||||
/// </summary>
|
||||
/// <param name="hand">0: main hand, 1: off hand</param>
|
||||
/// <returns>True if packet was successfully sent</returns>
|
||||
bool SendUseItemPacket(int hand);
|
||||
|
||||
/// <summary>
|
||||
/// Send player block placement packet to the server
|
||||
/// </summary>
|
||||
/// <param name="hand">0: main hand, 1: off hand</param>
|
||||
/// <param name="location">Location to place block at</param>
|
||||
/// <param name="face">Block face</param>
|
||||
/// <param name="CursorX">Cursor X</param>
|
||||
/// <param name="CursorY">Cursor Y</param>
|
||||
/// <param name="CursorZ">Cursor Z</param>
|
||||
/// <param name="insideBlock">TRUE if inside block</param>
|
||||
/// <returns>True if packet was successfully sent</returns>
|
||||
bool SendPlayerBlockPlacement(int hand, Location location, int face, float CursorX, float CursorY, float CursorZ, bool insideBlock);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,27 +128,102 @@ namespace MinecraftClient.Protocol
|
|||
/// <param name="data">The data from the channel</param>
|
||||
void OnPluginChannelMessage(string channel, byte[] data);
|
||||
|
||||
/// <summary>
|
||||
/// Called when a non-living entity has spawned
|
||||
/// </summary>
|
||||
/// <param name="EntityID">Entity ID</param>
|
||||
/// <param name="EntityType">Entity Type ID</param>
|
||||
/// <param name="UUID">Entity UUID</param>
|
||||
/// <param name="location">Entity location</param>
|
||||
void OnSpawnEntity(int EntityID, int EntityType, Guid UUID, Location location);
|
||||
|
||||
/// <summary>
|
||||
/// Called when a living entity has spawned
|
||||
/// </summary>
|
||||
/// <param name="EntityID">Entity ID</param>
|
||||
/// <param name="EntityType">Entity Type ID</param>
|
||||
/// <param name="UUID">Entity UUID</param>
|
||||
/// <param name="location">Entity location</param>
|
||||
void OnSpawnLivingEntity(int EntityID, int EntityType, Guid UUID, Location location);
|
||||
|
||||
/// <summary>
|
||||
/// Called when a player has spawned
|
||||
/// </summary>
|
||||
/// <param name="EntityID">Entity ID</param>
|
||||
/// <param name="UUID">Entity UUID</param>
|
||||
/// <param name="location">Entity location</param>
|
||||
/// <param name="Yaw">Player head yaw</param>
|
||||
/// <param name="Pitch">Player head pitch</param>
|
||||
void OnSpawnPlayer(int EntityID, Guid UUID, Location location, byte Yaw, byte Pitch);
|
||||
|
||||
/// <summary>
|
||||
/// Called when entities have despawned
|
||||
/// </summary>
|
||||
/// <param name="EntityID">List of Entity ID that have despawned</param>
|
||||
void OnDestroyEntities(int[] EntityID);
|
||||
|
||||
/// <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>
|
||||
void OnEntityPosition(int EntityID, Double Dx, Double Dy, Double Dz,bool onGround);
|
||||
|
||||
void OnEntityProperties(int EntityID, Dictionary<string, Double> prop);
|
||||
|
||||
void OnTimeUpdate(long WorldAge, long TimeOfDay);
|
||||
|
||||
/// <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>
|
||||
void OnEntityTeleport(int EntityID, Double X, Double Y, Double Z, bool onGround);
|
||||
|
||||
/// <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>
|
||||
void OnEntityProperties(int EntityID, Dictionary<string, Double> prop);
|
||||
|
||||
/// <summary>
|
||||
/// Called when the world age has been updated
|
||||
/// </summary>
|
||||
/// <param name="WorldAge">World age</param>
|
||||
/// <param name="TimeOfDay">Time of Day</param>
|
||||
void OnTimeUpdate(long WorldAge, long TimeOfDay);
|
||||
|
||||
/// <summary>
|
||||
/// Called when inventory items have been received
|
||||
/// </summary>
|
||||
/// <param name="type">Inventory type</param>
|
||||
/// <param name="itemList">Item list</param>
|
||||
void OnWindowItems(int type, Dictionary<int, MinecraftClient.Inventory.Item> itemList);
|
||||
|
||||
void OnSetSlot(byte WindowID, short SlotID, bool Present);
|
||||
void OnSetSlot(byte WindowID, short SlotID, bool Present, int ItemID, byte Count, Dictionary<string, object> NBT);
|
||||
/// <summary>
|
||||
/// Called when a single slot has been cleared inside an inventory
|
||||
/// </summary>
|
||||
/// <param name="WindowID">Inventory ID</param>
|
||||
/// <param name="SlotID">Slot ID</param>
|
||||
void OnSlotClear(byte WindowID, short SlotID);
|
||||
|
||||
/// <summary>
|
||||
/// Called when a single slot has been updated inside an inventory
|
||||
/// </summary>
|
||||
/// <param name="WindowID">Inventory ID</param>
|
||||
/// <param name="SlotID">Slot ID</param>
|
||||
/// <param name="ItemID">Item ID</param>
|
||||
/// <param name="Count">Item Count</param>
|
||||
/// <param name="NBT">Item Metadata</param>
|
||||
void OnSetSlot(byte WindowID, short SlotID, int ItemID, byte Count, Dictionary<string, object> NBT);
|
||||
|
||||
/// <summary>
|
||||
/// Called when the Player entity ID has been received from the server
|
||||
/// </summary>
|
||||
/// <param name="EntityID">Player entity ID</param>
|
||||
void SetPlayerEntityID(int EntityID);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue