/**
* Gets the slot of the given item through iteration.
*
* @param player The inventory to iterate through.
* @param item The ItemStack to check for.
* @return The found slot in the inventory.
*/
public static int getItemSlot(PlayerInventory inventory, ItemStack item)
{
int slot = 0;
ItemStack[] contents = inventory.getContents();
for(int i = 0; i < contents.length; i++)
{
ItemStack current = contents[i];
if(current == null)
{
continue;
}
if(current.equals(item))
{
slot = i;
break;
}
}
return slot;
}
JavaUtils.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:StaffPlus
作者:
评论列表
文章目录