I'm trying to make a mod that involves randomly rebinding vanilla controls without user input however I'm confused on the InputMappings.Input class . I'm trying to use an instance of KeyBindingMap like so:
public static KeyBindingMap allBinds;
to change the mapping of vanilla controls. I get the vanilla binds like so:
Minecraft.getInstance().gameSettings.keyBindAttack
I then try to change the keybindings like so:
allBinds.addKey( ??? ,Minecraft.getInstance().gameSettings.keyBindAttack);
the first variable needs to be an instance of InputMappings.Input, but I'm very confused on how to use it. I'm not trying to record user input for this. I want to randomly switch around keyCodes from a predefined set of keys so that one event is done through a different key after the switch.
I've already tried removing all the keys in the map and then recreating them to randomly switch the keys, but that crashes the game since (I'm assuming from what I saw In the error logs) some Vanilla values can't be NULL.