Class CommandSuggestions

java.lang.Object
net.minecraft.client.gui.components.CommandSuggestions

public class CommandSuggestions extends Object
  • Field Details

    • WHITESPACE_PATTERN

      private static final Pattern WHITESPACE_PATTERN
    • UNPARSED_STYLE

      private static final Style UNPARSED_STYLE
    • LITERAL_STYLE

      private static final Style LITERAL_STYLE
    • USAGE_FORMAT

      public static final Style USAGE_FORMAT
    • ARGUMENT_STYLES

      private static final List<Style> ARGUMENT_STYLES
    • LINE_HEIGHT

      public static final int LINE_HEIGHT
      See Also:
    • USAGE_OFFSET_FROM_BOTTOM

      public static final int USAGE_OFFSET_FROM_BOTTOM
      See Also:
    • COMMANDS_NOT_ALLOWED_TEXT

      private static final Component COMMANDS_NOT_ALLOWED_TEXT
    • MESSAGES_NOT_ALLOWED_TEXT

      private static final Component MESSAGES_NOT_ALLOWED_TEXT
    • minecraft

      private final Minecraft minecraft
    • screen

      private final Screen screen
    • input

      private final EditBox input
    • font

      private final Font font
    • commandsOnly

      private final boolean commandsOnly
    • onlyShowIfCursorPastError

      private final boolean onlyShowIfCursorPastError
    • lineStartOffset

      private final int lineStartOffset
    • suggestionLineLimit

      private final int suggestionLineLimit
    • anchorToBottom

      private final boolean anchorToBottom
    • fillColor

      private final int fillColor
    • commandUsage

      private final List<FormattedCharSequence> commandUsage
    • commandUsagePosition

      private int commandUsagePosition
    • commandUsageWidth

      private int commandUsageWidth
    • currentParse

      private @Nullable com.mojang.brigadier.ParseResults<ClientSuggestionProvider> currentParse
    • pendingSuggestions

      private @Nullable CompletableFuture<com.mojang.brigadier.suggestion.Suggestions> pendingSuggestions
    • suggestions

      private @Nullable CommandSuggestions.SuggestionsList suggestions
    • currentParseIsCommand

      private boolean currentParseIsCommand
    • currentParseIsMessage

      private boolean currentParseIsMessage
    • allowSuggestions

      private boolean allowSuggestions
    • keepSuggestions

      private boolean keepSuggestions
    • allowHiding

      private boolean allowHiding
    • messagesAllowed

      private boolean messagesAllowed
    • commandsAllowed

      private boolean commandsAllowed
  • Constructor Details

    • CommandSuggestions

      public CommandSuggestions(Minecraft minecraft, Screen screen, EditBox input, Font font, boolean commandsOnly, boolean onlyShowIfCursorPastError, int lineStartOffset, int suggestionLineLimit, boolean anchorToBottom, int fillColor)
  • Method Details

    • setAllowSuggestions

      public void setAllowSuggestions(boolean allowSuggestions)
    • setAllowHiding

      public void setAllowHiding(boolean allowHiding)
    • setRestrictions

      public void setRestrictions(boolean messagesAllowed, boolean commandsAllowed)
    • keyPressed

      public boolean keyPressed(KeyEvent event)
    • mouseScrolled

      public boolean mouseScrolled(double scroll)
    • mouseClicked

      public boolean mouseClicked(MouseButtonEvent event)
    • showSuggestions

      public void showSuggestions(boolean immediateNarration)
    • isVisible

      public boolean isVisible()
    • getUsageNarration

      public Component getUsageNarration()
    • hide

      public void hide()
    • sortSuggestions

      private List<com.mojang.brigadier.suggestion.Suggestion> sortSuggestions(com.mojang.brigadier.suggestion.Suggestions suggestions)
    • updateCommandInfo

      public void updateCommandInfo()
    • hasMessageArguments

      private static boolean hasMessageArguments(com.mojang.brigadier.ParseResults<ClientSuggestionProvider> parseResults)
    • getLastWordIndex

      private static int getLastWordIndex(String text)
    • getExceptionMessage

      private static FormattedCharSequence getExceptionMessage(com.mojang.brigadier.exceptions.CommandSyntaxException e)
    • updateUsageInfo

      private void updateUsageInfo(com.mojang.brigadier.ParseResults<ClientSuggestionProvider> currentParse, com.mojang.brigadier.suggestion.Suggestions suggestions)
    • fillNodeUsage

      private List<FormattedCharSequence> fillNodeUsage(com.mojang.brigadier.context.SuggestionContext<ClientSuggestionProvider> suggestionContext, Style usageFormat)
    • recomputeUsageBoxWidth

      private void recomputeUsageBoxWidth()
    • formatChat

      private @Nullable FormattedCharSequence formatChat(String text, int offset)
    • calculateSuggestionSuffix

      private static @Nullable String calculateSuggestionSuffix(String contents, String suggestion)
    • formatText

      private static FormattedCharSequence formatText(com.mojang.brigadier.ParseResults<ClientSuggestionProvider> currentParse, String text, int offset)
    • render

      public void render(GuiGraphics graphics, int mouseX, int mouseY)
    • renderSuggestions

      public boolean renderSuggestions(GuiGraphics graphics, int mouseX, int mouseY)
    • renderUsage

      public void renderUsage(GuiGraphics graphics)
    • getNarrationMessage

      public Component getNarrationMessage()
    • hasAllowedInput

      public boolean hasAllowedInput()