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

  • 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()
    • updateFilterButtonTooltip

      private void updateFilterButtonTooltip()
    • initFilterButtonTextures

      protected abstract void initFilterButtonTextures()
    • 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 pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick)
      Renders the graphical user interface (GUI) element.
      Specified by:
      render in interface Renderable
      Parameters:
      pGuiGraphics - the GuiGraphics object used for rendering.
      pMouseX - the x-coordinate of the mouse cursor.
      pMouseY - the y-coordinate of the mouse cursor.
      pPartialTick - 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(double pMouseX, double pMouseY, int pButton)
      Called when a mouse button is clicked within the GUI element.

      Specified by:
      mouseClicked in interface GuiEventListener
      Parameters:
      pMouseX - the X coordinate of the mouse.
      pMouseY - the Y coordinate of the mouse.
      pButton - the button that was clicked.
      Returns:
      true if the event is consumed, false otherwise.
    • tryPlaceRecipe

      private boolean tryPlaceRecipe(RecipeCollection pRecipeCollection, RecipeDisplayId pRecipe)
    • toggleFiltering

      private boolean toggleFiltering()
    • hasClickedOutside

      public boolean hasClickedOutside(double pMouseX, double pMouseY, int pX, int pY, int pWidth, int pHeight, int pMouseButton)
    • keyPressed

      public boolean keyPressed(int pKeyCode, int pScanCode, int pModifiers)
      Called when a keyboard key is pressed within the GUI element.

      Specified by:
      keyPressed in interface GuiEventListener
      Parameters:
      pKeyCode - the key code of the pressed key.
      pScanCode - the scan code of the pressed key.
      pModifiers - the keyboard modifiers.
      Returns:
      true if the event is consumed, false otherwise.
    • keyReleased

      public boolean keyReleased(int pKeyCode, int pScanCode, int pModifiers)
      Called when a keyboard key is released within the GUI element.

      Specified by:
      keyReleased in interface GuiEventListener
      Parameters:
      pKeyCode - the key code of the released key.
      pScanCode - the scan code of the released key.
      pModifiers - the keyboard modifiers.
      Returns:
      true if the event is consumed, false otherwise.
    • charTyped

      public boolean charTyped(char pCodePoint, int pModifiers)
      Called when a character is typed within the GUI element.

      Specified by:
      charTyped in interface GuiEventListener
      Parameters:
      pCodePoint - the code point of the typed character.
      pModifiers - the keyboard modifiers.
      Returns:
      true if the event is consumed, false otherwise.
    • isMouseOver

      public boolean isMouseOver(double pMouseX, double pMouseY)
      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 pFocused)
      Sets the focus state of the GUI element.
      Specified by:
      setFocused in interface GuiEventListener
      Parameters:
      pFocused - 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 pNarrationElementOutput)
      Updates the narration output with the current narration information.
      Specified by:
      updateNarration in interface NarrationSupplier
      Parameters:
      pNarrationElementOutput - the output to update with narration information.