CursorCentered Fix

Quick rating

CursorCentered Fix

No reviews yet

A Minecraft mod that fix the cursor centering issue that occasionally happens when opening a GUI.

No Theme
No Genre
QoL & Tweaks
Client Utility
Mod Loaders
Forge
NeoForge
Fabric
Minecraft
26.2

Community voices

Reviews

Versions
Loading versions…
Match includes

Click once to include, again to exclude, again to clear

Rating Any
Any 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0
Min
Max
Play Status
Reviews
Time Played
hrs+
Verified developers only
Has developer response
List view
Grid view
Compact view
Sort by
Date
Rating
Helpful
Unhelpful
Edited
Sort ascending
Delete this review?

This removes your review from the project. You can write a new review after.

Review submitted for moderation

Your review has been sent to moderators, who will check that it meets our guidelines before it appears publicly.

No reviews yet. Be the first to review this project!

Get it on

Available Platforms

Compatibility

Supported Environments

Dev Environment
Client Required
Server Unsupported

About

Project Details

Type
Mod
License
GNU General Public License v3.0 only
Latest Version
cursorcenteredfix-1.3.0-neoforge-1.20.5+.jar
Authors
CurseForge
Modrinth

For authors

Embed Badge

If you're the author of this project, you can embed a live badge anywhere that supports HTML or Markdown. It updates automatically whenever ratings change.

Custom banner text
ModDex rating badge preview

Use HTML for any page that supports it, or Markdown for README files and Markdown-based descriptions.

Identifiers

Platform IDs

CurseForge ID
Modrinth ID

Resources

External Links

Source Issues Wiki Discord

About

Description

This mod fixes the cursor centering issue that occasionally happens when opening a GUI, e.g. open a container GUI but the cursor doesn't appear from the center which could be dangerous when you need to pull something from a chest or inventory rapidly.

For Wayland Users

This mod supports centering the cursor on wayland using ydotool (an automation tool on wayland), to enable this feature, you need to configure this tool properly, here are the basic setup steps:

1. Install ydotool from source

The latest version of ydotool provides seamless centering experience, however it can only be built and installed from source at the moment (the mod was using an outdated ydotool previously).

To build an install it, just execute these commands in terminal under any directory:

//install command may vary on different platforms
sudo apt install git cmake scdoc

git clone https://github.com/ReimuNotMoe/ydotool.git
cd ydotool
mkdir build
cd build
cmake ..
make -j "$(nproc)"
sudo make install

Running ydotoold -V to verify your installation.

2. Add your user to sudo exceptions

The only way to successfully center the cursor using ydotool in Minecraft is running ydotool command with sudo privilege. Thus you need to make your user be able to run ydotool command with sudo without password: edit /etc/sudoers, add two lines:

<yourusername> ALL=(ALL) NOPASSWD:<ydotoold_path> //default path: /usr/local/bin/ydotoold
<yourusername> ALL=(ALL) NOPASSWD:<ydotool_path> //default path: /usr/local/bin/ydotool

3. Specify a move scaling value (Optional)

There is an internal problem of moving cursor on wayland programmatically - the actual moved position may be affected by some system values depending on your desktop environment. In other words, the default centering position is guaranteed correct only with default mouse sensitivity and mouse acceleration disabled (also requires default UI scale in some desktop environments). Fortunately, the requested position and actual position seem to always satisfy a liner function relationship, so we can use a double factor to correct it.

To determine this value, run the game with this mod and open any container GUI, the mod will center the cursor using default scaling value (1.0), then keep your cursor at that position and take out your ruler, put it on your monitor to measure its absolute position, record x or y as x1 or y1. Next, keep the position of your game window and determine the actual central point, also measure its absolute position with your ruler, record x or y as x2 or y2, then the scaling value should be x2 / x1 or y2 / y1. Note that the game window is better to be small (1/2 screen width/height is ok) and close to top-left to ensure the cursor will not go outside the screen, or its position is not reliable (be constrained to screen border). This step can also be done by taking screenshots and measuring the position using a painting software that displays pixel coordinates, which is more accurate. You can round the value if necessary.

After determining the scaling value, you can restart the game with a JVM argument -DcursorMoveScalingValue=<value> to apply it, this value should be always correct util you change the system mouse sensitivity/acceleration or UI scaling value.

This mod fixes the cursor centering issue that occasionally happens when opening a GUI, e.g. open a container GUI but the cursor doesn't appear from the center which could be dangerous when you need to pull something from a chest or inventory rapidly.

For Wayland Users

This mod supports centering the cursor on wayland using ydotool (an automation tool on wayland), to enable this feature, you need to configure this tool properly, here are the basic setup steps:

1. Install ydotool from source

The latest version of ydotool provides seamless centering experience, however it can only be built and installed from source at the moment (the mod was using an outdated ydotool previously).

To build an install it, just execute these commands in terminal under any directory:

//install command may vary on different platforms
sudo apt install git cmake scdoc

git clone https://github.com/ReimuNotMoe/ydotool.git
cd ydotool
mkdir build
cd build
cmake ..
make -j "$(nproc)"
sudo make install

Running ydotoold -V to verify your installation.

2. Add your user to sudo exceptions

The only way to successfully center the cursor using ydotool in Minecraft is running ydotool command with sudo privilege. Thus you need to make your user be able to run ydotool command with sudo without password: edit /etc/sudoers, add two lines:

<yourusername> ALL=(ALL) NOPASSWD:<ydotoold_path> //default path: /usr/local/bin/ydotoold
<yourusername> ALL=(ALL) NOPASSWD:<ydotool_path> //default path: /usr/local/bin/ydotool

3. Specify a move scaling value (Optional)

There is an internal problem of moving cursor on wayland programmatically - the actual moved position may be affected by some system values depending on your desktop environment. In other words, the default centering position is guaranteed correct only with default mouse sensitivity and mouse acceleration disabled (also requires default UI scale in some desktop environments). Fortunately, the requested position and actual position seem to always satisfy a liner function relationship, so we can use a double factor to correct it.

To determine this value, run the game with this mod and open any container GUI, the mod will center the cursor using default scaling value (1.0), then keep your cursor at that position and take out your ruler, put it on your monitor to measure its absolute position, record x or y as x1 or y1. Next, keep the position of your game window and determine the actual central point, also measure its absolute position with your ruler, record x or y as x2 or y2, then the scaling value should be x2 / x1 or y2 / y1. Note that the game window is better to be small (1/2 screen width/height is ok) and close to top-left to ensure the cursor will not go outside the screen, or its position is not reliable (be constrained to screen border). This step can also be done by taking screenshots and measuring the position using a painting software that displays pixel coordinates, which is more accurate. You can round the value if necessary.

After determining the scaling value, you can restart the game with a JVM argument -DcursorMoveScalingValue=<value> to apply it, this value should be always correct util you change the system mouse sensitivity/acceleration or UI scaling value.

Screenshots

Gallery

This project has no gallery images yet.

Versions

Files

Relations

Project Relations

More like this

Similar Mods

Suggestions use data such as tags, dependencies, dependents, descriptions, titles, and more to rank how much they overlap with this mod.

On ModDex

Community snapshot

0
Ratings
0
Followers
0
In stacks

By the numbers

Statistics

~810,000
Total Downloads
CurseForge
~340,000
Modrinth
~460,000
Last Updated
CurseForge
Created
CurseForge
Modrinth
Last synced
When ModDex last fetched this project from CurseForge or Modrinth. Every project is re-checked on a schedule, and any project that ships a new file is synced automatically within hours of the release.
New file updates sync automatically
How syncing works