Class SuggestionUtil

java.lang.Object
com.mrbysco.spellchecker.util.SuggestionUtil

public class SuggestionUtil extends Object
Utility class for handling suggestions in the chat box
  • Field Details

  • Constructor Details

    • SuggestionUtil

      public SuggestionUtil()
  • Method Details

    • onKeyPressed

      public static void onKeyPressed(net.minecraft.client.input.KeyEvent event, net.minecraft.client.gui.components.EditBox box)
      Called when a key is pressed in the chat box
      Parameters:
      event - The key event
      box - The edit box where the key was pressed
    • onMouseClicked

      public static void onMouseClicked(net.minecraft.client.input.MouseButtonEvent event, boolean isDoubleClick, net.minecraft.client.gui.components.EditBox editBox)
      Called when the mouse is clicked in the chat box
      Parameters:
      event - The mouse button event
      isDoubleClick - If the mouse was double-clicked
      editBox - The editbox
    • hoverBoolean

      protected static boolean hoverBoolean(int mouseX, int mouseY, int x, int y, int width, int height)
      Checks if the mouse is hovering over a specific area
      Parameters:
      mouseX - The x position of the mouse
      mouseY - The y position of the mouse
      x - The x position of the area
      y - The y position of the area
      width - The width of the area
      height - The height of the area
      Returns:
      True if the mouse is hovering over the area, false otherwise
    • addToDictionary

      public static void addToDictionary(net.minecraft.client.gui.components.EditBox box, String word)
      Adds a word to the dictionary and then refreshes the suggestions
      Parameters:
      box - The edit box
      word - The word to add
    • keepSuggestion

      public static void keepSuggestion(net.minecraft.client.gui.components.EditBox box, int x, int y, String word, ArrayList<String> suggestions)
      Keeps the suggested word
      Parameters:
      box - The edit box
      x - The x position of the word
      y - The y position of the word
      word - The word to keep
      suggestions - The suggestions for the word
    • refreshSuggestions

      public static void refreshSuggestions(net.minecraft.client.gui.components.EditBox editBox)
      Refreshes the suggestions for the current input
      Parameters:
      editBox - The edit box
    • getSuggestions

      public static ArrayList<String> getSuggestions(String misspelledWord)
      Get suggestions for a word
      Parameters:
      misspelledWord - The word to get suggestions for
      Returns:
      ArrayList of suggestions
    • stripWord

      public static String stripWord(String locale, String word)
      Strips a word of all non-alphanumeric characters
      Parameters:
      locale - The current locale
      word - The word to strip
      Returns:
      The stripped word
    • isCommandLikeInput

      public static boolean isCommandLikeInput(net.minecraft.client.gui.components.EditBox editBox)
      Checks if the input in the given EditBox is command-like
      Parameters:
      editBox - The EditBox to check
      Returns:
      True if the input is command-like, false otherwise