Package appeng.api.inventories
Interface InternalInventory
- All Superinterfaces:
ItemTransfer
,Iterable<net.minecraft.world.item.ItemStack>
- All Known Subinterfaces:
IUpgradeInventory
- All Known Implementing Classes:
BaseInternalInventory
,DelegateItemUpgradeInventory
,PlatformInventoryWrapper
,appeng.util.inv.SupplierInternalInventory
public interface InternalInventory
extends Iterable<net.minecraft.world.item.ItemStack>, ItemTransfer
-
Method Summary
Modifier and TypeMethodDescriptiondefault net.minecraft.world.item.ItemStack
addItems
(net.minecraft.world.item.ItemStack stack) Attempts to insert as much of the given item into this inventory as possible.default net.minecraft.world.item.ItemStack
addItems
(net.minecraft.world.item.ItemStack stack, boolean simulate) Attempts to insert as much of the given item into this inventory as possible.default void
clear()
static InternalInventory
empty()
default net.minecraft.world.item.ItemStack
extractItem
(int slot, int amount, boolean simulate) default int
default InternalInventory
getSlotInv
(int slotIndex) default int
getSlotLimit
(int slot) net.minecraft.world.item.ItemStack
getStackInSlot
(int slotIndex) default InternalInventory
getSubInventory
(int fromSlotInclusive, int toSlotExclusive) default net.minecraft.world.item.ItemStack
insertItem
(int slot, net.minecraft.world.item.ItemStack stack, boolean simulate) default boolean
isEmpty()
default boolean
isItemValid
(int slot, net.minecraft.world.item.ItemStack stack) default Iterator
<net.minecraft.world.item.ItemStack> iterator()
default net.minecraft.world.item.ItemStack
removeItems
(int amount, net.minecraft.world.item.ItemStack filter, @Nullable Predicate<net.minecraft.world.item.ItemStack> destination) default net.minecraft.world.item.ItemStack
removeSimilarItems
(int amount, net.minecraft.world.item.ItemStack filter, FuzzyMode fuzzyMode, Predicate<net.minecraft.world.item.ItemStack> destination) For fuzzy extract, we will only ever extract one slot, since we're afraid of merging two item stacks with different damage values.default void
sendChangeNotification
(int slot) Forces a change notification to any listeners for the given slot.void
setItemDirect
(int slotIndex, net.minecraft.world.item.ItemStack stack) Puts the given stack in the given slot and circumvents any potential filters.default net.minecraft.world.item.ItemStack
simulateAdd
(net.minecraft.world.item.ItemStack stack) default net.minecraft.world.item.ItemStack
simulateRemove
(int amount, net.minecraft.world.item.ItemStack filter, Predicate<net.minecraft.world.item.ItemStack> destination) default net.minecraft.world.item.ItemStack
simulateSimilarRemove
(int amount, net.minecraft.world.item.ItemStack filter, FuzzyMode fuzzyMode, Predicate<net.minecraft.world.item.ItemStack> destination) int
size()
default net.minecraft.world.Container
default net.neoforged.neoforge.items.IItemHandler
static @Nullable ItemTransfer
wrapExternal
(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction side) Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
wrapExternal
@Nullable static @Nullable ItemTransfer wrapExternal(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction side) -
empty
-
clear
default void clear() -
isEmpty
default boolean isEmpty() -
toItemHandler
default net.neoforged.neoforge.items.IItemHandler toItemHandler() -
toContainer
default net.minecraft.world.Container toContainer() -
size
int size() -
getSlotLimit
default int getSlotLimit(int slot) -
getStackInSlot
net.minecraft.world.item.ItemStack getStackInSlot(int slotIndex) -
setItemDirect
void setItemDirect(int slotIndex, net.minecraft.world.item.ItemStack stack) Puts the given stack in the given slot and circumvents any potential filters. -
isItemValid
default boolean isItemValid(int slot, net.minecraft.world.item.ItemStack stack) -
getSubInventory
-
getSlotInv
-
getRedstoneSignal
default int getRedstoneSignal()- Returns:
- The redstone signal indicating how full this container is in the [0-15] range.
-
iterator
-
addItems
default net.minecraft.world.item.ItemStack addItems(net.minecraft.world.item.ItemStack stack) Attempts to insert as much of the given item into this inventory as possible.- Specified by:
addItems
in interfaceItemTransfer
- Parameters:
stack
- The stack to insert. Will not be mutated.- Returns:
- The overflow, which can be the same object as stack.
-
simulateAdd
default net.minecraft.world.item.ItemStack simulateAdd(net.minecraft.world.item.ItemStack stack) - Specified by:
simulateAdd
in interfaceItemTransfer
-
addItems
default net.minecraft.world.item.ItemStack addItems(net.minecraft.world.item.ItemStack stack, boolean simulate) Attempts to insert as much of the given item into this inventory as possible.- Specified by:
addItems
in interfaceItemTransfer
- Parameters:
stack
- The stack to insert. Will not be mutated.- Returns:
- The overflow, which can be the same object as stack.
-
removeItems
default net.minecraft.world.item.ItemStack removeItems(int amount, net.minecraft.world.item.ItemStack filter, @Nullable @Nullable Predicate<net.minecraft.world.item.ItemStack> destination) - Specified by:
removeItems
in interfaceItemTransfer
-
simulateRemove
default net.minecraft.world.item.ItemStack simulateRemove(int amount, net.minecraft.world.item.ItemStack filter, Predicate<net.minecraft.world.item.ItemStack> destination) - Specified by:
simulateRemove
in interfaceItemTransfer
-
removeSimilarItems
default net.minecraft.world.item.ItemStack removeSimilarItems(int amount, net.minecraft.world.item.ItemStack filter, FuzzyMode fuzzyMode, Predicate<net.minecraft.world.item.ItemStack> destination) For fuzzy extract, we will only ever extract one slot, since we're afraid of merging two item stacks with different damage values.- Specified by:
removeSimilarItems
in interfaceItemTransfer
-
simulateSimilarRemove
default net.minecraft.world.item.ItemStack simulateSimilarRemove(int amount, net.minecraft.world.item.ItemStack filter, FuzzyMode fuzzyMode, Predicate<net.minecraft.world.item.ItemStack> destination) - Specified by:
simulateSimilarRemove
in interfaceItemTransfer
-
insertItem
default net.minecraft.world.item.ItemStack insertItem(int slot, net.minecraft.world.item.ItemStack stack, boolean simulate) - Returns:
- The overflow
-
extractItem
default net.minecraft.world.item.ItemStack extractItem(int slot, int amount, boolean simulate) -
sendChangeNotification
@Internal default void sendChangeNotification(int slot) Forces a change notification to any listeners for the given slot. For internal use only. This should also cause the inventory to be saved.
-