Class IngredientComponentTerminalStorageHandlerItemStack

java.lang.Object
org.cyclops.integratedterminals.capability.ingredient.IngredientComponentTerminalStorageHandlerItemStack
All Implemented Interfaces:
IIngredientComponentTerminalStorageHandler<net.minecraft.world.item.ItemStack,Integer>

public class IngredientComponentTerminalStorageHandlerItemStack extends Object implements IIngredientComponentTerminalStorageHandler<net.minecraft.world.item.ItemStack,Integer>
Terminal storage handler for items.
  • Constructor Summary

    Constructors
    Constructor
    Description
    IngredientComponentTerminalStorageHandlerItemStack(org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<net.minecraft.world.item.ItemStack,Integer> ingredientComponent)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    void
    drawInstance(com.mojang.blaze3d.vertex.PoseStack matrixStack, net.minecraft.world.item.ItemStack 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.
    void
    extractActiveStackFromPlayerInventory(org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage<net.minecraft.world.item.ItemStack,Integer> 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.
    void
    extractMaxFromContainerSlot(org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage<net.minecraft.world.item.ItemStack,Integer> 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(net.minecraft.world.item.ItemStack instance)
    Get a display string for the quantity of the given instance.
    long
    getActivePlayerStackQuantity(net.minecraft.world.entity.player.Inventory playerInventory, net.minecraft.world.inventory.AbstractContainerMenu container)
    Get the quantity in the active player stack.
    org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<net.minecraft.world.item.ItemStack,Integer>
     
    net.minecraft.world.item.ItemStack
     
    int
     
    int
     
    net.minecraft.world.item.ItemStack
    getInstance(net.minecraft.world.item.ItemStack itemStack)
    Get the ingredient instance from the given item.
    Predicate<net.minecraft.world.item.ItemStack>
    Get a predicate for matching instances that apply to the given query string.
    Collection<IIngredientInstanceSorter<net.minecraft.world.item.ItemStack>>
     
    long
    getMaxQuantity(net.minecraft.world.item.ItemStack itemStack)
    Get the max instance quantity in the given item.
    net.minecraft.world.item.ItemStack
    insertIntoContainer(org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage<net.minecraft.world.item.ItemStack,Integer> storage, net.minecraft.world.inventory.AbstractContainerMenu container, int containerSlotIndex, net.minecraft.world.item.ItemStack maxInstance, net.minecraft.world.entity.player.Player player, boolean transferFullSelection)
    Insert the given instance into the container.
    boolean
    isInstance(net.minecraft.world.item.ItemStack itemStack)
    Get the ingredient instance from the given item.
    int
    throwIntoWorld(org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage<net.minecraft.world.item.ItemStack,Integer> storage, net.minecraft.world.item.ItemStack maxInstance, net.minecraft.world.entity.player.Player player)
    Throw the given instance into the world.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.cyclops.integratedterminals.api.ingredient.IIngredientComponentTerminalStorageHandler

    addQuantityTooltip, insertMaxIntoContainer
  • Constructor Details

    • IngredientComponentTerminalStorageHandlerItemStack

      public IngredientComponentTerminalStorageHandlerItemStack(org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<net.minecraft.world.item.ItemStack,Integer> ingredientComponent)
  • Method Details

    • getComponent

      public org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<net.minecraft.world.item.ItemStack,Integer> getComponent()
      Specified by:
      getComponent in interface IIngredientComponentTerminalStorageHandler<net.minecraft.world.item.ItemStack,Integer>
      Returns:
      The ingredient component.
    • getIcon

      public net.minecraft.world.item.ItemStack getIcon()
      Specified by:
      getIcon in interface IIngredientComponentTerminalStorageHandler<net.minecraft.world.item.ItemStack,Integer>
      Returns:
      The item that can be used to visually represent this ingredient component type.
    • drawInstance

      public void drawInstance(com.mojang.blaze3d.vertex.PoseStack matrixStack, net.minecraft.world.item.ItemStack 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)
      Description copied from interface: IIngredientComponentTerminalStorageHandler
      Draw the given instance in the given gui.
      Specified by:
      drawInstance in interface IIngredientComponentTerminalStorageHandler<net.minecraft.world.item.ItemStack,Integer>
      Parameters:
      matrixStack - 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.
    • formatQuantity

      public String formatQuantity(net.minecraft.world.item.ItemStack instance)
      Description copied from interface: IIngredientComponentTerminalStorageHandler
      Get a display string for the quantity of the given instance.
      Specified by:
      formatQuantity in interface IIngredientComponentTerminalStorageHandler<net.minecraft.world.item.ItemStack,Integer>
      Parameters:
      instance - An instance.
      Returns:
      The formatted quantity.
    • isInstance

      public boolean isInstance(net.minecraft.world.item.ItemStack itemStack)
      Description copied from interface: IIngredientComponentTerminalStorageHandler
      Get the ingredient instance from the given item.
      Specified by:
      isInstance in interface IIngredientComponentTerminalStorageHandler<net.minecraft.world.item.ItemStack,Integer>
      Parameters:
      itemStack - An item.
      Returns:
      If the stack represents an ingredient.
    • getInstance

      public net.minecraft.world.item.ItemStack getInstance(net.minecraft.world.item.ItemStack itemStack)
      Description copied from interface: IIngredientComponentTerminalStorageHandler
      Get the ingredient instance from the given item.
      Specified by:
      getInstance in interface IIngredientComponentTerminalStorageHandler<net.minecraft.world.item.ItemStack,Integer>
      Parameters:
      itemStack - An item.
      Returns:
      An ingredient.
    • getMaxQuantity

      public long getMaxQuantity(net.minecraft.world.item.ItemStack itemStack)
      Description copied from interface: IIngredientComponentTerminalStorageHandler
      Get the max instance quantity in the given item.
      Specified by:
      getMaxQuantity in interface IIngredientComponentTerminalStorageHandler<net.minecraft.world.item.ItemStack,Integer>
      Parameters:
      itemStack - An item.
      Returns:
      The max quantity.
    • getInitialInstanceMovementQuantity

      public int getInitialInstanceMovementQuantity()
      Specified by:
      getInitialInstanceMovementQuantity in interface IIngredientComponentTerminalStorageHandler<net.minecraft.world.item.ItemStack,Integer>
      Returns:
      The number that should be selected when clicking on an instance in the storage terminal.
    • getIncrementalInstanceMovementQuantity

      public int getIncrementalInstanceMovementQuantity()
      Specified by:
      getIncrementalInstanceMovementQuantity in interface IIngredientComponentTerminalStorageHandler<net.minecraft.world.item.ItemStack,Integer>
      Returns:
      The number that should be removed when right-clicking when an instance is selected in the storage terminal.
    • throwIntoWorld

      public int throwIntoWorld(org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage<net.minecraft.world.item.ItemStack,Integer> storage, net.minecraft.world.item.ItemStack maxInstance, net.minecraft.world.entity.player.Player player)
      Description copied from interface: IIngredientComponentTerminalStorageHandler
      Throw the given instance into the world.
      Specified by:
      throwIntoWorld in interface IIngredientComponentTerminalStorageHandler<net.minecraft.world.item.ItemStack,Integer>
      Parameters:
      storage - The storage to extract from.
      maxInstance - The instance to throw.
      player - The throwing player.
      Returns:
      The instance quantity that was thrown.
    • insertIntoContainer

      public net.minecraft.world.item.ItemStack insertIntoContainer(org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage<net.minecraft.world.item.ItemStack,Integer> storage, net.minecraft.world.inventory.AbstractContainerMenu container, int containerSlotIndex, net.minecraft.world.item.ItemStack maxInstance, @Nullable net.minecraft.world.entity.player.Player player, boolean transferFullSelection)
      Description copied from interface: IIngredientComponentTerminalStorageHandler
      Insert the given instance into the container.
      Specified by:
      insertIntoContainer in interface IIngredientComponentTerminalStorageHandler<net.minecraft.world.item.ItemStack,Integer>
      Parameters:
      storage - The storage to extract from.
      container - The container to insert to.
      containerSlotIndex - 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

      public void extractActiveStackFromPlayerInventory(org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage<net.minecraft.world.item.ItemStack,Integer> storage, net.minecraft.world.inventory.AbstractContainerMenu container, net.minecraft.world.entity.player.Inventory playerInventory, long moveQuantityPlayerSlot)
      Description copied from interface: IIngredientComponentTerminalStorageHandler
      Move the ingredient in the active player stack to the storage.
      Specified by:
      extractActiveStackFromPlayerInventory in interface IIngredientComponentTerminalStorageHandler<net.minecraft.world.item.ItemStack,Integer>
      Parameters:
      storage - The storage to insert to.
      playerInventory - The player inventory to extract from.
      moveQuantityPlayerSlot - The player stack quantity that should be extracted.
    • extractMaxFromContainerSlot

      public void extractMaxFromContainerSlot(org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage<net.minecraft.world.item.ItemStack,Integer> storage, net.minecraft.world.inventory.AbstractContainerMenu container, int containerSlot, net.minecraft.world.entity.player.Inventory playerInventory, int limit)
      Description copied from interface: IIngredientComponentTerminalStorageHandler
      Move as much as possible from the given container slot into the storage.
      Specified by:
      extractMaxFromContainerSlot in interface IIngredientComponentTerminalStorageHandler<net.minecraft.world.item.ItemStack,Integer>
      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

      public long getActivePlayerStackQuantity(net.minecraft.world.entity.player.Inventory playerInventory, net.minecraft.world.inventory.AbstractContainerMenu container)
      Description copied from interface: IIngredientComponentTerminalStorageHandler
      Get the quantity in the active player stack.
      Specified by:
      getActivePlayerStackQuantity in interface IIngredientComponentTerminalStorageHandler<net.minecraft.world.item.ItemStack,Integer>
      Parameters:
      playerInventory - The player inventory.
      Returns:
      The quantity.
    • drainActivePlayerStackQuantity

      public void drainActivePlayerStackQuantity(net.minecraft.world.entity.player.Inventory playerInventory, net.minecraft.world.inventory.AbstractContainerMenu container, long quantity)
      Description copied from interface: IIngredientComponentTerminalStorageHandler
      Drain the given quantity from the active player stack. This will typically only be called client-side, and later confirmed by the server.
      Specified by:
      drainActivePlayerStackQuantity in interface IIngredientComponentTerminalStorageHandler<net.minecraft.world.item.ItemStack,Integer>
      Parameters:
      playerInventory - The player inventory.
      quantity - The quantity to drain.
    • getInstanceFilterPredicate

      public Predicate<net.minecraft.world.item.ItemStack> getInstanceFilterPredicate(SearchMode searchMode, String query)
      Description copied from interface: IIngredientComponentTerminalStorageHandler
      Get a predicate for matching instances that apply to the given query string.
      Specified by:
      getInstanceFilterPredicate in interface IIngredientComponentTerminalStorageHandler<net.minecraft.world.item.ItemStack,Integer>
      Parameters:
      searchMode - The mode to search under
      query - A query string.
      Returns:
      An instance matcher.
    • getInstanceSorters

      public Collection<IIngredientInstanceSorter<net.minecraft.world.item.ItemStack>> getInstanceSorters()
      Specified by:
      getInstanceSorters in interface IIngredientComponentTerminalStorageHandler<net.minecraft.world.item.ItemStack,Integer>
      Returns:
      The available sorters.