mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Support for shift-clicking in containers
Support for shift-clicking in containers
This commit is contained in:
commit
5181395bbd
8 changed files with 763 additions and 302 deletions
|
|
@ -741,7 +741,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
/// </summary>
|
||||
/// <param name="nbt">Dictionary to encode as Nbt</param>
|
||||
/// <returns>Byte array for this NBT tag</returns>
|
||||
public byte[] GetNbt(Dictionary<string, object> nbt)
|
||||
public byte[] GetNbt(Dictionary<string, object>? nbt)
|
||||
{
|
||||
return GetNbt(nbt, true);
|
||||
}
|
||||
|
|
@ -752,7 +752,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
/// <param name="nbt">Dictionary to encode as Nbt</param>
|
||||
/// <param name="root">TRUE if starting a new NBT tag, FALSE if processing a nested NBT tag</param>
|
||||
/// <returns>Byte array for this NBT tag</returns>
|
||||
private byte[] GetNbt(Dictionary<string, object> nbt, bool root)
|
||||
private byte[] GetNbt(Dictionary<string, object>? nbt, bool root)
|
||||
{
|
||||
if (nbt == null || nbt.Count == 0)
|
||||
return new byte[] { 0 }; // TAG_End
|
||||
|
|
@ -1065,9 +1065,9 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
/// <param name="item">Item</param>
|
||||
/// <param name="itemPalette">Item Palette</param>
|
||||
/// <returns>Item slot representation</returns>
|
||||
public byte[] GetItemSlot(Item item, ItemPalette itemPalette)
|
||||
public byte[] GetItemSlot(Item? item, ItemPalette itemPalette)
|
||||
{
|
||||
List<byte> slotData = new List<byte>();
|
||||
List<byte> slotData = new();
|
||||
if (protocolversion > Protocol18Handler.MC_1_13_Version)
|
||||
{
|
||||
// MC 1.13 and greater
|
||||
|
|
|
|||
|
|
@ -752,7 +752,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
return false; //Currently not implemented
|
||||
}
|
||||
|
||||
public bool SendWindowAction(int windowId, int slotId, WindowActionType action, Item item, List<Tuple<short, Item>> changedSlots, int stateId)
|
||||
public bool SendWindowAction(int windowId, int slotId, WindowActionType action, Item? item, List<Tuple<short, Item?>> changedSlots, int stateId)
|
||||
{
|
||||
return false; //Currently not implemented
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2633,7 +2633,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
catch (ObjectDisposedException) { return false; }
|
||||
}
|
||||
|
||||
public bool SendWindowAction(int windowId, int slotId, WindowActionType action, Item item, List<Tuple<short, Item>> changedSlots, int stateId)
|
||||
public bool SendWindowAction(int windowId, int slotId, WindowActionType action, Item? item, List<Tuple<short, Item?>> changedSlots, int stateId)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -2668,7 +2668,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case WindowActionType.AddDragMiddle: button = 9; mode = 5; item = new Item(ItemType.Null, 0, null); break;
|
||||
}
|
||||
|
||||
List<byte> packet = new List<byte>();
|
||||
List<byte> packet = new();
|
||||
packet.Add((byte)windowId); // Window ID
|
||||
|
||||
// 1.18+
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ namespace MinecraftClient.Protocol
|
|||
/// <param name="changedSlots">Slots that have been changed in this event: List<SlotID, Changed Items> </param>
|
||||
/// <param name="stateId">Inventory's stateId</param>
|
||||
/// <returns>True if packet was successfully sent</returns>
|
||||
bool SendWindowAction(int windowId, int slotId, WindowActionType action, Item item, List<Tuple<short, Item>> changedSlots, int stateId);
|
||||
bool SendWindowAction(int windowId, int slotId, WindowActionType action, Item? item, List<Tuple<short, Item?>> changedSlots, int stateId);
|
||||
|
||||
/// <summary>
|
||||
/// Request Creative Mode item creation into regular/survival Player Inventory
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ namespace MinecraftClient.Protocol
|
|||
bool GetNetworkPacketCaptureEnabled();
|
||||
void SetNetworkPacketCaptureEnabled(bool enabled);
|
||||
int GetProtocolVersion();
|
||||
Container GetInventory(int inventoryID);
|
||||
Container? GetInventory(int inventoryID);
|
||||
ILogger GetLogger();
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue