Fix SetSlot (#1144)

* Fix SetSlot - Pull request no #1217
This commit is contained in:
ReinforceZwei 2020-08-18 18:57:56 +08:00 committed by GitHub
parent d8afda34fb
commit 2fd610aa65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1720,14 +1720,20 @@ namespace MinecraftClient
/// <param name="item">Item (may be null for empty slot)</param>
public void OnSetSlot(byte inventoryID, short slotID, Item item)
{
// Handle inventoryID -2 - Add item to player inventory without animation
if (inventoryID == 254)
inventoryID = 0;
// Handle cursor item
if (inventoryID == 255 && slotID == -1)
{
if (inventories.ContainsKey(0))
{
if (item != null)
inventories[0].Items[-1] = item;
else
inventories[0].Items.Remove(-1);
}
}
else
{
if (inventories.ContainsKey(inventoryID))