InputWithModifiers .java

net.minecraft.client.input.InputWithModifiers (interface): members: hasControlDownWithQuirk, isConfirmation, isCycleFocus, isSelectAll, isSelection, isCut.

net.minecraft.client.inputinterface91 linesclient2.1 KB

API Surface (0)

No public/protected methods detected (fields or constants only).

Code Graph: Dependencies (1)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

InputWithModifiers.java91 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.input;
2
3
import com.mojang.blaze3d.platform.InputConstants;
4
import java.lang.annotation.ElementType;
5
import java.lang.annotation.Retention;
6
import java.lang.annotation.RetentionPolicy;
7
import java.lang.annotation.Target;
8
import net.fabricmc.api.EnvType;
9
import net.fabricmc.api.Environment;
10
11
@Environment(EnvType.CLIENT)
12
public interface InputWithModifiers {
13
	@InputConstants.Value int input();
14
15
	default int shortcutKey() {
16
		return this.input();
17
	}
18
19
	@InputWithModifiers.Modifiers int modifiers();
20
21
	default boolean isSelection() {
22
		return this.input() == 40 || this.input() == 44 || this.input() == 88;
23
	}
24
25
	default boolean isConfirmation() {
26
		return this.input() == 40 || this.input() == 88;
27
	}
28
29
	default boolean isEscape() {
30
		return this.input() == 41;
31
	}
32
33
	default boolean isLeft() {
34
		return this.input() == 80;
35
	}
36
37
	default boolean isRight() {
38
		return this.input() == 79;
39
	}
40
41
	default boolean isUp() {
42
		return this.input() == 82;
43
	}
44
45
	default boolean isDown() {
46
		return this.input() == 81;
47
	}
48
49
	default boolean isCycleFocus() {
50
		return this.input() == 43;
51
	}
52
53
	default boolean hasAltDown() {
54
		return (this.modifiers() & 768) != 0;
55
	}
56
57
	default boolean hasShiftDown() {
58
		return (this.modifiers() & 3) != 0;
59
	}
60
61
	default boolean hasControlDown() {
62
		return (this.modifiers() & 192) != 0;
63
	}
64
65
	default boolean hasControlDownWithQuirk() {
66
		return (this.modifiers() & InputQuirks.EDIT_SHORTCUT_KEY_MODIFIER) != 0;
67
	}
68
69
	default boolean isSelectAll() {
70
		return this.shortcutKey() == 97 && this.hasControlDownWithQuirk() && !this.hasShiftDown() && !this.hasAltDown();
71
	}
72
73
	default boolean isCopy() {
74
		return this.shortcutKey() == 99 && this.hasControlDownWithQuirk() && !this.hasShiftDown() && !this.hasAltDown();
75
	}
76
77
	default boolean isPaste() {
78
		return this.shortcutKey() == 118 && this.hasControlDownWithQuirk() && !this.hasShiftDown() && !this.hasAltDown();
79
	}
80
81
	default boolean isCut() {
82
		return this.shortcutKey() == 120 && this.hasControlDownWithQuirk() && !this.hasShiftDown() && !this.hasAltDown();
83
	}
84
85
	@Retention(RetentionPolicy.CLASS)
86
	@Target(ElementType.TYPE_USE)
87
	@Environment(EnvType.CLIENT)
88
	@interface Modifiers {
89
	}
90
}
91

Decompiled Minecraft 26.3 source of InputWithModifiers (net/minecraft/client/input/InputWithModifiers.java) with Mojang official mappings, stored verbatim on the site.