mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Implemented Enchanting
Implemented Enchanting
This commit is contained in:
commit
12e2c6b4bb
16 changed files with 776 additions and 65 deletions
|
|
@ -770,6 +770,11 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
return false; //Currently not implemented
|
||||
}
|
||||
|
||||
public bool ClickContainerButton(int windowId, int buttonId)
|
||||
{
|
||||
return false; //Currently not implemented
|
||||
}
|
||||
|
||||
public bool SendCloseWindow(int windowId)
|
||||
{
|
||||
return false; //Currently not implemented
|
||||
|
|
|
|||
|
|
@ -1382,6 +1382,13 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
handler.OnWindowItems(windowId, inventorySlots, stateId);
|
||||
}
|
||||
break;
|
||||
case PacketTypesIn.WindowProperty:
|
||||
byte containerId = dataTypes.ReadNextByte(packetData);
|
||||
short propertyId = dataTypes.ReadNextShort(packetData);
|
||||
short propertyValue = dataTypes.ReadNextShort(packetData);
|
||||
|
||||
handler.OnWindowProperties(containerId, propertyId, propertyValue);
|
||||
break;
|
||||
case PacketTypesIn.SetSlot:
|
||||
if (handler.GetInventoryEnabled())
|
||||
{
|
||||
|
|
@ -2835,6 +2842,21 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
catch (ObjectDisposedException) { return false; }
|
||||
}
|
||||
|
||||
public bool ClickContainerButton(int windowId, int buttonId)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<byte> packet = new();
|
||||
packet.Add((byte)windowId);
|
||||
packet.Add((byte)buttonId);
|
||||
SendPacket(PacketTypesOut.ClickWindowButton, packet);
|
||||
return true;
|
||||
}
|
||||
catch (SocketException) { return false; }
|
||||
catch (System.IO.IOException) { return false; }
|
||||
catch (ObjectDisposedException) { return false; }
|
||||
}
|
||||
|
||||
public bool SendAnimation(int animation, int playerid)
|
||||
{
|
||||
try
|
||||
|
|
|
|||
|
|
@ -179,6 +179,16 @@ namespace MinecraftClient.Protocol
|
|||
/// <returns>TRUE if item given successfully</returns>
|
||||
bool SendCreativeInventoryAction(int slot, ItemType itemType, int count, Dictionary<string, object>? nbt);
|
||||
|
||||
/// <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);
|
||||
|
||||
/// <summary>
|
||||
/// Plays animation
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -280,6 +280,15 @@ namespace MinecraftClient.Protocol
|
|||
/// <param name="TimeOfDay">Time of Day</param>
|
||||
void OnTimeUpdate(long worldAge, long timeOfDay);
|
||||
|
||||
/// <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);
|
||||
|
||||
/// <summary>
|
||||
/// Called when inventory items have been received
|
||||
/// </summary>
|
||||
|
|
@ -439,5 +448,15 @@ namespace MinecraftClient.Protocol
|
|||
/// <param name="location">The location of the block.</param>
|
||||
/// <param name="block">The block</param>
|
||||
public void OnBlockChange(Location location, Block block);
|
||||
|
||||
/// <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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue