AbstractMoveableScreen

This page talks about AbstractMoveableScreen.

AbstractMoveableScreen

The AbstractMoveableScreen class extends the Screen class and provides additional functionality for creating moveable screens in Minecraft Fabric.

Fields

  • dynamicutil: The DynamicUtil instance used by this screen.

  • mc: The MinecraftClient instance.

  • selectedWidget: The currently selected widget.

  • dragStartX, dragStartY: The starting position of a drag operation.

  • List<contextMenu>: The List of context menu that are currently being displayed.

  • colorPicker: The color picker that is currently displayed.

  • sliderWigdet: The widget that is currently being edited by the slider.

  • List<Slider>: The List of sliders.

  • mouseHandler: The mouse handler for this screen.

  • dragHandler: The drag handler for this screen.

  • gridSize: The size of each grid cell in pixels.

  • ShouldPause: Whether to pause if the screen is opened or not.

  • ShouldBeAffectedByResize: Whether the stuff drawn on screen should be affected by screen resize or not.

  • WidgetX: X position of the selected widget.

  • WidgetY: Y position of the selected widget.

Constructors

AbstractMoveableScreen(Text title, DynamicUtil dynamicutil)

Constructs an AbstractMoveableScreen object with the given title and dynamicutil instance.

Methods

mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY)

Handles mouse dragging on this screen. This method updates the position of the selected widget while dragging.

mouseReleased(double mouseX, double mouseY, int button)

Handles mouse release events on this screen. This method stops dragging or scaling the selected widget.

mouseClicked(double mouseX, double mouseY, int button)

Handles mouse clicks on this screen. This method starts dragging a widget if it was clicked.

render(MatrixStack matrices, int mouseX, int mouseY, float delta)

Renders this screen and its widgets on the screen.

setGridSize(int gridSize)

Sets the size of each grid cell in pixels.

setShouldPause(boolean shouldpause)

Sets whether to pause if the screen is opened or not.

setShouldBeAffectedByResize(boolean shouldBeAffectedByResize)

Sets whether the stuff drawn on screen should be affected by screen resize or not.

resize(MinecraftClient client, int width, int height)

Resizes this screen. If ShouldBeAffectedByResize is true, this method calls the superclass's implementation of this method.

shouldPause()

Returns whether to pause if the screen is opened or not.

handleRightClickOnWidget(Widget widget)

An abstract method that must be implemented by subclasses to handle right-clicks on widgets.

An abstract method that must be implemented by subclasses to display a context menu for a widget at the given position.