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 int
cachedInvChangeCount
protected MinecraftClient
client
protected AbstractRecipeScreenHandler<?>
craftingScreenHandler
private RecipeGroupButtonWidget
currentTab
private static Text
field_25711
private static Text
field_26593
private static Text
field_26594
protected RecipeBookGhostSlots
ghostSlots
private int
leftOffset
private int
parentHeight
private int
parentWidth
private ClientRecipeBook
recipeBook
private RecipeFinder
recipeFinder
private RecipeBookResults
recipesArea
private TextFieldWidget
searchField
private boolean
searching
private String
searchText
private List<RecipeGroupButtonWidget>
tabButtons
protected static Identifier
TEXTURE
protected ToggleButtonWidget
toggleCraftableButton
Fields 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 void
acceptAlignedInput(Iterator<Ingredient> inputs, int slot, int amount, int gridX, int gridY)
boolean
changeFocus(boolean lookForwards)
Changes the focusing element by cycling to the next/previous element.boolean
charTyped(char chr, int keyCode)
Callback for when a character input has been captured.void
close()
void
drawGhostSlots(MatrixStack matrixStack, int int2, int int3, boolean bool, float float2)
private void
drawGhostSlotTooltip(MatrixStack matrixStack, int int2, int int3, int int4, int int5)
void
drawTooltip(MatrixStack matrixStack, int int2, int int3, int int4, int int5)
int
findLeftEdge(boolean narrow, int width, int parentWidth)
private Text
getCraftableButtonText()
protected Text
getToggleCraftableButtonText()
void
initialize(int parentWidth, int parentHeight, MinecraftClient client, boolean narrow, AbstractRecipeScreenHandler<?> craftingScreenHandler)
boolean
isClickOutsideBounds(double double2, double double3, int int2, int int3, int int4, int int5, int int6)
boolean
isMouseOver(double mouseX, double mouseY)
Checks if the mouse position is within the bound of the element.boolean
isOpen()
private boolean
isWide()
boolean
keyPressed(int keyCode, int scanCode, int modifiers)
Callback for when a key down event has been captured.boolean
keyReleased(int keyCode, int scanCode, int modifiers)
Callback for when a key down event has been captured.boolean
mouseClicked(double mouseX, double mouseY, int button)
Callback for when a mouse button down event has been captured.void
onRecipesDisplayed(List<Recipe<?>> recipes)
void
refresh()
private void
refreshInputs()
private void
refreshResults(boolean resetCurrentPage)
private void
refreshSearchResults()
private void
refreshTabButtons()
void
render(MatrixStack matrices, int mouseX, int mouseY, float delta)
void
reset(boolean narrow)
protected void
sendBookDataPacket()
protected void
setBookButtonTexture()
protected void
setOpen(boolean opened)
void
showGhostRecipe(Recipe<?> recipe, List<Slot> slots)
void
slotClicked(Slot slot)
private boolean
toggleFilteringCraftable()
void
toggleOpen()
private void
triggerPirateSpeakEasterEgg(String string)
void
update()
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, setZOffset
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.client.gui.Element
mouseDragged, mouseMoved, mouseReleased, mouseScrolled
Methods inherited from interface net.minecraft.recipe.RecipeGridAligner
alignRecipeToGrid
-
Field Details
-
TEXTURE
-
field_25711
-
field_26593
-
field_26594
-
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:
changeFocus
in interfaceElement
- Parameters:
lookForwards
-true
to cycle forwards, otherwise cycle backwards- Returns:
true
to 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 inGLFW
class.- Specified by:
mouseClicked
in interfaceElement
- Parameters:
mouseX
- the X coordinate of the mousemouseY
- the Y coordinate of the mousebutton
- the mouse button number- Returns:
true
to 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 inGLFW
class.- Specified by:
keyPressed
in interfaceElement
- Parameters:
keyCode
- the named key code of the event as described in theGLFW
classscanCode
- the unique/platform-specific scan code of the keyboard inputmodifiers
- a GLFW bitfield describing the modifier keys that are held down (see {@linkplain https://www.glfw.org/docs/3.3/group__mods.html GLFW Modifier key flags})- Returns:
true
to 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 inGLFW
class.- Specified by:
keyReleased
in interfaceElement
- Parameters:
keyCode
- the named key code of the event as described in theGLFW
classscanCode
- the unique/platform-specific scan code of the keyboard inputmodifiers
- a GLFW bitfield describing the modifier keys that are held down (see {@linkplain https://www.glfw.org/docs/3.3/group__mods.html GLFW Modifier key flags})- Returns:
true
to 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 inGLFW
class.- Specified by:
charTyped
in interfaceElement
- Parameters:
chr
- the captured characterkeyCode
- the associated key code- Returns:
true
to 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:
isMouseOver
in interfaceElement
- Parameters:
mouseX
- the X coordinate of the mousemouseY
- the Y coordinate of the mouse- Returns:
true
if 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:
onRecipesDisplayed
in interfaceRecipeDisplayListener
-
showGhostRecipe
-
acceptAlignedInput
public void acceptAlignedInput(Iterator<Ingredient> inputs, int slot, int amount, int gridX, int gridY)- Specified by:
acceptAlignedInput
in interfaceRecipeGridAligner<Ingredient>
-
sendBookDataPacket
protected void sendBookDataPacket()
-