uku3lig / oldinput

raw input backport to old minecraft versions
8 stars 2 forks source link

Fixed mouse freezing by rescanning in GUI only #5

Closed spxctreofficial closed 1 year ago

spxctreofficial commented 1 year ago

The mouse freezing as mentioned in #2 is caused by calls every five seconds to ControllerEnvironment.getControllers().

JInput, being an old library, does not have a plugin that fires the ControllerListener, which means that there is no way to run a re-scan only when a controller is added or removed without modifying JInput or writing a plugin.

In order to workaround the issue, a condition is added so that re-scanning is only done when the player has a GUI open. This allows for the re-scanning of devices without using a full command, but also completely removes the freezing that JInput causes every 5 seconds, making the game playable at the minimum.

uku3lig commented 1 year ago

Added in 793fef6e785dd1b9c89614f0082e5b504bb8107b

I had to put the commit myself manually instead of merging the PR because I had to change the buildscript and since the main branch is 1.12.2, it would have caused weirdness in the git tree down the line. But don't worry, you still show up as contributor ;)

spxctreofficial commented 1 year ago

Added in 793fef6

I had to put the commit myself manually instead of merging the PR because I had to change the buildscript and since the main branch is 1.12.2, it would have caused weirdness in the git tree down the line. But don't worry, you still show up as contributor ;)

On another note, it might be better to check if the screen is specifically the pause menu instead of checking if screen != null. There are still some remnants of mouse lag when exiting the inventory since it rescans every millisecond.

uku3lig commented 1 year ago

it rescans every millisecond

my face when i forgot, thanks for pointing that out lol