-
环境
MCP&eclipse
-
InPutFix在MCP中的源码
位置:net.minecraft.gui.GuiScreen InPutFix源码 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库的类,文档:http://legacy.lwjgl.org/javadoc/;Character是Java库的类,文档:http://tool.oschina.net/apidocs/apidoc?api=jdk_7u4
所以,InputFix添加了对字符的判断(按键event=0时),让字符也能被判断为输入内容
时间: 2024-10-14 09:21:42