IMBlocker is a Minecraft mod that automatically switch your input method on/off.
When playing Minecraft, you close input method for playing and open input method for chatting. Switching input method frequently makes you annoyed.
That's why we need IMBlocker, who can detect the game's current state and switch input method for you.
- How Minecraft Processes inputs
- Minecraft calls both key input processing and char input processing every time we input
- key input is not what we care
- char input is dispatched to Minecraft's current GUI
Screen
, which then usually delegates down to aTextFieldWidget
somewhere - Normally a
TextFieldWidget
reacts for this input, but when GUIScreen
does not exist, they decided not to call delegate, or theTextFieldWidget
is not active, nothing would react - Whether reacted or not, the char input processing is called
- We can't find out if the game would like to receive out char input
- How IMBlocker detect char input state
- We find out all of
TextFieldWidget
s - We use ASM hacking its constructor to accomplish that
- If any
TextFieldWidget
accepts char input, we believe the game accepts it
- We find out all of
- Special cases
- Some
Screen
s like Book and Quill and Sign directly receive input, rather than redirecting it toTextFieldWidget
s - We can't capture their inputs, so we make a whitelist for them
- Some
- Limits
- One
TextFieldWidget
can accept char input, but the game may not call him with real inputs - On Platforms other than Windows we don't know how to disable/enable input methods
- Suggestions and feedbacks are welcomed
- One