neoforged / NeoForge

Neo Modding API for Minecraft, based on Forge
https://projects.neoforged.net/neoforged/neoforge
Other
1.13k stars 165 forks source link

`MouseScrollingEvent` scroll delta is always positive #229

Closed henkelmax closed 10 months ago

henkelmax commented 10 months ago

Minecraft Version: 1.20.2

NeoForge Version: 20.2.20

Logs: N/A

Steps to Reproduce:

  1. Register the MouseScrollingEvent
  2. Scroll
  3. scrollDelta is always minecraft.options.mouseWheelSensitivity()

Description of issue:

The scroll delta of the MouseScrollingEvent is always minecraft.options.mouseWheelSensitivity()

The variable d0 is the scroll sensitivity of your game: https://github.com/neoforged/NeoForge/blob/7357532ede1405335dd789045e6b43708b84167f/patches/net/minecraft/client/MouseHandler.java.patch#L58

The event just takes that value, so you can't detect if you are scrolling up or down. https://github.com/neoforged/NeoForge/blob/7357532ede1405335dd789045e6b43708b84167f/patches/net/minecraft/client/MouseHandler.java.patch#L68

Nightenom commented 10 months ago

Sorry for issue hijacking, but the one who's gonna fix the bug could also solve following: 1.20.2 started to distinguish horizontal/vertical scrolling for UIs, relevant events should be updated to use both values. Events ScreenEvent.MouseScrolled.Pre/Post for ui and InputEvent.MouseScrollingEvent for in-game

Also MC-121772 was fixed and current patch makes almost no sense with addition of horizontal scrolling