public void SetSlot(Item i, int slot) { McpeContainerSetSlot sendSlot = McpeContainerSetSlot.CreateObject(); sendSlot.windowId = 0; sendSlot.slot = slot; sendSlot.item = i; SendPackage(sendSlot); McpeMobEquipment order = McpeMobEquipment.CreateObject(); order.runtimeEntityId = EntityManager.EntityIdSelf; order.item = i; order.selectedSlot = (byte)slot; // Selected hotbar slot order.slot = (byte)slot; SendPackage(order); }
public void SendSetSlot(int slot) { if (slot < HotbarSize && (ItemHotbar[slot] == -1 || ItemHotbar[slot] == slot)) { ItemHotbar[slot] = slot /* + HotbarSize*/; Player.SendPlayerInventory(); McpeMobEquipment order = McpeMobEquipment.CreateObject(); order.runtimeEntityId = EntityManager.EntityIdSelf; order.item = GetItemInHand(); order.selectedSlot = (byte)slot; // Selected hotbar slot Player.SendPackage(order); } else { McpeContainerSetSlot sendSlot = McpeContainerSetSlot.CreateObject(); sendSlot.windowId = 0; sendSlot.slot = (short)slot; sendSlot.item = Slots[slot]; Player.SendPackage(sendSlot); } }