You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* This mimics peripherals used to control minecraft which are: The keyboard, the mouse and the angle of the player, which is called "Subticks" in this case
18
-
* <i>(this came from a time when the camera angle was actually updated on a subtick level)</i>.<br>
18
+
* This mimics peripherals used to control minecraft which are: The keyboard,
19
+
* the mouse and the angle of the player, which is called "Subticks" in this
20
+
* case <i>(this came from a time when the camera angle was actually updated on
21
+
* a subtick level)</i>.<br>
19
22
* <br>
20
-
* For each peripheral there are 2 states. The "current" state <i>(e.g. {@linkplain #currentKeyboard})</i>, which is the state of what the game actually currently recognizes and the "next" state <i>(e.g. {@linkplain #nextKeyboard})</i> which either the buttons pressed on the keyboard, or the buttons pressed in the next playback tick.<br>
23
+
* For each peripheral there are 2 states. The "current" state <i>(e.g.
24
+
* {@linkplain #currentKeyboard})</i>, which is the state of what the game
25
+
* actually currently recognizes and the "next" state <i>(e.g.
26
+
* {@linkplain #nextKeyboard})</i> which either the buttons pressed on the
27
+
* keyboard, or the buttons pressed in the next playback tick.<br>
21
28
* <br>
22
-
* Outside of this class, there is a third state, which is the Vanilla Minecraft keybindings, which, in the best case, should be a copy of the "current" state. <br>
23
-
* <h2>Events</h2>
24
-
* To update the vanilla keybindings you need something called key events. An event for a keyboard might look like this <br>
29
+
* Outside of this class, there is a third state, which is the Vanilla Minecraft
30
+
* keybindings, which, in the best case, should be a copy of the "current"
31
+
* state. <br>
32
+
* <h2>Events</h2> To update the vanilla keybindings you need something called
33
+
* key events. An event for a keyboard might look like this <br>
25
34
* <br>
26
35
* <b>17,true,'w'</b><br>
27
36
* <br>
28
-
* Something like this is sent by the LWJGL methods to the vanilla methods to update the keybindings. <br>
29
-
* In this case it is the key with the keycode 17 (The 'W' key), in the state true which means it is pressed down. And the 'w' is the character that is associated with that key <br>
37
+
* Something like this is sent by the LWJGL methods to the vanilla methods to
38
+
* update the keybindings. <br>
39
+
* In this case it is the key with the keycode 17 (The 'W' key), in the state
40
+
* true which means it is pressed down. And the 'w' is the character that is
41
+
* associated with that key <br>
30
42
* <br>
31
-
* You can find a complete list of LWJGL keycodes in {@link VirtualKeyboard}.<br>
43
+
* You can find a complete list of LWJGL keycodes in
44
+
* {@link VirtualKeyboard}.<br>
32
45
* <br>
33
-
* If W is released, the key event for this would look something like this: <b>17, false, NULL</b>
34
-
* <br>
35
-
* From that, the vanilla keybindings know which key is currently pressed down. As a bonus, the character 'w' is used when typing in a textfield.<br>
36
-
* <h2>Emulating events</h2>
37
-
* With the key events from LWJGL, so from the "physical keyboard", we can update the nextKeyboard in the {@link #updateNextKeyboard(int, boolean, char)} method.<br>
46
+
* If W is released, the key event for this would look something like this:
47
+
* <b>17, false, NULL</b> <br>
48
+
* From that, the vanilla keybindings know which key is currently pressed down.
49
+
* As a bonus, the character 'w' is used when typing in a textfield.<br>
50
+
* <h2>Emulating events</h2> With the key events from LWJGL, so from the
51
+
* "physical keyboard", we can update the nextKeyboard in the
* This method is called every frame and also works in tickrate 0.<br>
39
54
* <br>
40
-
* And on every tick, we call {@link #updateCurrentKeyboard()}, which updates the currentKeyboard with a copy of nextKeyboard. <br>
41
-
* However, we still need to update the Vanilla Minecraft keybinding by using key events.<br>
42
-
* To solve this problem we can use {@link VirtualKeyboard#getDifference(VirtualKeyboard)}, which compares 2 keyboards and extracts the key events from that.<br>
55
+
* And on every tick, we call {@link #updateCurrentKeyboard()}, which updates
56
+
* the currentKeyboard with a copy of nextKeyboard. <br>
57
+
* However, we still need to update the Vanilla Minecraft keybinding by using
58
+
* key events.<br>
59
+
* To solve this problem we can use
60
+
* {@link VirtualKeyboard#getDifference(VirtualKeyboard)}, which compares 2
61
+
* keyboards and extracts the key events from that.<br>
43
62
* <br>
44
-
* For instance if we have a keyboard, where nothing is pressed, then a keyboard where only "W" is pressed, we can assume that the key event responsible for that change 17,true,? is. <br>
45
-
* But as indicated by the ? we actually don't know the character that is typed there. And for that we need to store the characters seperately in the keyboard ({@link VirtualKeyboard#getCharList()}).<br>
63
+
* For instance if we have a keyboard, where nothing is pressed, then a keyboard
64
+
* where only "W" is pressed, we can assume that the key event responsible for
65
+
* that change 17,true,? is. <br>
66
+
* But as indicated by the ? we actually don't know the character that is typed
67
+
* there. And for that we need to store the characters seperately in the
((AccessorRunStuff) Minecraft.getMinecraft()).runTickKeyboardAccessor(); // Letting mouse and keyboard tick once to load inputs into the "currentKeyboard"
* Gets all InputEvents from the current container.<br>
489
+
* <br>
490
+
* Container and input events differ in that input events are the events that get accepted by Minecraft in the runTickKeyboard.<br>
491
+
* The container however stores the current inputs and can calculate the corresponding input events from that, but it does it only when you are playing back or recording.<br>
492
+
* <br>
493
+
* This however runs through the {@link VirtualInput#container} and generates the input events on for debug purposes.
0 commit comments