Skip to content

Create Cursor Types

fishstiz edited this page Mar 12, 2025 · 4 revisions

Important

The Minecraft Cursor Wiki has moved to:
https://fishstiz.github.io/minecraft-cursor-wiki/.

This page will no longer be updated.



Creating new cursor types is the same as creating a resource pack, except you can create new keys for your custom cursor types.

Once you have prepared the assets, you can use the CursorType#of(String) method to create a CursorType object. A CursorType object is only a representation of your cursor type used for identification.

The Cursor Type's key

Used to identify the cursor type's assets. Following the resource pack structure:

  • This should be the filename of the cursor type:
    assets/
    └── minecraft-cursor/
        └── textures/
            └── cursors/
                └── <key>.png
    
  • This is the key for custom settings in cursors.json:
    {
      "settings": {
        "<key>": {
          "xhot": 3,
          "yhot": 3
        }
      }
    }
  • Add the translation entry for your cursor type:
    {
      "minecraft-cursor.options.cursor-type.<key>": "Custom"
    }

Creating a CursorType object

Using CursorType#of(String):

CursorType customCursor = CursorType.of("custom-cursor");

Creating static CursorType objects

You should create final static variables or an enum for cursor types so they are easily reusable and maintainable.

// Create static cursor types
public class CustomCursor {
    public static final CursorType CELL = CursorType.of("cell");
    public static final CursorType PROGRESS = CursorType.of("progress");
    public static final CursorType ZOOM = CursorType.of("zoom");
}
// Create static custom cursor types using enum
public enum CustomCursorEnum implements CursorType {
    MOVE,
    RESIZE,
    CROSSHAIR;

    @Override
    public String getKey() {
        return this.name().toLowerCase();
    }
}

After creating your cursor types, they must be registered from MinecraftCursorInitializer so that Minecraft Cursor can retrieve its assets.


Previous: Getting Started
Add Minecraft Cursor to your project.

Next: Initialization
Register Cursor Types and Elements.

Clone this wiki locally