mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Add Window Confirmation
This commit is contained in:
parent
83b8c65e50
commit
beebe506d1
4 changed files with 45 additions and 0 deletions
|
|
@ -695,6 +695,18 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
handler.OnSetSlot(windowID, slotID, item);
|
||||
}
|
||||
break;
|
||||
case PacketIncomingType.WindowConfirmation:
|
||||
if (handler.GetInventoryEnabled())
|
||||
{
|
||||
byte windowID = dataTypes.ReadNextByte(packetData);
|
||||
short actionID = dataTypes.ReadNextShort(packetData);
|
||||
bool accepted = dataTypes.ReadNextBool(packetData);
|
||||
if (!accepted)
|
||||
{
|
||||
SendWindowConfirmation(windowID, actionID, accepted);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PacketIncomingType.ResourcePackSend:
|
||||
string url = dataTypes.ReadNextString(packetData);
|
||||
string hash = dataTypes.ReadNextString(packetData);
|
||||
|
|
@ -1729,5 +1741,21 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
}
|
||||
else { return false; }
|
||||
}
|
||||
|
||||
public bool SendWindowConfirmation(byte windowID, short actionID, bool accepted)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<byte> packet = new List<byte>();
|
||||
packet.Add(windowID);
|
||||
packet.AddRange(dataTypes.GetShort(actionID));
|
||||
packet.Add(accepted ? (byte)1 : (byte)0);
|
||||
SendPacket(PacketOutgoingType.WindowConfirmation, packet);
|
||||
return true;
|
||||
}
|
||||
catch (SocketException) { return false; }
|
||||
catch (System.IO.IOException) { return false; }
|
||||
catch (ObjectDisposedException) { return false; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue