Interface IKeyMappingAdapter
public interface IKeyMappingAdapter
Adapts one key mapping for the shared binding editor.
Register adapters with IConfigGuiRegistration.registerKeyMappingAdapter(Class, Function) for custom key mapping implementations.
- Since:
- 0.6.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault IKeyMappingInputcaptureInput(IKeyMappingInput input) Capture any additional modifier state for a keyboard or mouse input event.default booleanconflicts(net.minecraft.client.KeyMapping other) Check whether this mapping's current binding conflicts with another mapping, accounting for modifiers and activation context.default IKeyMappingBindingcreateBinding(IKeyMappingInput input) Choose a supported binding for captured input using this mapping's modifier representation.Read the binding used when the user resets this key mapping.default net.minecraft.network.chat.ComponentgetDisplayName(IKeyMappingBinding value) Get localized text for a binding, including any modifiers.net.minecraft.client.KeyMappingGet the key mapping wrapped by this adapter.getValue()Get the current binding, including its modifiers.default booleanisCustomModifier(com.mojang.blaze3d.platform.InputConstants.Key key) Identify an additional modifier key supplied by this integration.voidsetValue(IKeyMappingBinding value) Replace the current input and its entire modifier set.
-
Method Details
-
getKeyMapping
net.minecraft.client.KeyMapping getKeyMapping()Get the key mapping wrapped by this adapter.- Returns:
- the same mapping instance supplied to the registered adapter factory
- Since:
- 0.6.0
-
getValue
IKeyMappingBinding getValue()Get the current binding, including its modifiers.- Returns:
- a snapshot of the assigned input and its modifiers, or an unbound binding if no input is assigned
- Since:
- 0.6.0
-
setValue
Replace the current input and its entire modifier set.- Parameters:
value- the complete binding to apply- Since:
- 0.6.0
-
getDefaultValue
IKeyMappingBinding getDefaultValue()Read the binding used when the user resets this key mapping.- Returns:
- the complete default binding, which may be unbound
- Since:
- 0.6.0
-
getDisplayName
Get localized text for a binding, including any modifiers.- Parameters:
value- the binding to display, including pending edits- Returns:
- the localized binding name
- Since:
- 0.6.0
-
conflicts
default boolean conflicts(net.minecraft.client.KeyMapping other) Check whether this mapping's current binding conflicts with another mapping, accounting for modifiers and activation context. The editor checks both directions.- Parameters:
other- the mapping to compare against- Returns:
- true if the bindings conflict
- Since:
- 0.6.0
-
createBinding
Choose a supported binding for captured input using this mapping's modifier representation. Excludes unsupported modifiers and unsupported combinations. Does not change the current binding. Assigning the result withsetValue(IKeyMappingBinding)must makegetValue()return the same key and modifiers.- Parameters:
input- the keyboard or mouse input captured bycaptureInput(IKeyMappingInput)- Returns:
- a binding that this mapping can store unchanged
- Since:
- 0.6.0
-
captureInput
Capture any additional modifier state for a keyboard or mouse input event. The supplied input has no custom modifiers. The result excludes custom modifiers represented by the main key.- Parameters:
input- the input and physical standard modifiers from the event, excluding the main key's modifier- Returns:
- a snapshot of the input and its held physical standard and custom modifiers
- Since:
- 0.6.0
-
isCustomModifier
default boolean isCustomModifier(com.mojang.blaze3d.platform.InputConstants.Key key) Identify an additional modifier key supplied by this integration. The editor already recognizes Shift, Control, Alt, and Command/Super.- Parameters:
key- the keyboard or mouse input to identify- Returns:
- true if this input can act as a custom modifier for the mapping
- Since:
- 0.6.0
-