Class RecipeBookWidget
java.lang.Object
net.minecraft.client.gui.DrawableHelper
net.minecraft.client.gui.screen.recipebook.RecipeBookWidget
- All Implemented Interfaces:
Drawable,Element,RecipeDisplayListener,RecipeGridAligner<Ingredient>
- Direct Known Subclasses:
AbstractFurnaceRecipeBookScreen
@Environment(CLIENT) public class RecipeBookWidget extends DrawableHelper implements Drawable, Element, RecipeDisplayListener, RecipeGridAligner<Ingredient>
-
Field Summary
Fields Modifier and Type Field Description private intcachedInvChangeCountprotected MinecraftClientclientprotected AbstractRecipeScreenHandler<?>craftingScreenHandlerprivate RecipeGroupButtonWidgetcurrentTabprotected RecipeBookGhostSlotsghostSlotsprivate intleftOffsetprivate intparentHeightprivate intparentWidthprivate ClientRecipeBookrecipeBookprivate RecipeFinderrecipeFinderprivate RecipeBookResultsrecipesAreaprivate static TextSEARCH_HINT_TEXTprivate TextFieldWidgetsearchFieldprivate booleansearchingprivate StringsearchTextprivate List<RecipeGroupButtonWidget>tabButtonsprotected static IdentifierTEXTUREprivate static TextTOGGLE_ALL_RECIPES_TEXTprivate static TextTOGGLE_CRAFTABLE_RECIPES_TEXTprotected ToggleButtonWidgettoggleCraftableButtonFields inherited from class net.minecraft.client.gui.DrawableHelper
GUI_ICONS_TEXTURE, OPTIONS_BACKGROUND_TEXTURE, STATS_ICON_TEXTURE -
Constructor Summary
Constructors Constructor Description RecipeBookWidget() -
Method Summary
Modifier and Type Method Description voidacceptAlignedInput(Iterator<Ingredient> inputs, int slot, int amount, int gridX, int gridY)booleanchangeFocus(boolean lookForwards)Changes the focusing element by cycling to the next/previous element.booleancharTyped(char chr, int keyCode)Callback for when a character input has been captured.voidclose()voiddrawGhostSlots(MatrixStack matrixStack, int int2, int int3, boolean bool, float float2)private voiddrawGhostSlotTooltip(MatrixStack matrixStack, int int2, int int3, int int4, int int5)voiddrawTooltip(MatrixStack matrixStack, int int2, int int3, int int4, int int5)intfindLeftEdge(boolean narrow, int width, int parentWidth)private TextgetCraftableButtonText()protected TextgetToggleCraftableButtonText()voidinitialize(int parentWidth, int parentHeight, MinecraftClient client, boolean narrow, AbstractRecipeScreenHandler<?> craftingScreenHandler)booleanisClickOutsideBounds(double double2, double double3, int int2, int int3, int int4, int int5, int int6)booleanisMouseOver(double mouseX, double mouseY)Checks if the mouse position is within the bound of the element.booleanisOpen()private booleanisWide()booleankeyPressed(int keyCode, int scanCode, int modifiers)Callback for when a key down event has been captured.booleankeyReleased(int keyCode, int scanCode, int modifiers)Callback for when a key down event has been captured.booleanmouseClicked(double mouseX, double mouseY, int button)Callback for when a mouse button down event has been captured.voidonRecipesDisplayed(List<Recipe<?>> recipes)voidrefresh()private voidrefreshInputs()private voidrefreshResults(boolean resetCurrentPage)private voidrefreshSearchResults()private voidrefreshTabButtons()voidrender(MatrixStack matrices, int mouseX, int mouseY, float delta)voidreset(boolean narrow)protected voidsendBookDataPacket()protected voidsetBookButtonTexture()protected voidsetOpen(boolean opened)voidshowGhostRecipe(Recipe<?> recipe, List<Slot> slots)voidslotClicked(Slot slot)private booleantoggleFilteringCraftable()voidtoggleOpen()private voidtriggerPirateSpeakEasterEgg(String string)voidupdate()Methods inherited from class net.minecraft.client.gui.DrawableHelper
drawCenteredString, drawCenteredText, drawHorizontalLine, drawSprite, drawStringWithShadow, drawTexture, drawTexture, drawTexture, drawTexture, drawTextWithShadow, drawVerticalLine, fill, fillGradient, fillGradient, getZOffset, method_29343, method_33284, setZOffsetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.client.gui.Element
mouseDragged, mouseMoved, mouseReleased, mouseScrolledMethods inherited from interface net.minecraft.recipe.RecipeGridAligner
alignRecipeToGrid
-
Field Details
-
TEXTURE
-
SEARCH_HINT_TEXT
-
TOGGLE_CRAFTABLE_RECIPES_TEXT
-
TOGGLE_ALL_RECIPES_TEXT
-
leftOffset
private int leftOffset -
parentWidth
private int parentWidth -
parentHeight
private int parentHeight -
ghostSlots
-
tabButtons
-
currentTab
-
toggleCraftableButton
-
craftingScreenHandler
-
client
-
searchField
-
searchText
-
recipeBook
-
recipesArea
-
recipeFinder
-
cachedInvChangeCount
private int cachedInvChangeCount -
searching
private boolean searching
-
-
Constructor Details
-
RecipeBookWidget
public RecipeBookWidget()
-
-
Method Details
-
initialize
public void initialize(int parentWidth, int parentHeight, MinecraftClient client, boolean narrow, AbstractRecipeScreenHandler<?> craftingScreenHandler) -
reset
public void reset(boolean narrow) -
changeFocus
public boolean changeFocus(boolean lookForwards)Changes the focusing element by cycling to the next/previous element. This action is done typically when the user has pressed the 'Tab' or 'Ctrl+Tab' key.- Specified by:
changeFocusin interfaceElement- Parameters:
lookForwards-trueto cycle forwards, otherwise cycle backwards- Returns:
trueto indicate that the event handling is successful/valid
-
setBookButtonTexture
protected void setBookButtonTexture() -
close
public void close() -
findLeftEdge
public int findLeftEdge(boolean narrow, int width, int parentWidth) -
toggleOpen
public void toggleOpen() -
isOpen
public boolean isOpen() -
setOpen
protected void setOpen(boolean opened) -
slotClicked
-
refreshResults
private void refreshResults(boolean resetCurrentPage) -
refreshTabButtons
private void refreshTabButtons() -
update
public void update() -
refreshInputs
private void refreshInputs() -
render
-
drawTooltip
-
getCraftableButtonText
-
getToggleCraftableButtonText
-
drawGhostSlotTooltip
-
drawGhostSlots
public void drawGhostSlots(MatrixStack matrixStack, int int2, int int3, boolean bool, float float2) -
mouseClicked
public boolean mouseClicked(double mouseX, double mouseY, int button)Callback for when a mouse button down event has been captured. The button number is identified by the constants inGLFWclass.- Specified by:
mouseClickedin interfaceElement- Parameters:
mouseX- the X coordinate of the mousemouseY- the Y coordinate of the mousebutton- the mouse button number- Returns:
trueto indicate that the event handling is successful/valid- See Also:
Mouse.onMouseButton(long, int, int, int),GLFW.GLFW_MOUSE_BUTTON_1
-
toggleFilteringCraftable
private boolean toggleFilteringCraftable() -
isClickOutsideBounds
public boolean isClickOutsideBounds(double double2, double double3, int int2, int int3, int int4, int int5, int int6) -
keyPressed
public boolean keyPressed(int keyCode, int scanCode, int modifiers)Callback for when a key down event has been captured. The key code is identified by the constants inGLFWclass.- Specified by:
keyPressedin interfaceElement- Parameters:
keyCode- the named key code of the event as described in theGLFWclassscanCode- the unique/platform-specific scan code of the keyboard inputmodifiers- a GLFW bitfield describing the modifier keys that are held down (see GLFW Modifier key flags)- Returns:
trueto indicate that the event handling is successful/valid- See Also:
Keyboard.onKey(long, int, int, int, int),GLFW.GLFW_KEY_Q,GLFWKeyCallbackI.invoke(long, int, int, int, int)
-
keyReleased
public boolean keyReleased(int keyCode, int scanCode, int modifiers)Callback for when a key down event has been captured. The key code is identified by the constants inGLFWclass.- Specified by:
keyReleasedin interfaceElement- Parameters:
keyCode- the named key code of the event as described in theGLFWclassscanCode- the unique/platform-specific scan code of the keyboard inputmodifiers- a GLFW bitfield describing the modifier keys that are held down (see GLFW Modifier key flags)- Returns:
trueto indicate that the event handling is successful/valid- See Also:
Keyboard.onKey(long, int, int, int, int),GLFW.GLFW_KEY_Q,GLFWKeyCallbackI.invoke(long, int, int, int, int)
-
charTyped
public boolean charTyped(char chr, int keyCode)Callback for when a character input has been captured. The key code is identified by the constants inGLFWclass.- Specified by:
charTypedin interfaceElement- Parameters:
chr- the captured characterkeyCode- the associated key code- Returns:
trueto indicate that the event handling is successful/valid- See Also:
Keyboard.onChar(long, int, int),GLFW.GLFW_KEY_Q,GLFWKeyCallbackI.invoke(long, int, int, int, int)
-
isMouseOver
public boolean isMouseOver(double mouseX, double mouseY)Checks if the mouse position is within the bound of the element.- Specified by:
isMouseOverin interfaceElement- Parameters:
mouseX- the X coordinate of the mousemouseY- the Y coordinate of the mouse- Returns:
trueif the mouse is within the bound of the element, otherwisefalse
-
refreshSearchResults
private void refreshSearchResults() -
triggerPirateSpeakEasterEgg
-
isWide
private boolean isWide() -
refresh
public void refresh() -
onRecipesDisplayed
- Specified by:
onRecipesDisplayedin interfaceRecipeDisplayListener
-
showGhostRecipe
-
acceptAlignedInput
public void acceptAlignedInput(Iterator<Ingredient> inputs, int slot, int amount, int gridX, int gridY)- Specified by:
acceptAlignedInputin interfaceRecipeGridAligner<Ingredient>
-
sendBookDataPacket
protected void sendBookDataPacket()
-