mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Add GetShort() method in dataTypes
This commit is contained in:
parent
311815be9f
commit
137855a71d
4 changed files with 14 additions and 6 deletions
|
|
@ -412,6 +412,18 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
return bytes.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get byte array representing a short
|
||||
/// </summary>
|
||||
/// <param name="number">Short to process</param>
|
||||
/// <returns>Array ready to send</returns>
|
||||
public byte[] GetShort(short number)
|
||||
{
|
||||
byte[] theShort = BitConverter.GetBytes(number);
|
||||
Array.Reverse(theShort);
|
||||
return theShort;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get byte array representing a double
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -1366,10 +1366,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
try
|
||||
{
|
||||
List<byte> packet = new List<byte>();
|
||||
// short to byte (?
|
||||
byte[] b = BitConverter.GetBytes(slot);
|
||||
Array.Reverse(b);
|
||||
packet.AddRange(b);
|
||||
packet.AddRange(dataTypes.GetShort(slot));
|
||||
SendPacket(PacketOutgoingType.HeldItemChange, packet);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue