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 Renderable, GuiEventListener, 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 pWidth, int pHeight, Minecraft pMinecraft, boolean pWidthTooNarrow)
    • initVisuals

      private void initVisuals()
    • getYOrigin

      private int getYOrigin()
    • getXOrigin

      private int getXOrigin()
    • getFilterButtonTextures

      protected abstract WidgetSprites getFilterButtonTextures()
    • updateScreenPosition

      public int updateScreenPosition(int pWidth, int pImageWidth)
    • toggleVisibility

      public void toggleVisibility()
    • isVisible

      public boolean isVisible()
    • isVisibleAccordingToBookData

      private boolean isVisibleAccordingToBookData()
    • setVisible

      protected void setVisible(boolean pVisible)
    • isCraftingSlot

      protected abstract boolean isCraftingSlot(Slot pSlot)
    • slotClicked

      public void slotClicked(@Nullable Slot pSlot)
    • selectMatchingRecipes

      private void selectMatchingRecipes()
    • selectMatchingRecipes

      protected abstract void selectMatchingRecipes(RecipeCollection pPossibleRecipes, StackedItemContents pStackedItemContents)
    • updateCollections

      private void updateCollections(boolean pResetPageNumber, boolean pIsFiltering)
    • updateTabs

      private void updateTabs(boolean pIsFiltering)
    • tick

      public void tick()
    • updateStackedContents

      private void updateStackedContents()
    • isFiltering

      private boolean isFiltering()
    • render

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

      public void renderTooltip(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, @Nullable Slot pSlot)
    • getRecipeFilterName

      protected abstract Component getRecipeFilterName()
    • renderGhostRecipe

      public void renderGhostRecipe(GuiGraphics pGuiGraphics, boolean pIsBiggerResultSlot)
    • mouseClicked

      public boolean mouseClicked(MouseButtonEvent p_445929_, boolean p_435607_)
      Specified by:
      mouseClicked in interface GuiEventListener
    • mouseDragged

      public boolean mouseDragged(MouseButtonEvent p_445840_, double p_443629_, double p_442850_)
      Specified by:
      mouseDragged in interface GuiEventListener
    • tryPlaceRecipe

      private boolean tryPlaceRecipe(RecipeCollection pRecipeCollection, RecipeDisplayId pRecipe, boolean pUseMaxItems)
    • onTabButtonPress

      private void onTabButtonPress(Button pButton)
    • replaceSelected

      private void replaceSelected(RecipeBookTabButton pTab)
    • toggleFiltering

      private void toggleFiltering()
    • hasClickedOutside

      public boolean hasClickedOutside(double pX, double pY, int pLeft, int pTop, int pWidth, int pHeight)
    • keyPressed

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

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

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

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

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

      public void setFocused(boolean p_265089_)
      Description copied from interface: GuiEventListener
      Sets the focus state of the GUI element.
      Specified by:
      setFocused in interface GuiEventListener
      Parameters:
      p_265089_ - 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 pText)
      Check if we should activate the pirate speak easter egg.
    • isOffsetNextToMainGUI

      private boolean isOffsetNextToMainGUI()
    • recipesUpdated

      public void recipesUpdated()
    • recipeShown

      public void recipeShown(RecipeDisplayId pRecipe)
    • fillGhostRecipe

      public void fillGhostRecipe(RecipeDisplay pRecipeDisplay)
    • fillGhostRecipe

      protected abstract void fillGhostRecipe(GhostSlots pGhostSlots, RecipeDisplay pRecipeDisplay, ContextMap pContextMap)
    • sendUpdateSettings

      protected void sendUpdateSettings()
    • narrationPriority

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

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