xCuri0 / RawInputMod

Raw Input mod for Minecraft 1.8.9/1.12.2 using JInput
MIT License
17 stars 16 forks source link

Fixed fatal errors that broke the mod #2

Open CAG2Mark opened 3 years ago

CAG2Mark commented 3 years ago

There were two key errors in the original mod that made it not work.

  1. When iterating through the list of controllers, if there was one exception in the entire process, the entire for loop would exit. This means that if in the list of controllers, a faulty controller is before the desired controller, the desired controller would never be reached.
  2. The original code checked for float equality (namely, the mouse position to the double 0.0 exactly). Due to floating point errors, this is a very bad idea. The best solution is to compare a range of values (for example, -0.1 < x < 0.1).

I've fixed both these issues and can confirm the mod now works.

xCuri0 commented 3 years ago

thanks will check this

xCuri0 commented 3 years ago

image @CAG2Mark after testing this pr it seems like its accepting devices with no movement causing it not work

CAG2Mark commented 3 years ago

image @CAG2Mark after testing this pr it seems like its accepting devices with no movement causing it not work

Will have a look

vichvich4444 commented 3 years ago

Bump