How to get inventory slot id of itemstack

Discussion in 'Plugin Development' started by AntoCrasher, Jan 20, 2021.

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

    AntoCrasher

    I am trying to make it so that every time I take damage I need to get the index of an itemstack so. that I can use it to do stuff like:

    Inventory.setItem(index);

    How could I do that?
     
  2. Offline

    Strahan

    If armor/off hand isn't a possibility, you can use PlayerInventory#first to get the slot holding an ItemStack or Material.

    Failing that, loop the inv and check if the slot has the ItemStack/Material you need.
     
Thread Status:
Not open for further replies.

Share This Page