Complete inventory shift click

Complete item stacking mechanism for left click
This commit is contained in:
ReinforceZwei 2020-07-21 16:22:45 +08:00 committed by ORelio
parent a6e6668fe0
commit 9137fa59e7
5 changed files with 180 additions and 27 deletions

View file

@ -172,5 +172,19 @@ namespace MinecraftClient.Inventory
}
return result.ToArray();
}
public int[] GetEmpytSlot()
{
List<int> result = new List<int>();
for (int i = 0; i < Type.SlotCount(); i++)
{
result.Add(i);
}
foreach (var item in Items)
{
result.Remove(item.Key);
}
return result.ToArray();
}
}
}

View file

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MinecraftClient.Inventory
{
public static class ContainerTypeExtensions
{
public static int SlotCount(this ContainerType c)
{
switch (c)
{
case ContainerType.PlayerInventory: return 44;
case ContainerType.Generic_9x3: return 62;
case ContainerType.Generic_9x6: return 89;
case ContainerType.Generic_3x3: return 44;
case ContainerType.Crafting: return 45;
case ContainerType.BlastFurnace: return 38;
case ContainerType.Furnace: return 38;
case ContainerType.Smoker: return 38;
case ContainerType.Enchantment: return 37;
case ContainerType.BrewingStand: return 40;
case ContainerType.Merchant: return 38;
case ContainerType.Beacon: return 36;
case ContainerType.Anvil: return 38;
case ContainerType.Hopper: return 40;
case ContainerType.ShulkerBox: return 62;
case ContainerType.Loom: return 39;
case ContainerType.Stonecutter: return 37;
case ContainerType.Lectern: return 36;
case ContainerType.Cartography: return 38;
case ContainerType.Grindstone: return 38;
case ContainerType.Unknown: return 0;
default: return 0;
}
}
}
}