环境
MCP&eclipse
InPutFix在MCP中的源码
位置:net.minecraft.gui.GuiScreenInPutFix源码public void handleKeyboardInput() throws IOException { int k = Keyboard.getEventKey(); char c = Keyboard.getEventCharacter(); if (Keyboard.getEventKeyState() || k == 0 && Character.isDefined(c)) { this.keyTyped(c, k); } this.mc.dispatchKeypresses(); }Minecraft反编译源码 /** * Handles keyboard input. */ public void handleKeyboardInput() throws IOException { if (Keyboard.getEventKeyState()) { this.keyTyped(Keyboard.getEventCharacter(), Keyboard.getEventKey()); } this.mc.dispatchKeypresses(); }
keyboard是LWJGL库的类,文档:;Character是Java库的类,文档:
所以,InputFix添加了对字符的判断(按键event=0时),让字符也能被判断为输入内容