mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Added a command to (re)name items in the Anvil
This commit is contained in:
parent
9855e2e0f1
commit
fce12db33f
8 changed files with 174 additions and 0 deletions
|
|
@ -909,6 +909,11 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
{
|
||||
return false; //Currently not implemented
|
||||
}
|
||||
|
||||
public bool SendRenameItem(string itemName)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool SendPlayerSession(PlayerKeyPair? playerKeyPair)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4150,6 +4150,29 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
}
|
||||
}
|
||||
|
||||
public bool SendRenameItem(string itemName)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<byte> packet = new();
|
||||
packet.AddRange(dataTypes.GetString(itemName.Length > 50 ? itemName[..50] : itemName));
|
||||
SendPacket(PacketTypesOut.NameItem, packet);
|
||||
return true;
|
||||
}
|
||||
catch (SocketException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
catch (System.IO.IOException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
catch (ObjectDisposedException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] GenerateSalt()
|
||||
{
|
||||
byte[] salt = new byte[8];
|
||||
|
|
|
|||
|
|
@ -260,6 +260,12 @@ namespace MinecraftClient.Protocol
|
|||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool SendPlayerSession(PlayerKeyPair? playerKeyPair);
|
||||
|
||||
/// <summary>
|
||||
/// Send the server a command to type in the item name in the Anvil inventory when it's open.
|
||||
/// </summary>
|
||||
/// <param name="itemName">The new item name</param>
|
||||
bool SendRenameItem(string itemName);
|
||||
|
||||
/// <summary>
|
||||
/// Get net read thread (main thread) ID
|
||||
|
|
|
|||
|
|
@ -477,5 +477,13 @@ namespace MinecraftClient.Protocol
|
|||
/// <returns>True if packet was successfully sent</returns>
|
||||
|
||||
bool ClickContainerButton(int windowId, int buttonId);
|
||||
|
||||
/// <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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue