Interface ITerminalButton<C extends ITerminalStorageTabClient,O extends ITerminalStorageTabCommon,B extends net.minecraft.client.gui.components.Button>

All Known Implementing Classes:
TerminalButtonFilterCrafting, TerminalButtonItemStackCraftingGridAutoRefill, TerminalButtonItemStackCraftingGridBalance, TerminalButtonItemStackCraftingGridClear, TerminalButtonScaleGui, TerminalButtonSort

public interface ITerminalButton<C extends ITerminalStorageTabClient,O extends ITerminalStorageTabCommon,B extends net.minecraft.client.gui.components.Button>
  • Method Summary

    Modifier and Type
    Method
    Description
    createButton(int x, int y)
    Create a gui button for displaying this button.
    void
    getTooltip(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.TooltipFlag tooltipFlag, List<net.minecraft.network.chat.Component> lines)
    Get the tooltip of this sorter.
     
    default int
    getX(int guiLeft, int offset, int gridXSize, int gridYSize, int playerInventoryOffsetX, int playerInventoryOffsetY)
    Calculate the final X position for this button.
    default int
    getY(int guiTop, int offset, int gridXSize, int gridYSize, int playerInventoryOffsetX, int playerInventoryOffsetY)
    Calculate the final Y position for this button.
    default boolean
     
    void
    onClick(C clientTab, O commonTab, B guiButton, int channel, int mouseButton)
    Callback for when the gui button has been clicked.
    void
    Reload the button's visual representation based on the container's state.
  • Method Details

    • reloadFromState

      void reloadFromState()
      Reload the button's visual representation based on the container's state.
    • getX

      default int getX(int guiLeft, int offset, int gridXSize, int gridYSize, int playerInventoryOffsetX, int playerInventoryOffsetY)
      Calculate the final X position for this button.
      Parameters:
      guiLeft - Gui left X
      offset - X offset.
      gridXSize - The X size of the grid.
      gridYSize - The Y size of the grid.
      playerInventoryOffsetX - The X offset of the player inventory.
      playerInventoryOffsetY - The Y offset of the player inventory.
      Returns:
      The final X position.
    • getY

      default int getY(int guiTop, int offset, int gridXSize, int gridYSize, int playerInventoryOffsetX, int playerInventoryOffsetY)
      Calculate the final Y position for this button.
      Parameters:
      guiTop - Gui top Y
      offset - Y offset.
      gridXSize - The X size of the grid.
      gridYSize - The Y size of the grid.
      playerInventoryOffsetX - The X offset of the player inventory.
      playerInventoryOffsetY - The Y offset of the player inventory.
      Returns:
      The final Y position.
    • isInLeftColumn

      default boolean isInLeftColumn()
      Returns:
      If the button should be placed in the left grid column.
    • createButton

      B createButton(int x, int y)
      Create a gui button for displaying this button.
      Parameters:
      x - The button X position.
      y - The button Y position.
      Returns:
      The gui button.
    • onClick

      void onClick(C clientTab, @Nullable O commonTab, B guiButton, int channel, int mouseButton)
      Callback for when the gui button has been clicked.
      Parameters:
      clientTab - The client tab in which the button was clicked.
      commonTab - The common tab in which the button was clicked.
      guiButton - The gui button.
      channel - The active channel.
      mouseButton - The mouse button that was used to click with.
    • getTranslationKey

      String getTranslationKey()
      Returns:
      The unlocalized name
    • getTooltip

      void getTooltip(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.TooltipFlag tooltipFlag, List<net.minecraft.network.chat.Component> lines)
      Get the tooltip of this sorter.
      Parameters:
      player - The player that is requesting the tooltip.
      tooltipFlag - The tooltip flag.
      lines - The tooltip lines.