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
FieldsFields inherited from class net.neoforged.neoforge.items.ItemStackHandler
stacks -
Constructor Summary
ConstructorsConstructorDescriptionCreates a round-robin inventory with a size of 1.RoundRobinInventory(int size) 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 TypeMethodDescriptionnet.minecraft.world.item.ItemStackinsertItem(int ignoredSlot, net.minecraft.world.item.ItemStack stack, boolean simulate) You should useinsertItem(ItemStack, boolean)instead since theignoredSlotparameter is ignored.net.minecraft.world.item.ItemStackinsertItem(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
-
Field Details
-
index
protected int indexThe 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 useinsertItem(ItemStack, boolean)instead since theignoredSlotparameter is ignored.- Specified by:
insertItemin interfacenet.neoforged.neoforge.items.IItemHandler- Overrides:
insertItemin classnet.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.
-