org.bukkit.inventory.Inventory.firstEmpty()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中org.bukkit.inventory.Inventory.firstEmpty()方法的一些代码示例,展示了Inventory.firstEmpty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Inventory.firstEmpty()方法的具体详情如下:
包路径:org.bukkit.inventory.Inventory
类名称:Inventory
方法名:firstEmpty

Inventory.firstEmpty介绍

[英]Returns the first empty Slot.
[中]返回第一个空插槽。

代码示例

代码示例来源:origin: catageek/ByteCart

@Override
public boolean isEmpty() {
  return this.inventory.firstEmpty() == 0;
}

代码示例来源:origin: bergerkiller/BKCommonLib

@Override
public int firstEmpty() {
  return base.firstEmpty();
}

代码示例来源:origin: bergerkiller/BKCommonLib

@Override
public int firstEmpty() {
  return base.firstEmpty();
}

代码示例来源:origin: me.lucko/helper

public int getFirstEmpty() {
  int ret = this.inventory.firstEmpty();
  if (ret < 0) {
    throw new IndexOutOfBoundsException("no empty slots");
  }
  return ret;
}

代码示例来源:origin: lucko/helper

public int getFirstEmpty() {
  int ret = this.inventory.firstEmpty();
  if (ret < 0) {
    throw new IndexOutOfBoundsException("no empty slots");
  }
  return ret;
}

代码示例来源:origin: lucko/helper

public Optional<Slot> getFirstEmptySlot() {
  int ret = this.inventory.firstEmpty();
  if (ret < 0) {
    return Optional.empty();
  }
  return Optional.of(getSlot(ret));
}

代码示例来源:origin: me.lucko/helper

public Optional<Slot> getFirstEmptySlot() {
  int ret = this.inventory.firstEmpty();
  if (ret < 0) {
    return Optional.empty();
  }
  return Optional.of(getSlot(ret));
}

代码示例来源:origin: zDevelopers/ImageOnMap

static public int giveCache(Player player)
{
  Queue<ItemStack> cache = getCache(player);
  Inventory inventory = player.getInventory();
  int givenItemsCount = 0;
  
  while(inventory.firstEmpty() >= 0 && !cache.isEmpty())
  {
    inventory.addItem(cache.poll());
    givenItemsCount++;
  }
  
  return givenItemsCount;
}

代码示例来源:origin: catageek/ByteCart

int slot = inv.firstEmpty();

代码示例来源:origin: ProSavage/SavageFactions

actionSlots.put(slot, action);
} else {
  int slot = actionGUI.firstEmpty();
  if (slot != - 1) {
    actionSlots.put(slot, action);

代码示例来源:origin: BuycraftPlugin/BuycraftX

inventory.setItem(inventory.firstEmpty(), withName(material, ChatColor.YELLOW + category.getName(), variant));

代码示例来源:origin: eccentricdevotion/TARDIS

jim.setDisplayName(flavour + " Jelly Baby");
jb.setItemMeta(jim);
int slot = inv.firstEmpty();
if (slot != -1) {

代码示例来源:origin: eccentricdevotion/TARDIS

if (cinv.firstEmpty() != -1) {
  ItemStack[] cc = cinv.getContents();
  List<Material> mats = new ArrayList<>();
    while (slot != -1 && cinv.firstEmpty() != -1) {
      cinv.setItem(cinv.firstEmpty(), get);

代码示例来源:origin: Co0sh/BetonQuest

if (inventory.firstEmpty() >= 0) {
  ItemStack oldItem = inventory.getItem(slot);
  inventory.setItem(slot, item);

代码示例来源:origin: TheBusyBiscuit/Slimefun4

else if (SlimefunStartup.chance(100, 25)) adding = SlimefunItems.SILVER_DUST;
if (inv.firstEmpty() != -1 || (legacy_ore_washer && InvUtils.fits(inv, adding))) {
  ItemStack removing = current.clone();
  removing.setAmount(1);

相关文章