Class PageNavigationWidget
java.lang.Object
johnsmith.enchantingoverhauled.client.gui.widget.enchant.PageNavigationWidget
Handles the rendering and interaction for the pagination controls (Next/Previous page buttons)
located in the Enchantment Screen.
Calculates bounds, manages hover states, and delegates scroll/click inputs to modify the active visible offset of the enchantment list.
-
Constructor Summary
ConstructorsConstructorDescriptionPageNavigationWidget(EnchantmentMenu menu, MenuLayoutConfig layout, IntSupplier offsetSupplier, IntConsumer offsetUpdater, Runnable onPageChanged) Constructs a new PageNavigationWidget. -
Method Summary
Modifier and TypeMethodDescriptionbooleanmouseClicked(double mouseX, double mouseY, int button) Handles left-click interactions for navigating the pages.booleanmouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) Handles mouse wheel scrolling for navigating the pages.voidrender(net.minecraft.client.gui.GuiGraphics context, int mouseX, int mouseY, float partialTick) Renders the previous and next page buttons to the screen, updating their hover and enabled states based on the current context array size and offset.voidupdatePosition(int alignX, int alignY) Updates the alignment origin for the widget buttons.
-
Constructor Details
-
Method Details
-
updatePosition
public void updatePosition(int alignX, int alignY) Updates the alignment origin for the widget buttons.- Parameters:
alignX- The parent screen's left position.alignY- The parent screen's top position.
-
render
public void render(net.minecraft.client.gui.GuiGraphics context, int mouseX, int mouseY, float partialTick) Renders the previous and next page buttons to the screen, updating their hover and enabled states based on the current context array size and offset.- Parameters:
context- The GUI graphics context.mouseX- The current mouse X coordinate.mouseY- The current mouse Y coordinate.partialTick- The partial tick time.
-
mouseClicked
public boolean mouseClicked(double mouseX, double mouseY, int button) Handles left-click interactions for navigating the pages.- Parameters:
mouseX- The mouse X coordinate.mouseY- The mouse Y coordinate.button- The mouse button pressed (0 for left).- Returns:
- true if the event was consumed, false otherwise.
-
mouseScrolled
public boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) Handles mouse wheel scrolling for navigating the pages.- Parameters:
mouseX- The mouse X coordinate.mouseY- The mouse Y coordinate.horizontalAmount- The horizontal scroll delta.verticalAmount- The vertical scroll delta.- Returns:
- true if the event was consumed, false otherwise.
-