Hey, I’m new to sponge and don’t really know a lot about it but I am just wondering if there is a possibility of listening to key presses from the client by listening to an event or something or does it require a mod to be made that sends that info from the client to the server?
Keypresses aren’t directly sent to the server; the client will process them locally and only send actions it knows about. So if you need complete control over a keypress then you’ll need to create a client mod.
You may be able to leverage certain keypresses by capturing events triggered by the vanilla client. For example you can listen for WASD by listening for player movement, or the numerical keys for the hotbar selection.
I was thinking about experimenting a bit in how things are calculated on the server for players and combat and one of the things I’d like to try out is implementing new keybinds. But I’m sure that requires a specific mod made just for that purpose.
I’ve never looked into how mods are made nowadays (Last time I made a mod was before forge existed) and don’t really have a clue how all of that works. But, it might be a viable option to create my own Minecraft launcher that includes a mod that allows for custom made keybinds which I can make on the client mod.
I’ll probably get to work on my insignificant expiriments and see about creating a client-side mod for it if I feel It requires it to be a viable project.
Thanks for your response
There is a PR that implements a key binding API, these key bindings will be synced from the server to the client and the client sends when they are being pressed/released. This is something will possibly be available for API 8 (which targets 1.13+).