Interface TooltipContext


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

    • create

      @Contract("_, _ -> new") @NotNull static @NotNull 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") @NotNull static @NotNull 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") @NotNull @NotNull TooltipContext asAdvanced()
      Returns a new context with isAdvanced() set to true.
      Returns:
      a new context
    • asCreative

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