Skip to content

Introduction

TIP

You can toggle between Yarn and Mojang mappings by clicking on the button next to the Java API link from the navigation bar.

The Minecraft Cursor API lets mod developers extend the functionality of Minecraft Cursor allowing them to:

  • Create new cursors.
  • Register elements with a cursor type mapping function.
  • Declare the cursor type from within the element.
  • Control the cursor directly to bypass the element system.

What is An Element?

Elements are simply classes or objects that implement Minecraft's native Element interface, which allows the capturing and propagating of mouse events on GUIs and widgets/components from screens.

The ParentElement hierarchy

For elements to be detected, they must be an instance of Element.

It must be accessible recursively from the Screen via ParentElement#children().

Each parent in the hierarchy must correctly expose children, forming a chain from the Screen to the target element.

If the element is an instance of ClickableWidget, then ClickableWidget#visible must be true, and either:

  • ClickableWidget#isHovered() is true, or
  • ClickableWidget#isMouseOver(double, double) returns true.

Otherwise, Element#isMouseOver(double, double) must return true.

To check if the element is being detected, Inspect element can be toggled from the configuration screen under the Debug section.

Released under the CC0-1.0 License.