fix: change keyCode to action (#667)

* fix: change keyCode to action

The int passed to the keyPressed function represents the action instead of the keyCode. The keyCode is inside the keyEvent. The action is 1 for key pressed and 0 for key released.

* fix: wrong parameter in NeoForge
This commit is contained in:
Kevin
2025-10-14 02:10:25 +02:00
committed by GitHub
parent dd8ddff874
commit 93f7ef0e6f
3 changed files with 6 additions and 6 deletions

View File

@@ -32,7 +32,7 @@ public interface ClientRawInputEvent {
*/
Event<MouseScrolled> MOUSE_SCROLLED = EventFactory.createEventResult();
/**
* @see MouseClicked#mouseClicked(Minecraft, int, int, int)
* @see MouseClicked#mouseClicked(Minecraft, MouseButtonInfo, int)
*/
Event<MouseClicked> MOUSE_CLICKED_PRE = EventFactory.createEventResult();
Event<MouseClicked> MOUSE_CLICKED_POST = EventFactory.createEventResult();
@@ -47,12 +47,12 @@ public interface ClientRawInputEvent {
* Equivalent to Forge's {@code InputEvent.KeyInputEvent} event.
*
* @param client The Minecraft instance performing it.
* @param keyCode The key code.
* @param action The action that should be performed.
* @param keyEvent The key event.
* @return A {@link EventResult} determining the outcome of the event,
* the execution of the vanilla pressing mechanism may be cancelled by the result.
*/
EventResult keyPressed(Minecraft client, int keyCode, KeyEvent keyEvent);
EventResult keyPressed(Minecraft client, int action, KeyEvent keyEvent);
}
interface MouseScrolled {