Class RoundRobinInventory

java.lang.Object
net.neoforged.neoforge.items.ItemStackHandler
top.girlkisser.lazuli.api.inventory.RoundRobinInventory
All Implemented Interfaces:
net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>, net.neoforged.neoforge.items.IItemHandler, net.neoforged.neoforge.items.IItemHandlerModifiable

@ParametersAreNonnullByDefault public class RoundRobinInventory extends net.neoforged.neoforge.items.ItemStackHandler
An inventory that inserts items round-robin into the inventory.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
    The next index to insert an item into.

    Fields inherited from class net.neoforged.neoforge.items.ItemStackHandler

    stacks
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a round-robin inventory with a size of 1.
    Creates a round-robin inventory with the given size.
    RoundRobinInventory(net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> stacks)
    Creates a round-robin inventory with the given stacks.
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.world.item.ItemStack
    insertItem(int ignoredSlot, net.minecraft.world.item.ItemStack stack, boolean simulate)
    You should use insertItem(ItemStack, boolean) instead since the ignoredSlot parameter is ignored.
    net.minecraft.world.item.ItemStack
    insertItem(net.minecraft.world.item.ItemStack stack, boolean simulate)
    Inserts an item into the inventory.

    Methods inherited from class net.neoforged.neoforge.items.ItemStackHandler

    deserializeNBT, extractItem, getSlotLimit, getSlots, getStackInSlot, getStackLimit, isItemValid, onContentsChanged, onLoad, serializeNBT, setSize, setStackInSlot, validateSlotIndex

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • index

      protected int index
      The next index to insert an item into.
  • Constructor Details

    • RoundRobinInventory

      public RoundRobinInventory()
      Creates a round-robin inventory with a size of 1.
    • RoundRobinInventory

      public RoundRobinInventory(int size)
      Creates a round-robin inventory with the given size.
      Parameters:
      size - The size.
    • RoundRobinInventory

      public RoundRobinInventory(net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> stacks)
      Creates a round-robin inventory with the given stacks.
      Parameters:
      stacks - The stacks.
  • Method Details

    • insertItem

      @Obsolete public net.minecraft.world.item.ItemStack insertItem(int ignoredSlot, net.minecraft.world.item.ItemStack stack, boolean simulate)
      You should use insertItem(ItemStack, boolean) instead since the ignoredSlot parameter is ignored.
      Specified by:
      insertItem in interface net.neoforged.neoforge.items.IItemHandler
      Overrides:
      insertItem in class net.neoforged.neoforge.items.ItemStackHandler
    • insertItem

      public net.minecraft.world.item.ItemStack insertItem(net.minecraft.world.item.ItemStack stack, boolean simulate)
      Inserts an item into the inventory.
      Parameters:
      stack - The stack to insert.
      simulate - If this action should be simulated or not.
      Returns:
      The remainder item stack, if any.