Contents
- Description
- Nested Class Summary
- Field Summary
- Method Summary
- Field Details
- Method Details
- getParentContainer()
- getItemStackSlot()
- getOriginalItemStack()
- isItemStackValid()
- getCapacity()
- setGlobalFilter(FilterType)
- setSlotFilter(FilterActionType, short, SlotFilter)
- clone()
- isEmpty()
- getItemStack(short)
- writeToItemStack(ItemContainer, short, ItemStack, ItemStack[])
- getContainer(ItemContainer, short)
- makeContainerWithCapacity(ItemContainer, short, short)
- ensureContainer(ItemContainer, short, short)
- ensureConfiguredContainer(ItemContainer, short, ItemStackContainerConfig)
Class ItemStackItemContainer
java.lang.Object
com.hypixel.hytale.server.core.inventory.container.ItemContainer
com.hypixel.hytale.server.core.inventory.container.ItemStackItemContainer
-
Nested Class Summary
Nested classes/interfaces inherited from class ItemContainer
ItemContainer.ItemContainerChangeEvent, ItemContainer.TempItemData -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final KeyedCodec<Short> static final KeyedCodec<org.bson.BsonDocument> static final KeyedCodec<ItemStack[]> Fields inherited from class ItemContainer
CODEC, DEFAULT_ADD_ALL_OR_NOTHING, DEFAULT_EXACT_AMOUNT, DEFAULT_FILTER, DEFAULT_FULL_STACKS, DEFAULT_REMOVE_ALL_OR_NOTHING -
Method Summary
Modifier and TypeMethodDescriptionclone()static ItemStackItemContainerensureConfiguredContainer(ItemContainer itemContainer, short slot, ItemStackContainerConfig config) static ItemStackItemContainerensureContainer(ItemContainer itemContainer, short slot, short capacity) Ensures the item stack at the specified slot has an item container.shortstatic ItemStackItemContainergetContainer(ItemContainer itemContainer, short slot) Gets the container from an item stack stored in a container at the specified slot ornullif the item doesn't have a container.getItemStack(short slot) Note: Optimized implementation since we have direct access to the lock.shortbooleanisEmpty()booleanstatic ItemStackItemContainermakeContainerWithCapacity(ItemContainer itemContainer, short slot, short capacity) Creates an item container in the item stack at the specified slot in the item container with the specified capacity as long as the item doesn't already have a container already.voidsetGlobalFilter(FilterType globalFilter) voidsetSlotFilter(FilterActionType actionType, short slot, SlotFilter filter) static voidwriteToItemStack(ItemContainer itemContainer, short slot, ItemStack originalItemStack, ItemStack[] items) Writes the provided items array to an item stack in a container only if that item still matches the original item stack.Methods inherited from class ItemContainer
addItemStack, addItemStack, addItemStacks, addItemStacks, addItemStacksOrdered, addItemStacksOrdered, addItemStacksOrdered, addItemStacksOrdered, addItemStackToSlot, addItemStackToSlot, canAddItemStack, canAddItemStack, canAddItemStacks, canAddItemStacks, canAddItemStackToSlot, canRemoveItemStack, canRemoveItemStack, canRemoveItemStacks, canRemoveItemStacks, canRemoveMaterial, canRemoveMaterial, canRemoveMaterials, canRemoveMaterials, canRemoveResource, canRemoveResource, canRemoveResources, canRemoveResources, canRemoveTag, canRemoveTag, clear, combineItemStacksIntoSlot, containsContainer, containsItemStacksStackableWith, copy, countItemStacks, countRemovableMaterial, countRemovableMaterial, doMigration, dropAllItemStacks, dropAllItemStacks, ensureContainerCapacity, forEach, forEachWithMeta, getMatchingResourceType, getNewContainer, getSlotMaterialsToRemove, internal_removeItemStack, moveAllItemStacksTo, moveAllItemStacksTo, moveItemStackFromSlot, moveItemStackFromSlot, moveItemStackFromSlot, moveItemStackFromSlot, moveItemStackFromSlot, moveItemStackFromSlot, moveItemStackFromSlot, moveItemStackFromSlot, moveItemStackFromSlot, moveItemStackFromSlotToSlot, moveItemStackFromSlotToSlot, quickStackTo, registerChangeEvent, registerChangeEvent, registerChangeEvent, removeAllItemStacks, removeItemStack, removeItemStack, removeItemStackFromSlot, removeItemStackFromSlot, removeItemStackFromSlot, removeItemStackFromSlot, removeItemStackFromSlot, removeItemStackFromSlot, removeItemStacks, removeItemStacks, removeMaterial, removeMaterial, removeMaterialFromSlot, removeMaterialFromSlot, removeMaterials, removeMaterials, removeMaterialsOrdered, removeMaterialsOrdered, removeMaterialsOrdered, removeResource, removeResource, removeResourceFromSlot, removeResourceFromSlot, removeResources, removeResources, removeTag, removeTag, removeTagFromSlot, removeTagFromSlot, replaceAll, replaceItemStackInSlot, setItemStackForSlot, setItemStackForSlot, sortItems, swapItems, toPacket, toProtocolMap, validateQuantity, validateSlotIndex
-
Field Details
-
CONTAINER_CODEC
-
CAPACITY_CODEC
-
ITEMS_CODEC
-
-
Method Details
-
getParentContainer
-
getItemStackSlot
public short getItemStackSlot() -
getOriginalItemStack
-
isItemStackValid
public boolean isItemStackValid() -
getCapacity
public short getCapacity()- Specified by:
getCapacityin classItemContainer
-
setGlobalFilter
- Specified by:
setGlobalFilterin classItemContainer
-
setSlotFilter
- Specified by:
setSlotFilterin classItemContainer
-
clone
- Specified by:
clonein classItemContainer
-
isEmpty
public boolean isEmpty()- Overrides:
isEmptyin classItemContainer
-
getItemStack
Note: Optimized implementation since we have direct access to the lock.- Overrides:
getItemStackin classItemContainer
-
writeToItemStack
public static void writeToItemStack(@Nonnull ItemContainer itemContainer, short slot, ItemStack originalItemStack, ItemStack[] items) Writes the provided items array to an item stack in a container only if that item still matches the original item stack.- Parameters:
itemContainer- The container the item stack is inslot- The slot the item stack is inoriginalItemStack- The original item stack from this slot (what we expect to be there)items- The items to write into the item container stored on this item stack
-
getContainer
@Nullable public static ItemStackItemContainer getContainer(@Nonnull ItemContainer itemContainer, short slot) Gets the container from an item stack stored in a container at the specified slot ornullif the item doesn't have a container.- Parameters:
itemContainer- The item container the item stack is inslot- The slot in the container the item stack is in- Returns:
- The container stored in the item at the specified slot or
nullif the item doesn't have a container
-
makeContainerWithCapacity
@Nonnull public static ItemStackItemContainer makeContainerWithCapacity(@Nonnull ItemContainer itemContainer, short slot, short capacity) Creates an item container in the item stack at the specified slot in the item container with the specified capacity as long as the item doesn't already have a container already.- Parameters:
itemContainer- The item container the item stack is inslot- The slot in the container the item stack is incapacity- The capacity of the container to create in the item stack- Returns:
- The item container created in the specified item stack
- Throws:
IllegalArgumentException- If the item stack at the specified slot is "Empty"IllegalStateException- If the specified item stack already has a container
-
ensureContainer
@Nullable public static ItemStackItemContainer ensureContainer(@Nonnull ItemContainer itemContainer, short slot, short capacity) Ensures the item stack at the specified slot has an item container. If the item stack does have a container it is returned (without modifying the capacity). If it does not then one is crated with the provided capacity.- Parameters:
itemContainer- The item container the item stack is inslot- The slot in the container the item stack is incapacity- The capacity of the container to create in the item stack if needed- Returns:
- The item container in the item stack
-
ensureConfiguredContainer
@Nullable public static ItemStackItemContainer ensureConfiguredContainer(@Nonnull ItemContainer itemContainer, short slot, @Nonnull ItemStackContainerConfig config)
-