@Environment(value=CLIENT) public class RecipeBookWidget extends DrawableHelper implements Drawable, Element, RecipeDisplayListener, RecipeGridAligner<Ingredient>
Modifier and Type | Field and 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 |
GUI_ICONS_TEXTURE, OPTIONS_BACKGROUND_TEXTURE, STATS_ICON_TEXTURE
Constructor and Description |
---|
RecipeBookWidget() |
Modifier and Type | Method and 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() |
drawCenteredString, drawCenteredText, drawHorizontalLine, drawSprite, drawStringWithShadow, drawTexture, drawTexture, drawTexture, drawTexture, drawTextWithShadow, drawVerticalLine, fill, fillGradient, fillGradient, getZOffset, method_29343, setZOffset
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
mouseDragged, mouseMoved, mouseReleased, mouseScrolled
alignRecipeToGrid
protected static final Identifier TEXTURE
private static final Text field_25711
private static final Text field_26593
private static final Text field_26594
private int leftOffset
private int parentWidth
private int parentHeight
protected final RecipeBookGhostSlots ghostSlots
private final List<RecipeGroupButtonWidget> tabButtons
private RecipeGroupButtonWidget currentTab
protected ToggleButtonWidget toggleCraftableButton
protected AbstractRecipeScreenHandler<?> craftingScreenHandler
protected MinecraftClient client
private TextFieldWidget searchField
private String searchText
private ClientRecipeBook recipeBook
private final RecipeBookResults recipesArea
private final RecipeFinder recipeFinder
private int cachedInvChangeCount
private boolean searching
public void initialize(int parentWidth, int parentHeight, MinecraftClient client, boolean narrow, AbstractRecipeScreenHandler<?> craftingScreenHandler)
public void reset(boolean narrow)
public boolean changeFocus(boolean lookForwards)
changeFocus
in interface Element
lookForwards
- true
to cycle forwards, otherwise cycle backwardstrue
to indicate that the event handling is successful/validprotected void setBookButtonTexture()
public void close()
public int findLeftEdge(boolean narrow, int width, int parentWidth)
public void toggleOpen()
public boolean isOpen()
protected void setOpen(boolean opened)
private void refreshResults(boolean resetCurrentPage)
private void refreshTabButtons()
public void update()
private void refreshInputs()
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta)
public void drawTooltip(MatrixStack matrixStack, int int2, int int3, int int4, int int5)
private Text getCraftableButtonText()
protected Text getToggleCraftableButtonText()
private void drawGhostSlotTooltip(MatrixStack matrixStack, int int2, int int3, int int4, int int5)
public void drawGhostSlots(MatrixStack matrixStack, int int2, int int3, boolean bool, float float2)
public boolean mouseClicked(double mouseX, double mouseY, int button)
GLFW
class.mouseClicked
in interface Element
mouseX
- the X coordinate of the mousemouseY
- the Y coordinate of the mousebutton
- the mouse button numbertrue
to indicate that the event handling is successful/validMouse.onMouseButton(long, int, int, int)
,
GLFW.GLFW_MOUSE_BUTTON_1
private boolean toggleFilteringCraftable()
public boolean isClickOutsideBounds(double double2, double double3, int int2, int int3, int int4, int int5, int int6)
public boolean keyPressed(int keyCode, int scanCode, int modifiers)
GLFW
class.keyPressed
in interface Element
keyCode
- the named key code of the event as described in the GLFW
classscanCode
- 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)true
to indicate that the event handling is successful/validKeyboard.onKey(long, int, int, int, int)
,
GLFW.GLFW_KEY_Q
,
GLFWKeyCallbackI.invoke(long, int, int, int, int)
public boolean keyReleased(int keyCode, int scanCode, int modifiers)
GLFW
class.keyReleased
in interface Element
keyCode
- the named key code of the event as described in the GLFW
classscanCode
- 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)true
to indicate that the event handling is successful/validKeyboard.onKey(long, int, int, int, int)
,
GLFW.GLFW_KEY_Q
,
GLFWKeyCallbackI.invoke(long, int, int, int, int)
public boolean charTyped(char chr, int keyCode)
GLFW
class.charTyped
in interface Element
chr
- the captured characterkeyCode
- the associated key codetrue
to indicate that the event handling is successful/validKeyboard.onChar(long, int, int)
,
GLFW.GLFW_KEY_Q
,
GLFWKeyCallbackI.invoke(long, int, int, int, int)
public boolean isMouseOver(double mouseX, double mouseY)
isMouseOver
in interface Element
mouseX
- the X coordinate of the mousemouseY
- the Y coordinate of the mousetrue
if the mouse is within the bound of the element, otherwise false
private void refreshSearchResults()
private void triggerPirateSpeakEasterEgg(String string)
private boolean isWide()
public void refresh()
public void onRecipesDisplayed(List<Recipe<?>> recipes)
onRecipesDisplayed
in interface RecipeDisplayListener
public void acceptAlignedInput(Iterator<Ingredient> inputs, int slot, int amount, int gridX, int gridY)
acceptAlignedInput
in interface RecipeGridAligner<Ingredient>
protected void sendBookDataPacket()