How to get the position of Item of Hand in the Players Inventory?

Discussion in 'Plugin Development' started by Gu3rr1lla, Mar 12, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Gu3rr1lla

    Code:
    PlayerInventory inventory = player.getInventory();
    ItemStack stack = inventory.getItemInHand();
    int stackNum = // how to find position of item? I want to be able to replace it later
     
  2. Offline

    GodzOfMadness

    Gu3rr1lla not sure what you meant but if i am correct to get the index of the held item slot you would
    get the inventory and then use the method getHeldItemSlot() which returns the index of the item slot
     
    Gu3rr1lla likes this.
  3. Offline

    Gu3rr1lla

    That's exactly what I am looking for, thanks!
     
Thread Status:
Not open for further replies.

Share This Page