Contents
- Description
- Nested Class Summary
- Field Summary
- Constructor Summary
- Method Summary
- Field Details
- Constructor Details
- Method Details
- getCapacity()
- setGlobalFilter(FilterType)
- setSlotFilter(FilterActionType, short, SlotFilter)
- clone()
- toPacket()
- toProtocolMap()
- registerChangeEvent(Consumer)
- registerChangeEvent(EventPriority, Consumer)
- registerChangeEvent(short, Consumer)
- clear()
- canAddItemStackToSlot(short, ItemStack, boolean, boolean)
- addItemStackToSlot(short, ItemStack)
- addItemStackToSlot(short, ItemStack, boolean, boolean)
- setItemStackForSlot(short, ItemStack)
- setItemStackForSlot(short, ItemStack, boolean)
- getItemStack(short)
- replaceItemStackInSlot(short, ItemStack, ItemStack)
- replaceAll(SlotReplacementFunction)
- removeItemStackFromSlot(short)
- removeItemStackFromSlot(short, boolean)
- removeItemStackFromSlot(short, int)
- removeItemStackFromSlot(short, int, boolean, boolean)
- internal_removeItemStack(short, int)
- removeItemStackFromSlot(short, ItemStack, int)
- removeItemStackFromSlot(short, ItemStack, int, boolean, boolean)
- removeMaterialFromSlot(short, MaterialQuantity)
- removeMaterialFromSlot(short, MaterialQuantity, boolean, boolean, boolean)
- removeResourceFromSlot(short, ResourceQuantity)
- removeResourceFromSlot(short, ResourceQuantity, boolean, boolean, boolean)
- removeTagFromSlot(short, int, int)
- removeTagFromSlot(short, int, int, boolean, boolean)
- moveItemStackFromSlot(short, ItemContainer)
- moveItemStackFromSlot(short, ItemContainer, boolean)
- moveItemStackFromSlot(short, ItemContainer, boolean, boolean)
- moveItemStackFromSlot(short, int, ItemContainer)
- moveItemStackFromSlot(short, int, ItemContainer, boolean, boolean)
- moveItemStackFromSlot(short, ItemContainer...)
- moveItemStackFromSlot(short, boolean, boolean, ItemContainer...)
- moveItemStackFromSlot(short, int, ItemContainer...)
- moveItemStackFromSlot(short, int, boolean, boolean, ItemContainer...)
- moveItemStackFromSlotToSlot(short, int, ItemContainer, short)
- moveItemStackFromSlotToSlot(short, int, ItemContainer, short, boolean)
- moveAllItemStacksTo(ItemContainer...)
- moveAllItemStacksTo(Predicate, ItemContainer...)
- quickStackTo(ItemContainer...)
- combineItemStacksIntoSlot(ItemContainer, short)
- swapItems(short, ItemContainer, short, short)
- canAddItemStack(ItemStack)
- canAddItemStack(ItemStack, boolean, boolean)
- addItemStack(ItemStack)
- addItemStack(ItemStack, boolean, boolean, boolean)
- canAddItemStacks(List)
- canAddItemStacks(List, boolean, boolean)
- addItemStacks(List)
- addItemStacks(List, boolean, boolean, boolean)
- addItemStacksOrdered(List)
- addItemStacksOrdered(short, List)
- addItemStacksOrdered(List, boolean, boolean)
- addItemStacksOrdered(short, List, boolean, boolean)
- canRemoveItemStack(ItemStack)
- canRemoveItemStack(ItemStack, boolean, boolean)
- removeItemStack(ItemStack)
- removeItemStack(ItemStack, boolean, boolean)
- canRemoveItemStacks(List)
- canRemoveItemStacks(List, boolean, boolean)
- removeItemStacks(List)
- removeItemStacks(List, boolean, boolean)
- canRemoveTag(int, int)
- canRemoveTag(int, int, boolean, boolean)
- removeTag(int, int)
- removeTag(int, int, boolean, boolean, boolean)
- canRemoveResource(ResourceQuantity)
- canRemoveResource(ResourceQuantity, boolean, boolean)
- removeResource(ResourceQuantity)
- removeResource(ResourceQuantity, boolean, boolean, boolean)
- canRemoveResources(List)
- canRemoveResources(List, boolean, boolean)
- removeResources(List)
- removeResources(List, boolean, boolean, boolean)
- canRemoveMaterial(MaterialQuantity)
- canRemoveMaterial(MaterialQuantity, boolean, boolean)
- countRemovableMaterial(MaterialQuantity)
- countRemovableMaterial(MaterialQuantity, boolean)
- removeMaterial(MaterialQuantity)
- removeMaterial(MaterialQuantity, boolean, boolean, boolean)
- canRemoveMaterials(List)
- canRemoveMaterials(List, boolean, boolean)
- getSlotMaterialsToRemove(List, boolean, boolean)
- removeMaterials(List)
- removeMaterials(List, boolean, boolean, boolean)
- removeMaterialsOrdered(short, List)
- removeMaterialsOrdered(List, boolean, boolean, boolean)
- removeMaterialsOrdered(short, List, boolean, boolean, boolean)
- isEmpty()
- countItemStacks(Predicate)
- containsItemStacksStackableWith(ItemStack)
- forEach(ShortObjectConsumer)
- forEachWithMeta(Short2ObjectConcurrentHashMap.ShortBiObjConsumer, T)
- removeAllItemStacks()
- dropAllItemStacks()
- dropAllItemStacks(boolean)
- sortItems(SortType)
- containsContainer(ItemContainer)
- doMigration(Function)
- getMatchingResourceType(Item, String)
- validateQuantity(int)
- validateSlotIndex(short, int)
- copy(ItemContainer, T, List)
- ensureContainerCapacity(T, short, Short2ObjectConcurrentHashMap.ShortFunction, List)
- getNewContainer(short, Short2ObjectConcurrentHashMap.ShortFunction)
Class ItemContainer
java.lang.Object
com.hypixel.hytale.server.core.inventory.container.ItemContainer
- Direct Known Subclasses:
CombinedItemContainer, DelegateItemContainer, EmptyItemContainer, FetchedItemContainer, ItemStackItemContainer, SimpleItemContainer
- Since:
- 20/11/16.
- Version:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic final record -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CodecMapCodec<ItemContainer> static final booleanIf set to true then we should add/remove the whole quantity of items/resources and no less or else we will fail.static final booleanUsed in the cases of resources since a 1 item can be worth multiple of a resource so this prevents resource loss.static final booleanShould catAdd, cantRemove and cantDrop be checked when adding, removing or dropping itemsstatic final booleanShould added items only be added to empty item slots and will *NOT* be combined with existing stacks of equivalent type.static final boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddItemStack(ItemStack itemStack) Add anItemStackto this containeraddItemStack(ItemStack itemStack, boolean allOrNothing, boolean fullStacks, boolean filter) Add anItemStackto this containeraddItemStacks(List<ItemStack> itemStacks) addItemStacks(List<ItemStack> itemStacks, boolean allOrNothing, boolean fullStacks, boolean filter) addItemStacksOrdered(short offset, List<ItemStack> itemStacks) addItemStacksOrdered(short offset, List<ItemStack> itemStacks, boolean allOrNothing, boolean filter) Adds ItemStacks to the item container using one ItemStack per slot.addItemStacksOrdered(List<ItemStack> itemStacks) addItemStacksOrdered(List<ItemStack> itemStacks, boolean allOrNothing, boolean filter) addItemStackToSlot(short slot, ItemStack itemStack) addItemStackToSlot(short slot, ItemStack itemStack, boolean allOrNothing, boolean filter) booleancanAddItemStack(ItemStack itemStack) booleancanAddItemStack(ItemStack itemStack, boolean fullStacks, boolean filter) booleancanAddItemStacks(List<ItemStack> itemStacks) booleancanAddItemStacks(List<ItemStack> itemStacks, boolean fullStacks, boolean filter) booleancanAddItemStackToSlot(short slot, ItemStack itemStack, boolean allOrNothing, boolean filter) booleancanRemoveItemStack(ItemStack itemStack) booleancanRemoveItemStack(ItemStack itemStack, boolean exactAmount, boolean filter) booleancanRemoveItemStacks(List<ItemStack> itemStacks) booleancanRemoveItemStacks(List<ItemStack> itemStacks, boolean exactAmount, boolean filter) booleancanRemoveMaterial(MaterialQuantity material) booleancanRemoveMaterial(MaterialQuantity material, boolean exactAmount, boolean filter) booleancanRemoveMaterials(List<MaterialQuantity> materials) booleancanRemoveMaterials(List<MaterialQuantity> materials, boolean exactAmount, boolean filter) booleancanRemoveResource(ResourceQuantity resource) booleancanRemoveResource(ResourceQuantity resource, boolean exactAmount, boolean filter) booleancanRemoveResources(List<ResourceQuantity> resources) booleancanRemoveResources(List<ResourceQuantity> resources, boolean exactAmount, boolean filter) booleancanRemoveTag(int tagIndex, int quantity) booleancanRemoveTag(int tagIndex, int quantity, boolean exactAmount, boolean filter) clear()abstract ItemContainerclone()combineItemStacksIntoSlot(ItemContainer containerTo, short slotTo) booleancontainsContainer(ItemContainer itemContainer) booleancontainsItemStacksStackableWith(ItemStack itemStack) static <T extends ItemContainer>
Tcopy(ItemContainer from, T to, List<ItemStack> remainder) intcountItemStacks(Predicate<ItemStack> itemPredicate) intcountRemovableMaterial(MaterialQuantity material) intcountRemovableMaterial(MaterialQuantity material, boolean filter) voiddoMigration(Function<String, String> blockMigration) dropAllItemStacks(boolean filter) static <T extends ItemContainer>
TensureContainerCapacity(T inputContainer, short capacity, com.hypixel.fastutil.shorts.Short2ObjectConcurrentHashMap.ShortFunction<T> newContainerSupplier, List<ItemStack> remainder) voidforEach(ShortObjectConsumer<ItemStack> action) <T> voidforEachWithMeta(com.hypixel.fastutil.shorts.Short2ObjectConcurrentHashMap.ShortBiObjConsumer<ItemStack, T> consumer, T meta) abstract shortgetItemStack(short slot) static ItemResourceTypegetMatchingResourceType(Item item, String resourceId) Helper to get the resource type from an item that matches the given resource IDstatic ItemContainergetNewContainer(short capacity, com.hypixel.fastutil.shorts.Short2ObjectConcurrentHashMap.ShortFunction<ItemContainer> supplier) getSlotMaterialsToRemove(List<MaterialQuantity> materials, boolean exactAmount, boolean filter) internal_removeItemStack(short slot, int quantityToRemove) Deprecated.booleanisEmpty()moveAllItemStacksTo(ItemContainer... containerTo) moveAllItemStacksTo(Predicate<ItemStack> itemPredicate, ItemContainer... containerTo) moveItemStackFromSlot(short slot, boolean allOrNothing, boolean filter, ItemContainer... containerTo) moveItemStackFromSlot(short slot, int quantity, boolean allOrNothing, boolean filter, ItemContainer... containerTo) moveItemStackFromSlot(short slot, int quantity, ItemContainer containerTo) moveItemStackFromSlot(short slot, int quantity, ItemContainer... containerTo) moveItemStackFromSlot(short slot, int quantity, ItemContainer containerTo, boolean allOrNothing, boolean filter) moveItemStackFromSlot(short slot, ItemContainer containerTo) moveItemStackFromSlot(short slot, ItemContainer... containerTo) moveItemStackFromSlot(short slot, ItemContainer containerTo, boolean filter) moveItemStackFromSlot(short slot, ItemContainer containerTo, boolean allOrNothing, boolean filter) moveItemStackFromSlotToSlot(short slot, int quantity, ItemContainer containerTo, short slotTo) moveItemStackFromSlotToSlot(short slot, int quantity, ItemContainer containerTo, short slotTo, boolean filter) quickStackTo(ItemContainer... containerTo) registerChangeEvent(short priority, Consumer<ItemContainer.ItemContainerChangeEvent> consumer) registerChangeEvent(EventPriority priority, Consumer<ItemContainer.ItemContainerChangeEvent> consumer) removeItemStack(ItemStack itemStack) removeItemStack(ItemStack itemStack, boolean allOrNothing, boolean filter) removeItemStackFromSlot(short slot) removeItemStackFromSlot(short slot, boolean filter) removeItemStackFromSlot(short slot, int quantityToRemove) removeItemStackFromSlot(short slot, int quantityToRemove, boolean allOrNothing, boolean filter) removeItemStackFromSlot(short slot, ItemStack itemStackToRemove, int quantityToRemove) removeItemStackFromSlot(short slot, ItemStack itemStackToRemove, int quantityToRemove, boolean allOrNothing, boolean filter) removeItemStacks(List<ItemStack> itemStacks) removeItemStacks(List<ItemStack> itemStacks, boolean allOrNothing, boolean filter) removeMaterial(MaterialQuantity material) removeMaterial(MaterialQuantity material, boolean allOrNothing, boolean exactAmount, boolean filter) removeMaterialFromSlot(short slot, MaterialQuantity material) removeMaterialFromSlot(short slot, MaterialQuantity material, boolean allOrNothing, boolean exactAmount, boolean filter) removeMaterials(List<MaterialQuantity> materials) removeMaterials(List<MaterialQuantity> materials, boolean allOrNothing, boolean exactAmount, boolean filter) removeMaterialsOrdered(short offset, List<MaterialQuantity> materials) removeMaterialsOrdered(short offset, List<MaterialQuantity> materials, boolean allOrNothing, boolean exactAmount, boolean filter) Removes materials from the item container using one material per slot.removeMaterialsOrdered(List<MaterialQuantity> materials, boolean allOrNothing, boolean exactAmount, boolean filter) removeResource(ResourceQuantity resource) removeResource(ResourceQuantity resource, boolean allOrNothing, boolean exactAmount, boolean filter) removeResourceFromSlot(short slot, ResourceQuantity resource) removeResourceFromSlot(short slot, ResourceQuantity resource, boolean allOrNothing, boolean exactAmount, boolean filter) removeResources(List<ResourceQuantity> resources) removeResources(List<ResourceQuantity> resources, boolean allOrNothing, boolean exactAmount, boolean filter) removeTag(int tagIndex, int quantity) removeTag(int tagIndex, int quantity, boolean allOrNothing, boolean exactAmount, boolean filter) removeTagFromSlot(short slot, int tagIndex, int quantity) removeTagFromSlot(short slot, int tagIndex, int quantity, boolean allOrNothing, boolean filter) replaceItemStackInSlot(short slot, ItemStack itemStackToRemove, ItemStack itemStack) abstract voidsetGlobalFilter(FilterType globalFilter) setItemStackForSlot(short slot, ItemStack itemStack) setItemStackForSlot(short slot, ItemStack itemStack, boolean filter) abstract voidsetSlotFilter(FilterActionType actionType, short slot, SlotFilter filter) swapItems(short srcPos, ItemContainer containerTo, short destPos, short length) toPacket()static voidvalidateQuantity(int quantity) static voidvalidateSlotIndex(short slot, int capacity)
-
Field Details
-
CODEC
-
DEFAULT_ADD_ALL_OR_NOTHING
public static final boolean DEFAULT_ADD_ALL_OR_NOTHINGIf set to true then we should add/remove the whole quantity of items/resources and no less or else we will fail. If set to false then we will allow less than the quantity specified to be removed and the remainder to be removed will be specified in the returned transaction.- See Also:
-
DEFAULT_REMOVE_ALL_OR_NOTHING
public static final boolean DEFAULT_REMOVE_ALL_OR_NOTHING- See Also:
-
DEFAULT_FULL_STACKS
public static final boolean DEFAULT_FULL_STACKSShould added items only be added to empty item slots and will *NOT* be combined with existing stacks of equivalent type.- See Also:
-
DEFAULT_EXACT_AMOUNT
public static final boolean DEFAULT_EXACT_AMOUNTUsed in the cases of resources since a 1 item can be worth multiple of a resource so this prevents resource loss. Eg. 1 Trunk item may actually be worth 2 Wood resource so if you said remove 3 Wood and you had 2 Trunks you would technically lose 1 wood worth of resources if both items get removed so by setting exact amount to true it forces removal of exactly only 3 wood worth of resources.- See Also:
-
DEFAULT_FILTER
public static final boolean DEFAULT_FILTERShould catAdd, cantRemove and cantDrop be checked when adding, removing or dropping items- See Also:
-
-
Constructor Details
-
ItemContainer
public ItemContainer()
-
-
Method Details
-
getCapacity
public abstract short getCapacity() -
setGlobalFilter
-
setSlotFilter
-
clone
-
toPacket
-
toProtocolMap
-
registerChangeEvent
public EventRegistration<Void, ItemContainer.ItemContainerChangeEvent> registerChangeEvent(@Nonnull Consumer<ItemContainer.ItemContainerChangeEvent> consumer) -
registerChangeEvent
public EventRegistration<Void, ItemContainer.ItemContainerChangeEvent> registerChangeEvent(@Nonnull EventPriority priority, @Nonnull Consumer<ItemContainer.ItemContainerChangeEvent> consumer) -
registerChangeEvent
public EventRegistration<Void, ItemContainer.ItemContainerChangeEvent> registerChangeEvent(short priority, @Nonnull Consumer<ItemContainer.ItemContainerChangeEvent> consumer) -
clear
-
canAddItemStackToSlot
public boolean canAddItemStackToSlot(short slot, @Nonnull ItemStack itemStack, boolean allOrNothing, boolean filter) -
addItemStackToSlot
@Nonnull public ItemStackSlotTransaction addItemStackToSlot(short slot, @Nonnull ItemStack itemStack) -
addItemStackToSlot
@Nonnull public ItemStackSlotTransaction addItemStackToSlot(short slot, @Nonnull ItemStack itemStack, boolean allOrNothing, boolean filter) -
setItemStackForSlot
-
setItemStackForSlot
@Nonnull public ItemStackSlotTransaction setItemStackForSlot(short slot, ItemStack itemStack, boolean filter) -
getItemStack
-
replaceItemStackInSlot
@Nonnull public ItemStackSlotTransaction replaceItemStackInSlot(short slot, ItemStack itemStackToRemove, ItemStack itemStack) -
replaceAll
-
removeItemStackFromSlot
-
removeItemStackFromSlot
-
removeItemStackFromSlot
-
removeItemStackFromSlot
@Nonnull public ItemStackSlotTransaction removeItemStackFromSlot(short slot, int quantityToRemove, boolean allOrNothing, boolean filter) -
internal_removeItemStack
@Deprecated public ItemStackSlotTransaction internal_removeItemStack(short slot, int quantityToRemove) Deprecated. -
removeItemStackFromSlot
@Nonnull public ItemStackSlotTransaction removeItemStackFromSlot(short slot, ItemStack itemStackToRemove, int quantityToRemove) -
removeItemStackFromSlot
@Nonnull public ItemStackSlotTransaction removeItemStackFromSlot(short slot, ItemStack itemStackToRemove, int quantityToRemove, boolean allOrNothing, boolean filter) -
removeMaterialFromSlot
@Nonnull public MaterialSlotTransaction removeMaterialFromSlot(short slot, @Nonnull MaterialQuantity material) -
removeMaterialFromSlot
@Nonnull public MaterialSlotTransaction removeMaterialFromSlot(short slot, @Nonnull MaterialQuantity material, boolean allOrNothing, boolean exactAmount, boolean filter) -
removeResourceFromSlot
@Nonnull public ResourceSlotTransaction removeResourceFromSlot(short slot, @Nonnull ResourceQuantity resource) -
removeResourceFromSlot
@Nonnull public ResourceSlotTransaction removeResourceFromSlot(short slot, @Nonnull ResourceQuantity resource, boolean allOrNothing, boolean exactAmount, boolean filter) -
removeTagFromSlot
-
removeTagFromSlot
@Nonnull public TagSlotTransaction removeTagFromSlot(short slot, int tagIndex, int quantity, boolean allOrNothing, boolean filter) -
moveItemStackFromSlot
@Nonnull public MoveTransaction<ItemStackTransaction> moveItemStackFromSlot(short slot, @Nonnull ItemContainer containerTo) -
moveItemStackFromSlot
@Nonnull public MoveTransaction<ItemStackTransaction> moveItemStackFromSlot(short slot, @Nonnull ItemContainer containerTo, boolean filter) -
moveItemStackFromSlot
@Nonnull public MoveTransaction<ItemStackTransaction> moveItemStackFromSlot(short slot, @Nonnull ItemContainer containerTo, boolean allOrNothing, boolean filter) -
moveItemStackFromSlot
@Nonnull public MoveTransaction<ItemStackTransaction> moveItemStackFromSlot(short slot, int quantity, @Nonnull ItemContainer containerTo) -
moveItemStackFromSlot
@Nonnull public MoveTransaction<ItemStackTransaction> moveItemStackFromSlot(short slot, int quantity, @Nonnull ItemContainer containerTo, boolean allOrNothing, boolean filter) -
moveItemStackFromSlot
@Nonnull public ListTransaction<MoveTransaction<ItemStackTransaction>> moveItemStackFromSlot(short slot, ItemContainer... containerTo) -
moveItemStackFromSlot
@Nonnull public ListTransaction<MoveTransaction<ItemStackTransaction>> moveItemStackFromSlot(short slot, boolean allOrNothing, boolean filter, @Nonnull ItemContainer... containerTo) -
moveItemStackFromSlot
@Nonnull public ListTransaction<MoveTransaction<ItemStackTransaction>> moveItemStackFromSlot(short slot, int quantity, ItemContainer... containerTo) -
moveItemStackFromSlot
@Nonnull public ListTransaction<MoveTransaction<ItemStackTransaction>> moveItemStackFromSlot(short slot, int quantity, boolean allOrNothing, boolean filter, @Nonnull ItemContainer... containerTo) -
moveItemStackFromSlotToSlot
@Nonnull public MoveTransaction<SlotTransaction> moveItemStackFromSlotToSlot(short slot, int quantity, @Nonnull ItemContainer containerTo, short slotTo) -
moveItemStackFromSlotToSlot
@Nonnull public MoveTransaction<SlotTransaction> moveItemStackFromSlotToSlot(short slot, int quantity, @Nonnull ItemContainer containerTo, short slotTo, boolean filter) -
moveAllItemStacksTo
@Nonnull public ListTransaction<MoveTransaction<ItemStackTransaction>> moveAllItemStacksTo(ItemContainer... containerTo) -
moveAllItemStacksTo
@Nonnull public ListTransaction<MoveTransaction<ItemStackTransaction>> moveAllItemStacksTo(Predicate<ItemStack> itemPredicate, ItemContainer... containerTo) -
quickStackTo
@Nonnull public ListTransaction<MoveTransaction<ItemStackTransaction>> quickStackTo(@Nonnull ItemContainer... containerTo) -
combineItemStacksIntoSlot
@Nonnull public ListTransaction<MoveTransaction<SlotTransaction>> combineItemStacksIntoSlot(@Nonnull ItemContainer containerTo, short slotTo) -
swapItems
@Nonnull public ListTransaction<MoveTransaction<SlotTransaction>> swapItems(short srcPos, @Nonnull ItemContainer containerTo, short destPos, short length) -
canAddItemStack
-
canAddItemStack
-
addItemStack
Add anItemStackto this container -
addItemStack
@Nonnull public ItemStackTransaction addItemStack(@Nonnull ItemStack itemStack, boolean allOrNothing, boolean fullStacks, boolean filter) Add anItemStackto this container -
canAddItemStacks
-
canAddItemStacks
-
addItemStacks
-
addItemStacks
public ListTransaction<ItemStackTransaction> addItemStacks(@Nullable List<ItemStack> itemStacks, boolean allOrNothing, boolean fullStacks, boolean filter) -
addItemStacksOrdered
-
addItemStacksOrdered
public ListTransaction<ItemStackSlotTransaction> addItemStacksOrdered(short offset, List<ItemStack> itemStacks) -
addItemStacksOrdered
public ListTransaction<ItemStackSlotTransaction> addItemStacksOrdered(List<ItemStack> itemStacks, boolean allOrNothing, boolean filter) -
addItemStacksOrdered
public ListTransaction<ItemStackSlotTransaction> addItemStacksOrdered(short offset, @Nullable List<ItemStack> itemStacks, boolean allOrNothing, boolean filter) Adds ItemStacks to the item container using one ItemStack per slot. Eg addItemStacksOrdered with 2 ItemStacks Rock_Stone and Wood_Ash_Trunk will add the Rock_Stone ItemStack to slot offset and the Wood_Ash_Trunk to slot (offset + 1). -
canRemoveItemStack
-
canRemoveItemStack
public boolean canRemoveItemStack(@Nullable ItemStack itemStack, boolean exactAmount, boolean filter) -
removeItemStack
-
removeItemStack
@Nonnull public ItemStackTransaction removeItemStack(@Nonnull ItemStack itemStack, boolean allOrNothing, boolean filter) -
canRemoveItemStacks
-
canRemoveItemStacks
-
removeItemStacks
-
removeItemStacks
public ListTransaction<ItemStackTransaction> removeItemStacks(@Nullable List<ItemStack> itemStacks, boolean allOrNothing, boolean filter) -
canRemoveTag
public boolean canRemoveTag(int tagIndex, int quantity) -
canRemoveTag
public boolean canRemoveTag(int tagIndex, int quantity, boolean exactAmount, boolean filter) -
removeTag
-
removeTag
@Nonnull public TagTransaction removeTag(int tagIndex, int quantity, boolean allOrNothing, boolean exactAmount, boolean filter) -
canRemoveResource
-
canRemoveResource
public boolean canRemoveResource(@Nullable ResourceQuantity resource, boolean exactAmount, boolean filter) -
removeResource
-
removeResource
@Nonnull public ResourceTransaction removeResource(@Nonnull ResourceQuantity resource, boolean allOrNothing, boolean exactAmount, boolean filter) -
canRemoveResources
-
canRemoveResources
public boolean canRemoveResources(@Nullable List<ResourceQuantity> resources, boolean exactAmount, boolean filter) -
removeResources
-
removeResources
public ListTransaction<ResourceTransaction> removeResources(@Nullable List<ResourceQuantity> resources, boolean allOrNothing, boolean exactAmount, boolean filter) -
canRemoveMaterial
-
canRemoveMaterial
public boolean canRemoveMaterial(@Nullable MaterialQuantity material, boolean exactAmount, boolean filter) -
countRemovableMaterial
-
countRemovableMaterial
- Returns:
- the total amount of the given material that could be removed from this container. Matches item-id,
resource-type and tag materials through the same logic as
canRemoveMaterial(MaterialQuantity).
-
removeMaterial
-
removeMaterial
@Nonnull public MaterialTransaction removeMaterial(@Nonnull MaterialQuantity material, boolean allOrNothing, boolean exactAmount, boolean filter) -
canRemoveMaterials
-
canRemoveMaterials
public boolean canRemoveMaterials(@Nullable List<MaterialQuantity> materials, boolean exactAmount, boolean filter) -
getSlotMaterialsToRemove
public List<TestRemoveItemSlotResult> getSlotMaterialsToRemove(@Nullable List<MaterialQuantity> materials, boolean exactAmount, boolean filter) -
removeMaterials
-
removeMaterials
public ListTransaction<MaterialTransaction> removeMaterials(@Nullable List<MaterialQuantity> materials, boolean allOrNothing, boolean exactAmount, boolean filter) -
removeMaterialsOrdered
public ListTransaction<MaterialSlotTransaction> removeMaterialsOrdered(short offset, List<MaterialQuantity> materials) -
removeMaterialsOrdered
public ListTransaction<MaterialSlotTransaction> removeMaterialsOrdered(List<MaterialQuantity> materials, boolean allOrNothing, boolean exactAmount, boolean filter) -
removeMaterialsOrdered
public ListTransaction<MaterialSlotTransaction> removeMaterialsOrdered(short offset, @Nullable List<MaterialQuantity> materials, boolean allOrNothing, boolean exactAmount, boolean filter) Removes materials from the item container using one material per slot. Eg removeMaterialsOrdered with 2 materials Wood and Copper Ingot will remove the Wood material from slot offset and the Copper Ingot from slot (offset + 1). -
isEmpty
public boolean isEmpty() -
countItemStacks
-
containsItemStacksStackableWith
-
forEach
-
forEachWithMeta
public <T> void forEachWithMeta(@Nonnull com.hypixel.fastutil.shorts.Short2ObjectConcurrentHashMap.ShortBiObjConsumer<ItemStack, T> consumer, T meta) -
removeAllItemStacks
-
dropAllItemStacks
-
dropAllItemStacks
-
sortItems
-
containsContainer
-
doMigration
-
getMatchingResourceType
@Nullable public static ItemResourceType getMatchingResourceType(@Nonnull Item item, @Nonnull String resourceId) Helper to get the resource type from an item that matches the given resource ID- Parameters:
item- The item to checkresourceId- The resource to look for- Returns:
- The resource type information or null
-
validateQuantity
public static void validateQuantity(int quantity) -
validateSlotIndex
public static void validateSlotIndex(short slot, int capacity) -
copy
@Nonnull public static <T extends ItemContainer> T copy(@Nonnull ItemContainer from, @Nonnull T to, @Nullable List<ItemStack> remainder) -
ensureContainerCapacity
public static <T extends ItemContainer> T ensureContainerCapacity(@Nullable T inputContainer, short capacity, @Nonnull com.hypixel.fastutil.shorts.Short2ObjectConcurrentHashMap.ShortFunction<T> newContainerSupplier, @Nullable List<ItemStack> remainder) - Returns:
- a new AbstractItemContainer of size capacity with all the items copied from the inputContainer.
-
getNewContainer
public static ItemContainer getNewContainer(short capacity, @Nonnull com.hypixel.fastutil.shorts.Short2ObjectConcurrentHashMap.ShortFunction<ItemContainer> supplier)
-