Interface TooltipContext


@NullMarked public interface TooltipContext
Context for computing itemstack tooltips via ItemStack.computeTooltipLines(TooltipContext, Player)
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a new context with isAdvanced() set to true.
    Returns a new context with isCreative() set to true.
    Creates a new context that is neither advanced nor creative.
    create(boolean advanced, boolean creative)
    Creates a new context with the given advanced and creative mode settings.
    boolean
    Returns whether the context is for advanced tooltips.
    boolean
    Returns whether the context is for the creative mode inventory.
  • Method Details

    • create

      @Contract("_, _ -> new") static TooltipContext create(boolean advanced, boolean creative)
      Creates a new context with the given advanced and creative mode settings.
      Parameters:
      advanced - whether the context is for advanced tooltips
      creative - whether the context is for the creative inventory
      Returns:
      a new context
    • create

      @Contract("-> new") static TooltipContext create()
      Creates a new context that is neither advanced nor creative.
      Returns:
      a new context
    • isAdvanced

      boolean isAdvanced()
      Returns whether the context is for advanced tooltips.

      Advanced tooltips are shown by default when a player has F3+H enabled.

      Returns:
      true if for advanced tooltips
    • isCreative

      boolean isCreative()
      Returns whether the context is for the creative mode inventory.

      Creative tooltips are shown by default when a player is in the creative inventory.

      Returns:
      true if for creative mode inventory
    • asAdvanced

      @Contract("-> new") TooltipContext asAdvanced()
      Returns a new context with isAdvanced() set to true.
      Returns:
      a new context
    • asCreative

      @Contract("-> new") TooltipContext asCreative()
      Returns a new context with isCreative() set to true.
      Returns:
      a new context