TeamMidnightDust / MidnightControls

A Minecraft mod adding controller support and enhanced controls overall.
https://midnightdust.eu/midnightcontrols/
MIT License
179 stars 28 forks source link

Bug: Toggle Sprint/Sneak bug #270

Closed Androser420 closed 6 months ago

Androser420 commented 6 months ago

Describe the bug I just found a reason as to why Toggle Sprint and Sneak were conflicting. Basically, whenever i tried to turn on Toggle Sprint it wouldn't work, but when I turned Toggle Sneak option on then they would both be activated in the same time instead of being seperate. This issue went unnoticed for a while and I remember having it back in 1.19 so I decided to fix it myself.

Dumb solution:

  1. Change the line 91 in MidnightControls/src/main/java/eu/midnightdust/midnightcontrols/client/controller/ButtonBinding.java from

    .actions(InputHandlers::handleToggleSprint).onlyInGame().register();

    to:

    .actions(InputHandlers::handleToggleSprint).onlyInGame().cooldown().register();
  2. Change lines 323 and 328 in MidnightControls/src/main/java/eu/midnightdust/midnightcontrols/client/controller/InputHandlers.java from

    else if (MidnightControlsConfig.controllerToggleSneak != sprintToggled)

    to:

    else if (MidnightControlsConfig.controllerToggleSprint != sprintToggled)

I compiled the code, tested it myself and it worked flawlessly for me.