Class RecipeBookComponent<T extends RecipeBookMenu>

java.lang.Object
net.minecraft.client.gui.screens.recipebook.RecipeBookComponent<T>
All Implemented Interfaces:
GuiEventListener, Renderable, TabOrderedElement, NarratableEntry, NarrationSupplier
Direct Known Subclasses:
CraftingRecipeBookComponent, FurnaceRecipeBookComponent

public abstract class RecipeBookComponent<T extends RecipeBookMenu> extends Object implements GuiEventListener, Renderable, NarratableEntry
  • Field Details

    • RECIPE_BUTTON_SPRITES

      public static final WidgetSprites RECIPE_BUTTON_SPRITES
    • RECIPE_BOOK_LOCATION

      protected static final Identifier RECIPE_BOOK_LOCATION
    • BACKGROUND_TEXTURE_WIDTH

      private static final int BACKGROUND_TEXTURE_WIDTH
      See Also:
    • BACKGROUND_TEXTURE_HEIGHT

      private static final int BACKGROUND_TEXTURE_HEIGHT
      See Also:
    • SEARCH_HINT

      private static final Component SEARCH_HINT
    • IMAGE_WIDTH

      public static final int IMAGE_WIDTH
      See Also:
    • IMAGE_HEIGHT

      public static final int IMAGE_HEIGHT
      See Also:
    • OFFSET_X_POSITION

      private static final int OFFSET_X_POSITION
      See Also:
    • BORDER_WIDTH

      private static final int BORDER_WIDTH
      See Also:
    • ALL_RECIPES_TOOLTIP

      private static final Component ALL_RECIPES_TOOLTIP
    • TICKS_TO_SWAP_SLOT

      private static final int TICKS_TO_SWAP_SLOT
      See Also:
    • xOffset

      private int xOffset
    • width

      private int width
    • height

      private int height
    • time

      private float time
    • lastPlacedRecipe

      private @Nullable RecipeDisplayId lastPlacedRecipe
    • ghostSlots

      private final GhostSlots ghostSlots
    • tabButtons

      private final List<RecipeBookTabButton> tabButtons
    • selectedTab

      private @Nullable RecipeBookTabButton selectedTab
    • filterButton

      protected CycleButton<Boolean> filterButton
    • minecraft

      protected Minecraft minecraft
    • lastSearch

      private String lastSearch
    • tabInfos

      private final List<RecipeBookComponent.TabInfo> tabInfos
    • book

      private ClientRecipeBook book
    • recipeBookPage

      private final RecipeBookPage recipeBookPage
    • lastRecipe

      private @Nullable RecipeDisplayId lastRecipe
    • lastRecipeCollection

      private @Nullable RecipeCollection lastRecipeCollection
    • stackedContents

      private final StackedItemContents stackedContents
    • timesInventoryChanged

      private int timesInventoryChanged
    • ignoreTextInput

      private boolean ignoreTextInput
    • visible

      private boolean visible
    • widthTooNarrow

      private boolean widthTooNarrow
    • magnifierIconPlacement

      private @Nullable ScreenRectangle magnifierIconPlacement
  • Constructor Details

  • Method Details

    • init

      public void init(int width, int height, Minecraft minecraft, boolean widthTooNarrow)
    • initVisuals

      private void initVisuals()
    • getYOrigin

      private int getYOrigin()
    • getXOrigin

      private int getXOrigin()
    • getFilterButtonTextures

      protected abstract WidgetSprites getFilterButtonTextures()
    • updateScreenPosition

      public int updateScreenPosition(int width, int imageWidth)
    • toggleVisibility

      public void toggleVisibility()
    • isVisible

      public boolean isVisible()
    • isVisibleAccordingToBookData

      private boolean isVisibleAccordingToBookData()
    • setVisible

      protected void setVisible(boolean visible)
    • isCraftingSlot

      protected abstract boolean isCraftingSlot(Slot slot)
    • slotClicked

      public void slotClicked(@Nullable Slot slot)
    • selectMatchingRecipes

      private void selectMatchingRecipes()
    • selectMatchingRecipes

      protected abstract void selectMatchingRecipes(RecipeCollection collection, StackedItemContents stackedContents)
    • updateCollections

      private void updateCollections(boolean resetPage, boolean isFiltering)
    • updateTabs

      private void updateTabs(boolean isFiltering)
    • tick

      public void tick()
    • updateStackedContents

      private void updateStackedContents()
    • isFiltering

      private boolean isFiltering()
    • render

      public void render(GuiGraphics graphics, int mouseX, int mouseY, float a)
      Description copied from interface: Renderable
      Renders the graphical user interface (GUI) element.
      Specified by:
      render in interface Renderable
      Parameters:
      graphics - the GuiGraphics object used for rendering.
      mouseX - the x-coordinate of the mouse cursor.
      mouseY - the y-coordinate of the mouse cursor.
      a - the partial tick time.
    • renderTooltip

      public void renderTooltip(GuiGraphics graphics, int mouseX, int mouseY, @Nullable Slot hoveredSlot)
    • getRecipeFilterName

      protected abstract Component getRecipeFilterName()
    • renderGhostRecipe

      public void renderGhostRecipe(GuiGraphics graphics, boolean isResultSlotBig)
    • mouseClicked

      public boolean mouseClicked(MouseButtonEvent event, boolean doubleClick)
      Specified by:
      mouseClicked in interface GuiEventListener
    • mouseDragged

      public boolean mouseDragged(MouseButtonEvent event, double dx, double dy)
      Specified by:
      mouseDragged in interface GuiEventListener
    • tryPlaceRecipe

      private boolean tryPlaceRecipe(RecipeCollection recipeCollection, RecipeDisplayId recipe, boolean useMaxItems)
    • onTabButtonPress

      private void onTabButtonPress(Button button)
    • replaceSelected

      private void replaceSelected(RecipeBookTabButton tabButton)
    • toggleFiltering

      private void toggleFiltering()
    • hasClickedOutside

      public boolean hasClickedOutside(double mx, double my, int leftPos, int topPos, int imageWidth, int imageHeight)
    • keyPressed

      public boolean keyPressed(KeyEvent event)
      Specified by:
      keyPressed in interface GuiEventListener
    • keyReleased

      public boolean keyReleased(KeyEvent event)
      Specified by:
      keyReleased in interface GuiEventListener
    • charTyped

      public boolean charTyped(CharacterEvent event)
      Specified by:
      charTyped in interface GuiEventListener
    • isMouseOver

      public boolean isMouseOver(double mouseX, double mouseY)
      Description copied from interface: GuiEventListener
      Checks if the given mouse coordinates are over the GUI element.

      Specified by:
      isMouseOver in interface GuiEventListener
      Parameters:
      mouseX - the X coordinate of the mouse.
      mouseY - the Y coordinate of the mouse.
      Returns:
      true if the mouse is over the GUI element, false otherwise.
    • setFocused

      public void setFocused(boolean focused)
      Description copied from interface: GuiEventListener
      Sets the focus state of the GUI element.
      Specified by:
      setFocused in interface GuiEventListener
      Parameters:
      focused - true to apply focus, false to remove focus
    • isFocused

      public boolean isFocused()
      Specified by:
      isFocused in interface GuiEventListener
    • checkSearchStringUpdate

      private void checkSearchStringUpdate()
    • pirateSpeechForThePeople

      private void pirateSpeechForThePeople(String searchTarget)
      Check if we should activate the pirate speak easter egg.
    • isOffsetNextToMainGUI

      private boolean isOffsetNextToMainGUI()
    • recipesUpdated

      public void recipesUpdated()
    • recipeShown

      public void recipeShown(RecipeDisplayId recipe)
    • fillGhostRecipe

      public void fillGhostRecipe(RecipeDisplay recipe)
    • fillGhostRecipe

      protected abstract void fillGhostRecipe(GhostSlots ghostSlots, RecipeDisplay recipe, ContextMap context)
    • sendUpdateSettings

      protected void sendUpdateSettings()
    • narrationPriority

      public NarratableEntry.NarrationPriority narrationPriority()
      Specified by:
      narrationPriority in interface NarratableEntry
    • updateNarration

      public void updateNarration(NarrationElementOutput output)
      Description copied from interface: NarrationSupplier
      Updates the narration output with the current narration information.
      Specified by:
      updateNarration in interface NarrationSupplier
      Parameters:
      output - the output to update with narration information.