Class RecipeAlternativesWidget
java.lang.Object
net.minecraft.client.gui.DrawableHelper
net.minecraft.client.gui.screen.recipebook.RecipeAlternativesWidget
@Environment(CLIENT) public class RecipeAlternativesWidget extends DrawableHelper implements Drawable, Element
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
RecipeAlternativesWidget.AlternativeButtonWidget
(package private) class
RecipeAlternativesWidget.FurnaceAlternativeButtonWidget
-
Field Summary
Fields Modifier and Type Field Description private List<RecipeAlternativesWidget.AlternativeButtonWidget>
alternativeButtons
private static Identifier
BACKGROUND_TEXTURE
private int
buttonX
private int
buttonY
private MinecraftClient
client
private boolean
furnace
private Recipe<?>
lastClickedRecipe
private RecipeResultCollection
resultCollection
private float
time
private boolean
visible
Fields inherited from class net.minecraft.client.gui.DrawableHelper
GUI_ICONS_TEXTURE, OPTIONS_BACKGROUND_TEXTURE, STATS_ICON_TEXTURE
-
Constructor Summary
Constructors Constructor Description RecipeAlternativesWidget()
-
Method Summary
Modifier and Type Method Description boolean
changeFocus(boolean lookForwards)
Changes the focusing element by cycling to the next/previous element.Recipe<?>
getLastClickedRecipe()
RecipeResultCollection
getResults()
boolean
isMouseOver(double mouseX, double mouseY)
Checks if the mouse position is within the bound of the element.boolean
isVisible()
boolean
mouseClicked(double mouseX, double mouseY, int button)
Callback for when a mouse button down event has been captured.void
render(MatrixStack matrices, int mouseX, int mouseY, float delta)
private void
renderGrid(MatrixStack matrixStack, int int2, int int3, int int4, int int5, int int6, int int7)
void
setVisible(boolean visible)
void
showAlternativesForResult(MinecraftClient client, RecipeResultCollection results, int buttonX, int buttonY, int areaCenterX, int areaCenterY, float delta)
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
charTyped, keyPressed, keyReleased, mouseDragged, mouseMoved, mouseReleased, mouseScrolled
-
Field Details
-
BACKGROUND_TEXTURE
-
alternativeButtons
-
visible
private boolean visible -
buttonX
private int buttonX -
buttonY
private int buttonY -
client
-
resultCollection
-
lastClickedRecipe
-
time
private float time -
furnace
private boolean furnace
-
-
Constructor Details
-
RecipeAlternativesWidget
public RecipeAlternativesWidget()
-
-
Method Details
-
showAlternativesForResult
public void showAlternativesForResult(MinecraftClient client, RecipeResultCollection results, int buttonX, int buttonY, int areaCenterX, int areaCenterY, float delta) -
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
-
getResults
-
getLastClickedRecipe
-
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
-
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
-
render
-
renderGrid
private void renderGrid(MatrixStack matrixStack, int int2, int int3, int int4, int int5, int int6, int int7) -
setVisible
public void setVisible(boolean visible) -
isVisible
public boolean isVisible()
-