Class KeyRegistry
java.lang.Object
org.cyclops.cyclopscore.client.key.KeyRegistry
- All Implemented Interfaces:
IKeyRegistry,org.cyclops.cyclopscore.init.IRegistry
Enum that contains all custom hotkeys that
are added. Every key also has a
KeyMapping for that specific key.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddKeyHandler(net.minecraft.client.KeyMapping kb, IKeyHandler handler) Binds aIKeyHandlerto key presses of the specifiedKeyMapping.static net.minecraft.client.KeyMappingnewKeyMapping(ModBase mod, String name, int defaultKey) Create a new keybinding.voidonPlayerKeyInput(net.neoforged.neoforge.client.event.ClientTickEvent.Post event) Handles key presses for keybindings added by EvilCraft Make sure to annotate this withSubscribeEvent
-
Constructor Details
-
KeyRegistry
public KeyRegistry()
-
-
Method Details
-
newKeyMapping
public static net.minecraft.client.KeyMapping newKeyMapping(ModBase mod, String name, int defaultKey) Create a new keybinding.- Parameters:
mod- The mod.name- The unique name.defaultKey- The keycode.- Returns:
- A new keybinding.
-
onPlayerKeyInput
public void onPlayerKeyInput(net.neoforged.neoforge.client.event.ClientTickEvent.Post event) Description copied from interface:IKeyRegistryHandles key presses for keybindings added by EvilCraft Make sure to annotate this withSubscribeEvent- Specified by:
onPlayerKeyInputin interfaceIKeyRegistry- Parameters:
event- The input event.
-
addKeyHandler
Description copied from interface:IKeyRegistryBinds aIKeyHandlerto key presses of the specifiedKeyMapping. Whenever theKeyMappingis pressed,IKeyHandler.onKeyPressed(KeyMapping)} is called.- Specified by:
addKeyHandlerin interfaceIKeyRegistry- Parameters:
kb-KeyMappingto which we bind theIKeyHandler.handler-IKeyHandlerthat will be linked to presses of the givenKeyMapping.
-