Started by
Kleiders
on
Topic category: Help with Minecraft modding (Java Edition)
How can I add a keybinding that uses Control + another key?
I want to add that when you press Control + B, you summon a mob. How can I add this key combination as the default keybinding? I surely need custom code for that, but how do I do it?
no custom code, I think. Just make 2 Keybindings and set a global variable of Player Persistent that when you click Ctr it sets it to true and when you Press B if it's true
do whatever
or edit the code but I would have to look through that tomorrow
Cntr*
That would make it a bit too incovenient for the player if they want to change the keybinding, that's why I was looking for custom code for this :c
Yep, I will look through the code tommorrow as it's late for me now. also I meant Ctrl, not Cntr or smt
Cool, thank you so much for your help! Let me know if you figure it out!
okay from the research I have done (I have not tested it, so you will have to figure it out), I got this piece of code:
if ((InputMappings.isKeyDown(Minecraft.getInstance().getMainWindow().getHandle(), GLFW.GLFW_KEY_B)))
but for it to work you need to import an extra thing on the keybinds code.
import net.minecraft.client.utils.InputMappings;
I suppose you can try to add this somewhere the Keybinds code, basically this will check if Key: B is pressed
I do not promise this will work tho, haven't tested it
but why Ctrl + b? can't it be B alone? ppl are most likely to change it anyways
(also this can't be changed unless you give a config file ppl can edit)