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
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface net.minecraft.client.gui.narration.NarratableEntry
NarratableEntry.NarrationPriority -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Componentprivate static final intprivate static final intprivate ClientRecipeBookprivate static final intprotected StateSwitchingButtonprivate final GhostSlotsprivate intprivate booleanstatic final intstatic final intprivate RecipeDisplayIdprivate RecipeDisplayIdprivate RecipeCollectionprivate Stringprivate ScreenRectangleprotected final Tprotected Minecraftprivate static final intprotected static final ResourceLocationstatic final WidgetSpritesprivate final RecipeBookPageprivate static final Componentprivate EditBoxprivate RecipeBookTabButtonprivate final StackedItemContentsprivate final List<RecipeBookTabButton> private final List<RecipeBookComponent.TabInfo> private static final intprivate floatprivate intprivate booleanprivate intprivate booleanprivate intFields inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
DOUBLE_CLICK_THRESHOLD_MS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancharTyped(char codePoint, int modifiers) Called when a character is typed within the GUI element.private voidprotected abstract voidfillGhostRecipe(GhostSlots ghostSlots, RecipeDisplay recipeDisplay, ContextMap contextMap) voidfillGhostRecipe(RecipeDisplay recipeDisplay) protected abstract Componentprivate intprivate intbooleanhasClickedOutside(double mouseX, double mouseY, int x, int y, int width, int height, int mouseButton) voidprotected abstract voidprivate voidprotected abstract booleanisCraftingSlot(Slot slot) private booleanbooleanbooleanisMouseOver(double mouseX, double mouseY) Checks if the given mouse coordinates are over the GUI element.private booleanbooleanprivate booleanbooleankeyPressed(int keyCode, int scanCode, int modifiers) Called when a keyboard key is pressed within the GUI element.booleankeyReleased(int keyCode, int scanCode, int modifiers) Called when a keyboard key is released within the GUI element.booleanmouseClicked(double mouseX, double mouseY, int button) Called when a mouse button is clicked within the GUI element.private voidCheck if we should activate the pirate speak easter egg.voidrecipeShown(RecipeDisplayId recipe) voidvoidrender(GuiGraphics p_283597_, int p_282668_, int p_283506_, float p_282813_) Renders the graphical user interface (GUI) element.voidrenderGhostRecipe(GuiGraphics guiGraphics, boolean isBiggerResultSlot) voidrenderTooltip(GuiGraphics guiGraphics, int mouseX, int mouseY, Slot slot) private voidprotected abstract voidselectMatchingRecipes(RecipeCollection possibleRecipes, StackedItemContents stackedItemContents) protected voidvoidsetFocused(boolean p_265089_) Sets the focus state of the GUI element.protected voidsetVisible(boolean visible) voidslotClicked(Slot slot) voidtick()private booleanvoidprivate booleantryPlaceRecipe(RecipeCollection recipeCollection, RecipeDisplayId recipe) private voidupdateCollections(boolean resetPageNumber, boolean isFiltering) private voidvoidupdateNarration(NarrationElementOutput p_170046_) Updates the narration output with the current narration information.intupdateScreenPosition(int width, int imageWidth) private voidprivate voidupdateTabs(boolean isFiltering) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
getBorderForArrowNavigation, getCurrentFocusPath, getRectangle, mouseDragged, mouseMoved, mouseReleased, mouseScrolled, nextFocusPathMethods inherited from interface net.minecraft.client.gui.narration.NarratableEntry
getNarratables, isActiveMethods inherited from interface net.minecraft.client.gui.components.TabOrderedElement
getTabOrderGroup
-
Field Details
-
RECIPE_BUTTON_SPRITES
-
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
-
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
-
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
-
ghostSlots
-
tabButtons
-
selectedTab
-
filterButton
-
minecraft
-
searchBox
-
lastSearch
-
tabInfos
-
book
-
recipeBookPage
-
lastRecipe
-
lastRecipeCollection
-
stackedContents
-
timesInventoryChanged
private int timesInventoryChanged -
ignoreTextInput
private boolean ignoreTextInput -
visible
private boolean visible -
widthTooNarrow
private boolean widthTooNarrow -
magnifierIconPlacement
-
-
Constructor Details
-
RecipeBookComponent
-
-
Method Details
-
init
-
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 width, int imageWidth) -
toggleVisibility
public void toggleVisibility() -
isVisible
public boolean isVisible() -
isVisibleAccordingToBookData
private boolean isVisibleAccordingToBookData() -
setVisible
protected void setVisible(boolean visible) -
isCraftingSlot
-
slotClicked
-
selectMatchingRecipes
private void selectMatchingRecipes() -
selectMatchingRecipes
protected abstract void selectMatchingRecipes(RecipeCollection possibleRecipes, StackedItemContents stackedItemContents) -
updateCollections
private void updateCollections(boolean resetPageNumber, boolean isFiltering) -
updateTabs
private void updateTabs(boolean isFiltering) -
tick
public void tick() -
updateStackedContents
private void updateStackedContents() -
isFiltering
private boolean isFiltering() -
render
Description copied from interface:RenderableRenders the graphical user interface (GUI) element.- Specified by:
renderin interfaceRenderable- 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
-
getRecipeFilterName
-
renderGhostRecipe
-
mouseClicked
public boolean mouseClicked(double mouseX, double mouseY, int button) Description copied from interface:GuiEventListenerCalled when a mouse button is clicked within the GUI element.- Specified by:
mouseClickedin interfaceGuiEventListener- Parameters:
mouseX- the X coordinate of the mouse.mouseY- the Y coordinate of the mouse.button- the button that was clicked.- Returns:
trueif the event is consumed,falseotherwise.
-
tryPlaceRecipe
-
toggleFiltering
private boolean toggleFiltering() -
hasClickedOutside
public boolean hasClickedOutside(double mouseX, double mouseY, int x, int y, int width, int height, int mouseButton) -
keyPressed
public boolean keyPressed(int keyCode, int scanCode, int modifiers) Description copied from interface:GuiEventListenerCalled when a keyboard key is pressed within the GUI element.- Specified by:
keyPressedin interfaceGuiEventListener- Parameters:
keyCode- the key code of the pressed key.scanCode- the scan code of the pressed key.modifiers- the keyboard modifiers.- Returns:
trueif the event is consumed,falseotherwise.
-
keyReleased
public boolean keyReleased(int keyCode, int scanCode, int modifiers) Description copied from interface:GuiEventListenerCalled when a keyboard key is released within the GUI element.- Specified by:
keyReleasedin interfaceGuiEventListener- Parameters:
keyCode- the key code of the released key.scanCode- the scan code of the released key.modifiers- the keyboard modifiers.- Returns:
trueif the event is consumed,falseotherwise.
-
charTyped
public boolean charTyped(char codePoint, int modifiers) Description copied from interface:GuiEventListenerCalled when a character is typed within the GUI element.- Specified by:
charTypedin interfaceGuiEventListener- Parameters:
codePoint- the code point of the typed character.modifiers- the keyboard modifiers.- Returns:
trueif the event is consumed,falseotherwise.
-
isMouseOver
public boolean isMouseOver(double mouseX, double mouseY) Description copied from interface:GuiEventListenerChecks if the given mouse coordinates are over the GUI element.- Specified by:
isMouseOverin interfaceGuiEventListener- Parameters:
mouseX- the X coordinate of the mouse.mouseY- the Y coordinate of the mouse.- Returns:
trueif the mouse is over the GUI element,falseotherwise.
-
setFocused
public void setFocused(boolean p_265089_) Description copied from interface:GuiEventListenerSets the focus state of the GUI element.- Specified by:
setFocusedin interfaceGuiEventListener- Parameters:
p_265089_-trueto apply focus,falseto remove focus
-
isFocused
public boolean isFocused()- Specified by:
isFocusedin interfaceGuiEventListener
-
checkSearchStringUpdate
private void checkSearchStringUpdate() -
pirateSpeechForThePeople
Check if we should activate the pirate speak easter egg. -
isOffsetNextToMainGUI
private boolean isOffsetNextToMainGUI() -
recipesUpdated
public void recipesUpdated() -
recipeShown
-
fillGhostRecipe
-
fillGhostRecipe
protected abstract void fillGhostRecipe(GhostSlots ghostSlots, RecipeDisplay recipeDisplay, ContextMap contextMap) -
sendUpdateSettings
protected void sendUpdateSettings() -
narrationPriority
- Specified by:
narrationPriorityin interfaceNarratableEntry
-
updateNarration
Description copied from interface:NarrationSupplierUpdates the narration output with the current narration information.- Specified by:
updateNarrationin interfaceNarrationSupplier- Parameters:
p_170046_- the output to update with narration information.
-