Package forgottentowns.mod.api
Record Class KeyboardShortcut
java.lang.Object
java.lang.Record
forgottentowns.mod.api.KeyboardShortcut
- Record Components:
id- namespaced command identity belonging to the registering modlabelKey- translation key owned by that modcommand- shared UI operation to invokekey- default GLFW physical key codemodifiers- default GLFW Shift, Control, Alt and Super bitslegacyBinding- previous settings identity to migrate, or empty for a new command
public record KeyboardShortcut(String id, String labelKey, KeyboardShortcut.Command command, int key, int modifiers, String legacyBinding)
extends Record
A mod-owned keyboard command, registered at startup and remappable without restarting.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumSupported shared interface operations; availability still depends on registered capabilities. -
Constructor Summary
ConstructorsConstructorDescriptionKeyboardShortcut(String id, String labelKey, KeyboardShortcut.Command command, int key, int modifiers, String legacyBinding) Validates the portable shortcut definition. -
Method Summary
Modifier and TypeMethodDescriptioncommand()Returns the value of thecommandrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.intkey()Returns the value of thekeyrecord component.labelKey()Returns the value of thelabelKeyrecord component.Returns the value of thelegacyBindingrecord component.intReturns the value of themodifiersrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
KeyboardShortcut
public KeyboardShortcut(String id, String labelKey, KeyboardShortcut.Command command, int key, int modifiers, String legacyBinding) Validates the portable shortcut definition.- Parameters:
id- namespaced command identitylabelKey- owned translation keycommand- shared UI operationkey- default physical key codemodifiers- modifier mask between zero and fifteenlegacyBinding- obsolete unnamespaced preference identity, or empty- Throws:
IllegalArgumentException- if an identity, command, key or modifier is invalid
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
labelKey
Returns the value of thelabelKeyrecord component.- Returns:
- the value of the
labelKeyrecord component
-
command
Returns the value of thecommandrecord component.- Returns:
- the value of the
commandrecord component
-
key
public int key()Returns the value of thekeyrecord component.- Returns:
- the value of the
keyrecord component
-
modifiers
public int modifiers()Returns the value of themodifiersrecord component.- Returns:
- the value of the
modifiersrecord component
-
legacyBinding
Returns the value of thelegacyBindingrecord component.- Returns:
- the value of the
legacyBindingrecord component
-