public abstract class AbstractInvItemTransactor extends java.lang.Object implements IItemTransactor
IItemTransactor
that is backed by a simple, static, array based inventory.IItemTransactor.IItemExtractable, IItemTransactor.IItemInsertable
Constructor and Description |
---|
AbstractInvItemTransactor() |
Modifier and Type | Method and Description |
---|---|
static net.minecraft.item.ItemStack |
asValid(net.minecraft.item.ItemStack stack)
Returns
ItemStack.EMPTY if it was empty, or the input stack if it was not. |
protected abstract net.minecraft.item.ItemStack |
extract(int slot,
IStackFilter filter,
int min,
int max,
boolean simulate) |
net.minecraft.item.ItemStack |
extract(IStackFilter filter,
int min,
int max,
boolean simulate)
Extracts a number of items that match the given filter
|
protected abstract int |
getSlots() |
protected abstract net.minecraft.item.ItemStack |
insert(int slot,
net.minecraft.item.ItemStack stack,
boolean simulate) |
net.minecraft.item.ItemStack |
insert(net.minecraft.item.ItemStack stack,
boolean allAtOnce,
boolean simulate) |
net.minecraft.util.NonNullList<net.minecraft.item.ItemStack> |
insert(net.minecraft.util.NonNullList<net.minecraft.item.ItemStack> stacks,
boolean simulate)
Similar to
IItemTransactor.insert(ItemStack, boolean, boolean) but probably be more efficient at inserting lots of
items. |
protected abstract boolean |
isEmpty(int slot) |
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
canFullyAccept, canPartiallyAccept
@Nonnull public static net.minecraft.item.ItemStack asValid(@Nonnull net.minecraft.item.ItemStack stack)
ItemStack.EMPTY
if it was empty, or the input stack if it was not.@Nonnull protected abstract net.minecraft.item.ItemStack insert(int slot, @Nonnull net.minecraft.item.ItemStack stack, boolean simulate)
@Nonnull protected abstract net.minecraft.item.ItemStack extract(int slot, IStackFilter filter, int min, int max, boolean simulate)
protected abstract int getSlots()
protected abstract boolean isEmpty(int slot)
@Nonnull public net.minecraft.item.ItemStack insert(@Nonnull net.minecraft.item.ItemStack stack, boolean allAtOnce, boolean simulate)
insert
in interface IItemTransactor
stack
- The stack to insert. Must not be null!allAtOnce
- If true then either the entire stack will be used or none of it.simulate
- If true then the in-world state of this will not be changed.ItemStack.EMPTY
if all of it was accepted.public net.minecraft.util.NonNullList<net.minecraft.item.ItemStack> insert(net.minecraft.util.NonNullList<net.minecraft.item.ItemStack> stacks, boolean simulate)
IItemTransactor
IItemTransactor.insert(ItemStack, boolean, boolean)
but probably be more efficient at inserting lots of
items.insert
in interface IItemTransactor
stacks
- The stacks to insert. Must not be null!simulate
- If true then the in-world state of this will not be changed.@Nonnull public net.minecraft.item.ItemStack extract(IStackFilter filter, int min, int max, boolean simulate)
IItemTransactor
extract
in interface IItemTransactor
filter
- The filter that MUST be met by the extracted stack. Null means no filter - it can be any item.min
- The minimum number of items to extract, or 0 if not enough items can be extractedmax
- The maximum number of items to extract.simulate
- If true then the in-world state of this will not be changed.ItemStack.EMPTY
if it could not be.public java.lang.String toString()
toString
in class java.lang.Object