Posted March 11, 20232 yr Hi- I'm developing a small mod where the player will have access to a range of abilities and, to keep the keybind clutter down, I've decided to implement a single keybind that will trigger a radial menu for ability selection. Normally I'd just make a Screen for this, but I'd like to let keyboard input pass since the radial menu itself won't use any keybinds and allowing the player to move while in the menu will be quite nice. Thus my question: Is there a way to let keyboard input pass a Screen? Or should I make an IIngameOverlay and manually releaseMouse() for the selection? I've tried setting Screen.passEvents to true, but I don't think I read its usages in the code properly since it doesn't seem to allow the player to move while in the screen. Thanks. Edited March 11, 20232 yr by _Beau additional info
March 13, 20232 yr Author After a bit more of a dive through the code I've figured out roughly how player movement inputs are interrupted by screens and it's looking like it would require a mixin to unlock movement for my radial menu if it's implemented as a screen. Will investigate the idea of an overlay and manually releasing the mouse for menu selection.
March 13, 20232 yr Author Manually releasing and grabbing the mouse seems to have done the trick. I'm doing it quite simply- not sure if using these methods outside a vanilla context could have any weird side effects. public void setActive(boolean active) { if(active) { Minecraft.getInstance().mouseHandler.releaseMouse(); } else { Minecraft.getInstance().mouseHandler.grabMouse(); } this.active = active; }
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.