Interface IIngredientComponentTerminalStorageHandler<T,M>
- Type Parameters:
T- The instance type.M- The matching condition parameter.
- All Known Implementing Classes:
IngredientComponentTerminalStorageHandlerEnergy,IngredientComponentTerminalStorageHandlerFluidStack,IngredientComponentTerminalStorageHandlerItemStack
public interface IIngredientComponentTerminalStorageHandler<T,M>
Capability for displaying and interacting with ingredient components of a certain type in the storage terminal.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidaddQuantityTooltip(List<net.minecraft.network.chat.Component> lines, T instance) Show the quantity of the given instance on the second tooltip line.voiddrainActivePlayerStackQuantity(net.minecraft.world.entity.player.Inventory playerInventory, net.minecraft.world.inventory.AbstractContainerMenu container, long quantity) Drain the given quantity from the active player stack.voiddrawInstance(net.minecraft.client.gui.GuiGraphics guiGraphics, T instance, long maxQuantity, String label, net.minecraft.client.gui.screens.inventory.AbstractContainerScreen gui, ContainerScreenTerminalStorage.DrawLayer layer, float partialTick, int x, int y, int mouseX, int mouseY, List<net.minecraft.network.chat.Component> additionalTooltipLines) Draw the given instance in the given gui.voidextractActiveStackFromPlayerInventory(org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage<T, M> storage, net.minecraft.world.inventory.AbstractContainerMenu container, net.minecraft.world.entity.player.Inventory playerInventory, long moveQuantityPlayerSlot) Move the ingredient in the active player stack to the storage.voidextractMaxFromContainerSlot(org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage<T, M> storage, net.minecraft.world.inventory.AbstractContainerMenu container, int containerSlot, net.minecraft.world.entity.player.Inventory playerInventory, int limit) Move as much as possible from the given container slot into the storage.formatQuantity(T instance) Get a display string for the quantity of the given instance.longgetActivePlayerStackQuantity(net.minecraft.world.entity.player.Inventory playerInventory, net.minecraft.world.inventory.AbstractContainerMenu container) Get the quantity in the active player stack.net.minecraft.world.item.ItemStackgetIcon()intintgetInstance(net.minecraft.world.item.ItemStack itemStack) Get the ingredient instance from the given item.getInstanceFilterPredicate(SearchMode searchMode, String query) Get a predicate for matching instances that apply to the given query string.longgetMaxQuantity(net.minecraft.world.item.ItemStack itemStack) Get the max instance quantity in the given item.insertIntoContainer(org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage<T, M> storage, net.minecraft.world.inventory.AbstractContainerMenu container, int containerSlot, T maxInstance, net.minecraft.world.entity.player.Player player, boolean transferFullSelection) Insert the given instance into the container.default voidinsertMaxIntoContainer(org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage<T, M> storage, net.minecraft.world.inventory.AbstractContainerMenu container, int containerSlotStart, int containerSlotEnd, T instance) Insert as much as possible from the given instance prototype into the container.booleanisInstance(net.minecraft.world.item.ItemStack itemStack) Get the ingredient instance from the given item.intthrowIntoWorld(org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage<T, M> storage, T maxInstance, net.minecraft.world.entity.player.Player player) Throw the given instance into the world.
-
Method Details
-
getComponent
- Returns:
- The ingredient component.
-
getIcon
net.minecraft.world.item.ItemStack getIcon()- Returns:
- The item that can be used to visually represent this ingredient component type.
-
drawInstance
void drawInstance(net.minecraft.client.gui.GuiGraphics guiGraphics, T instance, long maxQuantity, @Nullable String label, net.minecraft.client.gui.screens.inventory.AbstractContainerScreen gui, ContainerScreenTerminalStorage.DrawLayer layer, float partialTick, int x, int y, int mouseX, int mouseY, @Nullable List<net.minecraft.network.chat.Component> additionalTooltipLines) Draw the given instance in the given gui.- Parameters:
guiGraphics- The matrix stack.instance- An instance.maxQuantity- The maximum allowed quantity of the given instance.label- An optional label that should be rendered instead of the quantity.gui- A gui to render in.layer- The layer to render in.partialTick- The partial tick.x- The slot X position.y- The slot Y position.mouseX- The mouse X position.mouseY- The mouse Y position.additionalTooltipLines- The additional tooltip lines to add.
-
addQuantityTooltip
Show the quantity of the given instance on the second tooltip line.- Parameters:
lines- Tooltip linesinstance- An instance.
-
formatQuantity
Get a display string for the quantity of the given instance.- Parameters:
instance- An instance.- Returns:
- The formatted quantity.
-
isInstance
boolean isInstance(net.minecraft.world.item.ItemStack itemStack) Get the ingredient instance from the given item.- Parameters:
itemStack- An item.- Returns:
- If the stack represents an ingredient.
-
getInstance
Get the ingredient instance from the given item.- Parameters:
itemStack- An item.- Returns:
- An ingredient.
-
getMaxQuantity
long getMaxQuantity(net.minecraft.world.item.ItemStack itemStack) Get the max instance quantity in the given item.- Parameters:
itemStack- An item.- Returns:
- The max quantity.
-
getInitialInstanceMovementQuantity
int getInitialInstanceMovementQuantity()- Returns:
- The number that should be selected when clicking on an instance in the storage terminal.
-
getIncrementalInstanceMovementQuantity
int getIncrementalInstanceMovementQuantity()- Returns:
- The number that should be removed when right-clicking when an instance is selected in the storage terminal.
-
throwIntoWorld
int throwIntoWorld(org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage<T, M> storage, T maxInstance, net.minecraft.world.entity.player.Player player) Throw the given instance into the world.- Parameters:
storage- The storage to extract from.maxInstance- The instance to throw.player- The throwing player.- Returns:
- The instance quantity that was thrown.
-
insertMaxIntoContainer
default void insertMaxIntoContainer(org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage<T, M> storage, net.minecraft.world.inventory.AbstractContainerMenu container, int containerSlotStart, int containerSlotEnd, T instance) Insert as much as possible from the given instance prototype into the container.- Parameters:
storage- The storage to insert to.container- The container to extract from.containerSlotStart- The container slot to start from.containerSlotEnd- The container slot to end at (exclusive).instance- The instance to move.
-
insertIntoContainer
T insertIntoContainer(org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage<T, M> storage, net.minecraft.world.inventory.AbstractContainerMenu container, int containerSlot, T maxInstance, @Nullable net.minecraft.world.entity.player.Player player, boolean transferFullSelection) Insert the given instance into the container.- Parameters:
storage- The storage to extract from.container- The container to insert to.containerSlot- The container slot to insert to.maxInstance- The instance to move.player- The player. If null, the container slot will not be picked up by the player if not empty.transferFullSelection- If the selected stack should be moved fully.- Returns:
- The instance quantity that was moved.
-
extractActiveStackFromPlayerInventory
void extractActiveStackFromPlayerInventory(org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage<T, M> storage, net.minecraft.world.inventory.AbstractContainerMenu container, net.minecraft.world.entity.player.Inventory playerInventory, long moveQuantityPlayerSlot) Move the ingredient in the active player stack to the storage.- Parameters:
storage- The storage to insert to.container-playerInventory- The player inventory to extract from.moveQuantityPlayerSlot- The player stack quantity that should be extracted.
-
extractMaxFromContainerSlot
void extractMaxFromContainerSlot(org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage<T, M> storage, net.minecraft.world.inventory.AbstractContainerMenu container, int containerSlot, net.minecraft.world.entity.player.Inventory playerInventory, int limit) Move as much as possible from the given container slot into the storage.- Parameters:
storage- The storage to insert to.container- The container to insert to.containerSlot- The container slot to insert to.playerInventory- The active player inventory.limit- The max limit. -1 is no limit.
-
getActivePlayerStackQuantity
long getActivePlayerStackQuantity(net.minecraft.world.entity.player.Inventory playerInventory, net.minecraft.world.inventory.AbstractContainerMenu container) Get the quantity in the active player stack.- Parameters:
playerInventory- The player inventory.container-- Returns:
- The quantity.
-
drainActivePlayerStackQuantity
void drainActivePlayerStackQuantity(net.minecraft.world.entity.player.Inventory playerInventory, net.minecraft.world.inventory.AbstractContainerMenu container, long quantity) Drain the given quantity from the active player stack. This will typically only be called client-side, and later confirmed by the server.- Parameters:
playerInventory- The player inventory.container-quantity- The quantity to drain.
-
getInstanceFilterPredicate
Get a predicate for matching instances that apply to the given query string.- Parameters:
searchMode- The mode to search underquery- A query string.- Returns:
- An instance matcher.
-
getInstanceSorters
Collection<IIngredientInstanceSorter<T>> getInstanceSorters()- Returns:
- The available sorters.
-