API Surface (4) ScreenDirection getVerticalDirectionForInitialFocus()
FocusNavigationEvent.ArrowNavigation with(final ScreenRectangle previousFocus)
ScreenDirection getVerticalDirectionForInitialFocus()
ScreenDirection getVerticalDirectionForInitialFocus()
Code Graph: Dependencies (2) Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.
Full Source
FocusNavigationEvent.java 43 lines · Minecraft 26.3 · verbatim Copy
1 package net.minecraft.client.gui.navigation;
2
3 import net.fabricmc.api.EnvType;
4 import net.fabricmc.api.Environment;
5 import org.jspecify.annotations.Nullable;
6
7 @Environment(EnvType.CLIENT)
8 public interface FocusNavigationEvent {
9 ScreenDirection getVerticalDirectionForInitialFocus();
10
11 @Environment(EnvType.CLIENT)
12 record ArrowNavigation(ScreenDirection direction, @Nullable ScreenRectangle previousFocus) implements FocusNavigationEvent {
13 public ArrowNavigation(final ScreenDirection direction) {
14 this(direction, null);
15 }
16
17 @Override
18 public ScreenDirection getVerticalDirectionForInitialFocus() {
19 return this.direction.getAxis() == ScreenAxis.VERTICAL ? this.direction : ScreenDirection.DOWN;
20 }
21
22 public FocusNavigationEvent.ArrowNavigation with(final ScreenRectangle previousFocus) {
23 return new FocusNavigationEvent.ArrowNavigation(this.direction(), previousFocus);
24 }
25 }
26
27 @Environment(EnvType.CLIENT)
28 class InitialFocus implements FocusNavigationEvent {
29 @Override
30 public ScreenDirection getVerticalDirectionForInitialFocus() {
31 return ScreenDirection.DOWN;
32 }
33 }
34
35 @Environment(EnvType.CLIENT)
36 record TabNavigation(boolean forward) implements FocusNavigationEvent {
37 @Override
38 public ScreenDirection getVerticalDirectionForInitialFocus() {
39 return this.forward ? ScreenDirection.DOWN : ScreenDirection.UP;
40 }
41 }
42 }
43
Decompiled Minecraft 26.3 source of FocusNavigationEvent (net/minecraft/client/gui/navigation/FocusNavigationEvent.java) with Mojang official mappings, stored verbatim on the site.