├── .gitignore ├── 1.11-1.11.2 ├── .gitignore ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── src │ └── main │ ├── java │ └── com │ │ └── github │ │ └── skystardust │ │ └── InputMethodBlocker │ │ ├── GameEventHandle.java │ │ ├── InputMethodBlocker.java │ │ ├── NativeUtils.java │ │ ├── OSChecker.java │ │ └── ReflectionUtils.java │ └── resources │ ├── InputMethodBlocker-Natives-x64.dll │ ├── InputMethodBlocker-Natives-x86.dll │ └── mcmod.info ├── 1.7.x ├── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── src │ └── main │ ├── java │ └── com │ │ └── github │ │ └── skystardust │ │ └── InputMethodBlocker │ │ ├── GameEventHandle.java │ │ ├── InputMethodBlocker.java │ │ ├── NativeUtils.java │ │ ├── OSChecker.java │ │ └── ReflectionUtils.java │ └── resources │ ├── InputMethodBlocker-Natives-x64.dll │ ├── InputMethodBlocker-Natives-x86.dll │ └── mcmod.info ├── 1.8.x ├── .gitignore ├── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── src │ └── main │ ├── java │ └── com │ │ └── github │ │ └── skystardust │ │ └── InputMethodBlocker │ │ ├── GameEventHandle.java │ │ ├── InputMethodBlocker.java │ │ ├── NativeUtils.java │ │ ├── OSChecker.java │ │ └── ReflectionUtils.java │ └── resources │ ├── InputMethodBlocker-Natives-x64.dll │ ├── InputMethodBlocker-Natives-x86.dll │ └── mcmod.info ├── 1.9-1.10.2 ├── .gitignore ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── src │ └── main │ ├── java │ └── com │ │ └── github │ │ └── skystardust │ │ └── InputMethodBlocker │ │ ├── GameEventHandle.java │ │ ├── InputMethodBlocker.java │ │ ├── NativeUtils.java │ │ ├── OSChecker.java │ │ └── ReflectionUtils.java │ └── resources │ ├── InputMethodBlocker-Natives-x64.dll │ ├── InputMethodBlocker-Natives-x86.dll │ └── mcmod.info ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # eclipse 2 | *.launch 3 | .settings 4 | .metadata 5 | .classpath 6 | .project 7 | 8 | # idea 9 | *.ipr 10 | *.iws 11 | *.iml 12 | 13 | 14 | # other 15 | *.txt 16 | *.json 17 | 18 | #1.7.x 19 | 1.7.x/.gradle 20 | 1.7.x/.idea 21 | 1.7.x/.settings 22 | 1.7.x/bin 23 | 1.7.x/build 24 | 1.7.x/config 25 | 1.7.x/crash-reports 26 | 1.7.x/eclipse 27 | 1.7.x/logs 28 | 1.7.x/mods 29 | 1.7.x/resourcepacks 30 | 1.7.x/saves 31 | 32 | #1.8.x 33 | 1.8.x/.gradle 34 | 1.8.x/.idea 35 | 1.8.x/.settings 36 | 1.8.x/build 37 | 1.8.x/eclipse 38 | 1.8.x/run 39 | 40 | #1.9-1.10.2 41 | 1.9-1.10.2/.gradle 42 | 1.9-1.10.2/.idea 43 | 1.9-1.10.2/.settings 44 | 1.9-1.10.2/build 45 | 1.9-1.10.2/eclipse 46 | 1.9-1.10.2/run 47 | 48 | #1.11-1.11.2 49 | 1.11-1.11.2/.gradle 50 | 1.11-1.11.2/.idea 51 | 1.11-1.11.2/.settings 52 | 1.11-1.11.2/build 53 | 1.11-1.11.2/eclipse 54 | 1.11-1.11.2/run -------------------------------------------------------------------------------- /1.11-1.11.2/.gitignore: -------------------------------------------------------------------------------- 1 | # eclipse 2 | bin 3 | *.launch 4 | .settings 5 | .metadata 6 | .classpath 7 | .project 8 | 9 | # idea 10 | out 11 | *.ipr 12 | *.iws 13 | *.iml 14 | .idea 15 | 16 | # gradle 17 | build 18 | .gradle 19 | 20 | # other 21 | eclipse 22 | run 23 | -------------------------------------------------------------------------------- /1.11-1.11.2/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | jcenter() 4 | maven { url = "http://files.minecraftforge.net/maven" } 5 | } 6 | dependencies { 7 | classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT' 8 | } 9 | } 10 | apply plugin: 'net.minecraftforge.gradle.forge' 11 | //Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. 12 | 13 | 14 | version = "1.5.0" 15 | group = "com.github.skystardust" // http://maven.apache.org/guides/mini/guide-naming-conventions.html 16 | archivesBaseName = "InputMethodBlocker-1.11-1.11.2" 17 | 18 | sourceCompatibility = targetCompatibility = "1.6" // Need this here so eclipse task generates correctly. 19 | compileJava { 20 | sourceCompatibility = targetCompatibility = "1.6" 21 | } 22 | 23 | minecraft { 24 | version = "1.11.2-13.20.0.2282" 25 | runDir = "run" 26 | 27 | // the mappings can be changed at any time, and must be in the following format. 28 | // snapshot_YYYYMMDD snapshot are built nightly. 29 | // stable_# stables are built at the discretion of the MCP team. 30 | // Use non-default mappings at your own risk. they may not always work. 31 | // simply re-run your setup task after changing the mappings to update your workspace. 32 | mappings = "snapshot_20161220" 33 | // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. 34 | } 35 | 36 | dependencies { 37 | // you may put jars on which you depend on in ./libs 38 | // or you may define them like so.. 39 | //compile "some.group:artifact:version:classifier" 40 | //compile "some.group:artifact:version" 41 | 42 | // real examples 43 | //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env 44 | //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env 45 | 46 | // the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime. 47 | //provided 'com.mod-buildcraft:buildcraft:6.0.8:dev' 48 | 49 | // the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided, 50 | // except that these dependencies get remapped to your current MCP mappings 51 | //deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev' 52 | //deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev' 53 | 54 | // for more info... 55 | // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html 56 | // http://www.gradle.org/docs/current/userguide/dependency_management.html 57 | 58 | } 59 | 60 | processResources { 61 | // this will ensure that this task is redone when the versions change. 62 | inputs.property "version", project.version 63 | inputs.property "mcversion", project.minecraft.version 64 | 65 | // replace stuff in mcmod.info, nothing else 66 | from(sourceSets.main.resources.srcDirs) { 67 | include 'mcmod.info' 68 | 69 | // replace version and mcversion 70 | expand 'version':project.version, 'mcversion':project.minecraft.version 71 | } 72 | 73 | // copy everything else except the mcmod.info 74 | from(sourceSets.main.resources.srcDirs) { 75 | exclude 'mcmod.info' 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /1.11-1.11.2/gradle.properties: -------------------------------------------------------------------------------- 1 | # Sets default memory used for gradle commands. Can be overridden by user or command line properties. 2 | # This is required to provide enough memory for the Minecraft decompilation process. 3 | org.gradle.jvmargs=-Xmx3G 4 | -------------------------------------------------------------------------------- /1.11-1.11.2/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lss233/InputMethodBlocker/c4b208ba52d5059d38394b5c99ca9b678ac67872/1.11-1.11.2/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /1.11-1.11.2/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Sep 14 12:28:28 PDT 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip 7 | -------------------------------------------------------------------------------- /1.11-1.11.2/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /1.11-1.11.2/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /1.11-1.11.2/src/main/java/com/github/skystardust/InputMethodBlocker/GameEventHandle.java: -------------------------------------------------------------------------------- 1 | package com.github.skystardust.InputMethodBlocker; 2 | 3 | import net.minecraft.client.gui.*; 4 | import net.minecraft.client.gui.inventory.GuiContainerCreative; 5 | import net.minecraft.client.gui.inventory.GuiEditSign; 6 | import net.minecraftforge.client.event.GuiOpenEvent; 7 | import net.minecraftforge.client.event.GuiScreenEvent; 8 | import net.minecraftforge.client.event.RenderWorldLastEvent; 9 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 10 | import net.minecraftforge.fml.relauncher.Side; 11 | import net.minecraftforge.fml.relauncher.SideOnly; 12 | 13 | import java.lang.reflect.Field; 14 | 15 | @SideOnly(Side.CLIENT) 16 | public class GameEventHandle { 17 | private static final boolean DEBUG = false; 18 | @SubscribeEvent 19 | public void onChatGUI(GuiOpenEvent event) throws NoSuchFieldException, IllegalAccessException { 20 | if (event.getGui() instanceof GuiChat){ 21 | NativeUtils.activeInputMethod(""); 22 | } 23 | } 24 | @SubscribeEvent 25 | public void onRepairGUI(GuiScreenEvent.MouseInputEvent event) throws NoSuchFieldException, IllegalAccessException { 26 | if (event.getGui() instanceof GuiRepair){ 27 | GuiRepair guiScreen = (GuiRepair) event.getGui(); 28 | if (DEBUG){ 29 | for (Field f:ReflectionUtils.getPrivateObjectList(GuiRepair.class,GuiTextField.class,guiScreen)){ 30 | System.out.println(f); 31 | } 32 | }else { 33 | GuiTextField textField = (GuiTextField) ReflectionUtils.getPrivateField(guiScreen.getClass(),"field_147091_w",guiScreen); 34 | if (textField.isFocused()){ 35 | NativeUtils.activeInputMethod(""); 36 | }else { 37 | NativeUtils.inactiveInputMethod(""); 38 | } 39 | } 40 | } 41 | } 42 | @SubscribeEvent 43 | public void onCreativeGUI(GuiScreenEvent.MouseInputEvent event) throws NoSuchFieldException, IllegalAccessException { 44 | if (event.getGui() instanceof GuiContainerCreative){ 45 | GuiContainerCreative guiContainerCreative = (GuiContainerCreative) event.getGui(); 46 | if (DEBUG){ 47 | for (Field f:ReflectionUtils.getPrivateObjectList(GuiContainerCreative.class,GuiTextField.class,guiContainerCreative)){ 48 | System.out.println(f); 49 | } 50 | }else { 51 | GuiTextField searchField = (GuiTextField) ReflectionUtils.getPrivateField(guiContainerCreative.getClass(),"field_147062_A",guiContainerCreative); 52 | if (searchField.isFocused()){ 53 | NativeUtils.activeInputMethod(""); 54 | }else { 55 | NativeUtils.inactiveInputMethod(""); 56 | } 57 | } 58 | } 59 | } 60 | @SubscribeEvent 61 | public void onControlGUI(GuiOpenEvent event){ 62 | if (event.getGui() instanceof GuiControls){ 63 | NativeUtils.inactiveInputMethod(""); 64 | } 65 | } 66 | @SubscribeEvent 67 | public void onInGameGUI(GuiOpenEvent event){ 68 | if (event.getGui()==null){ 69 | NativeUtils.inactiveInputMethod(""); 70 | } 71 | } 72 | @SubscribeEvent 73 | public void onSign(GuiOpenEvent event){ 74 | if (event.getGui() instanceof GuiEditSign){ 75 | NativeUtils.activeInputMethod(""); 76 | } 77 | } 78 | @SubscribeEvent 79 | public void onCommandBlock(GuiOpenEvent event){ 80 | if (event.getGui() instanceof GuiCommandBlock){ 81 | NativeUtils.activeInputMethod(""); 82 | } 83 | } 84 | @SubscribeEvent 85 | public void onCreateWorld(GuiOpenEvent event){ 86 | if (event.getGui() instanceof GuiCreateWorld){ 87 | NativeUtils.activeInputMethod(""); 88 | } 89 | } 90 | @SubscribeEvent 91 | public void onEditBook(GuiOpenEvent event){ 92 | if (event.getGui() instanceof GuiScreenBook){ 93 | NativeUtils.activeInputMethod(""); 94 | } 95 | } 96 | @SubscribeEvent 97 | public void onRenameWorld(GuiOpenEvent event){ 98 | if (event.getGui() instanceof GuiWorldEdit){ 99 | NativeUtils.activeInputMethod(""); 100 | } 101 | } 102 | @SubscribeEvent 103 | public void onAddServer(GuiOpenEvent event){ 104 | if (event.getGui() instanceof GuiScreenAddServer){ 105 | NativeUtils.activeInputMethod(""); 106 | } 107 | } 108 | @SubscribeEvent 109 | public void onDirectJoinServer(GuiOpenEvent event){ 110 | if (event.getGui() instanceof GuiScreenServerList){ 111 | NativeUtils.activeInputMethod(""); 112 | } 113 | } 114 | @SubscribeEvent 115 | public void onMultiPlayer(GuiOpenEvent event){ 116 | if (event.getGui() instanceof GuiMultiplayer){ 117 | NativeUtils.inactiveInputMethod(""); 118 | } 119 | } 120 | @SubscribeEvent 121 | public void onSelectWorld(GuiOpenEvent event){ 122 | if (event.getGui() instanceof GuiWorldSelection){ 123 | NativeUtils.inactiveInputMethod(""); 124 | } 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /1.11-1.11.2/src/main/java/com/github/skystardust/InputMethodBlocker/InputMethodBlocker.java: -------------------------------------------------------------------------------- 1 | package com.github.skystardust.InputMethodBlocker; 2 | 3 | import net.minecraftforge.common.MinecraftForge; 4 | import net.minecraftforge.fml.common.Mod; 5 | import net.minecraftforge.fml.common.event.FMLInitializationEvent; 6 | import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; 7 | import net.minecraftforge.fml.relauncher.Side; 8 | import net.minecraftforge.fml.relauncher.SideOnly; 9 | 10 | import java.io.*; 11 | 12 | @Mod( 13 | modid = InputMethodBlocker.MOD_ID, 14 | name = InputMethodBlocker.MOD_NAME, 15 | version = InputMethodBlocker.MOD_VERSION, 16 | acceptedMinecraftVersions = InputMethodBlocker.GAME_VERSION 17 | ) 18 | @SideOnly(Side.CLIENT) 19 | public class InputMethodBlocker { 20 | public static final String MOD_ID = "inputmethodblocker"; 21 | public static final String MOD_NAME = "InputMethodBlocker"; 22 | public static final String MOD_VERSION = "1.5.0"; 23 | public static final String GAME_VERSION = "[1.11,1.11.2]"; 24 | 25 | @Mod.EventHandler 26 | public void preInit(FMLPreInitializationEvent event){ 27 | MinecraftForge.EVENT_BUS.register(new GameEventHandle()); 28 | try { 29 | saveNativeFile(); 30 | } catch (IOException e) { 31 | e.printStackTrace(); 32 | } 33 | 34 | } 35 | @Mod.EventHandler 36 | public void init(FMLInitializationEvent event){ 37 | NativeUtils.inactiveInputMethod(""); 38 | } 39 | 40 | public void saveNativeFile() throws IOException { 41 | OSChecker.OSType osType = OSChecker.getOsType(); 42 | if (osType== OSChecker.OSType.WIN_X64){ 43 | saveTempNativeFile("InputMethodBlocker-Natives-x64.dll"); 44 | } 45 | else if (osType== OSChecker.OSType.WIN_X32){ 46 | saveTempNativeFile("InputMethodBlocker-Natives-x86.dll"); 47 | } 48 | } 49 | private void saveTempNativeFile(String fileName) throws IOException { 50 | InputStream fileInputStream = getClass().getClassLoader().getResource(fileName).openStream(); 51 | File nativeFile = File.createTempFile("InputMethodBlocker", ".dll"); 52 | FileOutputStream out = new FileOutputStream(nativeFile); 53 | int i; 54 | byte [] buf = new byte[1024]; 55 | while((i=fileInputStream.read(buf))!=-1) { 56 | out.write(buf,0,i); 57 | } 58 | fileInputStream.close(); 59 | out.close(); 60 | nativeFile.deleteOnExit(); 61 | System.load(nativeFile.toString()); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /1.11-1.11.2/src/main/java/com/github/skystardust/InputMethodBlocker/NativeUtils.java: -------------------------------------------------------------------------------- 1 | package com.github.skystardust.InputMethodBlocker; 2 | 3 | public class NativeUtils { 4 | public static native void inactiveInputMethod(String windowName); 5 | public static native void activeInputMethod(String windowName); 6 | } 7 | -------------------------------------------------------------------------------- /1.11-1.11.2/src/main/java/com/github/skystardust/InputMethodBlocker/OSChecker.java: -------------------------------------------------------------------------------- 1 | package com.github.skystardust.InputMethodBlocker; 2 | 3 | public class OSChecker { 4 | public static OSType getOsType(){ 5 | String typeName = System.getProperty("os.arch"); 6 | if (typeName.contains("64")){ 7 | return OSType.WIN_X64; 8 | } 9 | return OSType.WIN_X32; 10 | } 11 | public enum OSType{ 12 | WIN_X32,WIN_X64 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /1.11-1.11.2/src/main/java/com/github/skystardust/InputMethodBlocker/ReflectionUtils.java: -------------------------------------------------------------------------------- 1 | package com.github.skystardust.InputMethodBlocker; 2 | 3 | import java.lang.reflect.Field; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | public class ReflectionUtils { 8 | public static Object getPrivateField(Class clazz,String name,Object object) throws NoSuchFieldException, IllegalAccessException { 9 | Field field = clazz.getDeclaredField(name); 10 | field.setAccessible(true); 11 | Object returnObject = field.get(object); 12 | return returnObject; 13 | } 14 | public static List getPrivateObjectList(Class clazz, Class type, Object object) throws IllegalAccessException { 15 | Field[] fields = clazz.getDeclaredFields(); 16 | List list = new ArrayList(); 17 | for (int i=0;i \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /1.7.x/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /1.7.x/src/main/java/com/github/skystardust/InputMethodBlocker/GameEventHandle.java: -------------------------------------------------------------------------------- 1 | package com.github.skystardust.InputMethodBlocker; 2 | 3 | import cpw.mods.fml.common.eventhandler.SubscribeEvent; 4 | import net.minecraft.client.gui.*; 5 | import net.minecraft.client.gui.inventory.GuiContainerCreative; 6 | import net.minecraft.client.gui.inventory.GuiEditSign; 7 | import net.minecraftforge.client.event.GuiOpenEvent; 8 | import net.minecraftforge.client.event.GuiScreenEvent; 9 | 10 | import java.lang.reflect.Field; 11 | 12 | public class GameEventHandle { 13 | private static final boolean DEBUG = false; 14 | @SubscribeEvent 15 | public void onChatGUI(GuiOpenEvent event) throws NoSuchFieldException, IllegalAccessException { 16 | if (event.gui instanceof GuiChat){ 17 | NativeUtils.activeInputMethod(""); 18 | } 19 | 20 | } 21 | @SubscribeEvent 22 | public void onRepairGUI(GuiScreenEvent event) throws NoSuchFieldException, IllegalAccessException { 23 | if (event.gui instanceof GuiRepair){ 24 | GuiRepair guiScreen = (GuiRepair) event.gui; 25 | if (DEBUG){ 26 | for (Field f:ReflectionUtils.getPrivateObjectList(GuiRepair.class,GuiTextField.class,guiScreen)){ 27 | System.out.println(f); 28 | } 29 | }else { 30 | GuiTextField textField = null; 31 | try { 32 | textField = (GuiTextField) ReflectionUtils.getPrivateField(guiScreen.getClass(),"field_147091_w",guiScreen); 33 | if (textField.isFocused()){ 34 | NativeUtils.activeInputMethod(""); 35 | }else { 36 | NativeUtils.inactiveInputMethod(""); 37 | } 38 | } catch (NullPointerException e) { 39 | return; 40 | } 41 | } 42 | } 43 | } 44 | @SubscribeEvent 45 | public void onCreativeGUI(GuiScreenEvent event) throws NoSuchFieldException, IllegalAccessException { 46 | if (event.gui instanceof GuiContainerCreative){ 47 | GuiContainerCreative guiContainerCreative = (GuiContainerCreative) event.gui; 48 | if (DEBUG){ 49 | for (Field f:ReflectionUtils.getPrivateObjectList(GuiContainerCreative.class,GuiTextField.class,guiContainerCreative)){ 50 | System.out.println(f); 51 | } 52 | }else { 53 | GuiTextField searchField = null; 54 | try { 55 | searchField = (GuiTextField) ReflectionUtils.getPrivateField(guiContainerCreative.getClass(),"field_147062_A",guiContainerCreative); 56 | if (searchField.isFocused()){ 57 | NativeUtils.activeInputMethod(""); 58 | }else { 59 | NativeUtils.inactiveInputMethod(""); 60 | } 61 | } catch (Exception e) { 62 | return; 63 | } 64 | } 65 | } 66 | } 67 | @SubscribeEvent 68 | public void onControlGUI(GuiOpenEvent event){ 69 | if (event.gui instanceof GuiControls){ 70 | NativeUtils.inactiveInputMethod(""); 71 | } 72 | } 73 | @SubscribeEvent 74 | public void onInGameGUI(GuiOpenEvent event){ 75 | if (event.gui==null){ 76 | NativeUtils.inactiveInputMethod(""); 77 | return; 78 | } 79 | System.out.println(event.gui); 80 | } 81 | @SubscribeEvent 82 | public void onSign(GuiOpenEvent event){ 83 | if (event.gui instanceof GuiEditSign){ 84 | NativeUtils.activeInputMethod(""); 85 | } 86 | } 87 | @SubscribeEvent 88 | public void onCommandBlock(GuiOpenEvent event){ 89 | if (event.gui instanceof GuiCommandBlock){ 90 | NativeUtils.activeInputMethod(""); 91 | } 92 | } 93 | @SubscribeEvent 94 | public void onCreateWorld(GuiOpenEvent event){ 95 | if (event.gui instanceof GuiCreateWorld){ 96 | NativeUtils.activeInputMethod(""); 97 | } 98 | } 99 | @SubscribeEvent 100 | public void onEditBook(GuiOpenEvent event){ 101 | if (event.gui instanceof GuiScreenBook){ 102 | NativeUtils.activeInputMethod(""); 103 | } 104 | } 105 | @SubscribeEvent 106 | public void onRenameWorld(GuiOpenEvent event){ 107 | if (event.gui instanceof GuiRenameWorld){ 108 | NativeUtils.activeInputMethod(""); 109 | } 110 | } 111 | @SubscribeEvent 112 | public void onAddServer(GuiOpenEvent event){ 113 | if (event.gui instanceof GuiScreenAddServer){ 114 | NativeUtils.activeInputMethod(""); 115 | } 116 | } 117 | @SubscribeEvent 118 | public void onDirectJoinServer(GuiOpenEvent event){ 119 | if (event.gui instanceof GuiScreenServerList){ 120 | NativeUtils.activeInputMethod(""); 121 | } 122 | } 123 | @SubscribeEvent 124 | public void onMultiPlayer(GuiOpenEvent event){ 125 | if (event.gui instanceof GuiMultiplayer){ 126 | NativeUtils.inactiveInputMethod(""); 127 | } 128 | } 129 | @SubscribeEvent 130 | public void onSelectWorld(GuiOpenEvent event){ 131 | if (event.gui instanceof GuiSelectWorld){ 132 | NativeUtils.inactiveInputMethod(""); 133 | } 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /1.7.x/src/main/java/com/github/skystardust/InputMethodBlocker/InputMethodBlocker.java: -------------------------------------------------------------------------------- 1 | package com.github.skystardust.InputMethodBlocker; 2 | 3 | import net.minecraftforge.common.MinecraftForge; 4 | 5 | 6 | import java.io.*; 7 | 8 | import cpw.mods.fml.common.Mod; 9 | import cpw.mods.fml.common.event.FMLInitializationEvent; 10 | import cpw.mods.fml.common.event.FMLPreInitializationEvent; 11 | 12 | @Mod( 13 | modid = InputMethodBlocker.MOD_ID, 14 | name = InputMethodBlocker.MOD_NAME, 15 | version = InputMethodBlocker.MOD_VERSION, 16 | acceptedMinecraftVersions = InputMethodBlocker.GAME_VERSION 17 | ) 18 | public class InputMethodBlocker { 19 | public static final String MOD_ID = "inputmethodblocker"; 20 | public static final String MOD_NAME = "InputMethodBlocker"; 21 | public static final String MOD_VERSION = "1.5.0"; 22 | public static final String GAME_VERSION = "[1.7.2,1.7.10]"; 23 | 24 | @Mod.EventHandler 25 | public void preInit(FMLPreInitializationEvent event){ 26 | MinecraftForge.EVENT_BUS.register(new GameEventHandle()); 27 | try { 28 | saveNativeFile(); 29 | } catch (IOException e) { 30 | e.printStackTrace(); 31 | } 32 | 33 | } 34 | @Mod.EventHandler 35 | public void init(FMLInitializationEvent event){ 36 | NativeUtils.inactiveInputMethod(""); 37 | } 38 | 39 | public void saveNativeFile() throws IOException { 40 | OSChecker.OSType osType = OSChecker.getOsType(); 41 | if (osType== OSChecker.OSType.WIN_X64){ 42 | saveTempNativeFile("InputMethodBlocker-Natives-x64.dll"); 43 | } 44 | else if (osType== OSChecker.OSType.WIN_X32){ 45 | saveTempNativeFile("InputMethodBlocker-Natives-x86.dll"); 46 | } 47 | } 48 | private void saveTempNativeFile(String fileName) throws IOException { 49 | InputStream fileInputStream = getClass().getClassLoader().getResource(fileName).openStream(); 50 | File nativeFile = File.createTempFile("InputMethodBlocker", ".dll"); 51 | FileOutputStream out = new FileOutputStream(nativeFile); 52 | int i; 53 | byte [] buf = new byte[1024]; 54 | while((i=fileInputStream.read(buf))!=-1) { 55 | out.write(buf,0,i); 56 | } 57 | fileInputStream.close(); 58 | out.close(); 59 | nativeFile.deleteOnExit(); 60 | System.load(nativeFile.toString()); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /1.7.x/src/main/java/com/github/skystardust/InputMethodBlocker/NativeUtils.java: -------------------------------------------------------------------------------- 1 | package com.github.skystardust.InputMethodBlocker; 2 | 3 | public class NativeUtils { 4 | public static native void inactiveInputMethod(String windowName); 5 | public static native void activeInputMethod(String windowName); 6 | } 7 | -------------------------------------------------------------------------------- /1.7.x/src/main/java/com/github/skystardust/InputMethodBlocker/OSChecker.java: -------------------------------------------------------------------------------- 1 | package com.github.skystardust.InputMethodBlocker; 2 | 3 | public class OSChecker { 4 | public static OSType getOsType(){ 5 | String typeName = System.getProperty("os.arch"); 6 | if (typeName.contains("64")){ 7 | return OSType.WIN_X64; 8 | } 9 | return OSType.WIN_X32; 10 | } 11 | public enum OSType{ 12 | WIN_X32,WIN_X64 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /1.7.x/src/main/java/com/github/skystardust/InputMethodBlocker/ReflectionUtils.java: -------------------------------------------------------------------------------- 1 | package com.github.skystardust.InputMethodBlocker; 2 | 3 | import java.lang.reflect.Field; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | public class ReflectionUtils { 8 | public static Object getPrivateField(Class clazz,String name,Object object) throws NoSuchFieldException, IllegalAccessException { 9 | Field field = clazz.getDeclaredField(name); 10 | field.setAccessible(true); 11 | Object returnObject = field.get(object); 12 | return returnObject; 13 | } 14 | public static List getPrivateObjectList(Class clazz, Class type, Object object) throws IllegalAccessException { 15 | Field[] fields = clazz.getDeclaredFields(); 16 | List list = new ArrayList(); 17 | for (int i=0;i \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /1.8.x/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /1.8.x/src/main/java/com/github/skystardust/InputMethodBlocker/GameEventHandle.java: -------------------------------------------------------------------------------- 1 | package com.github.skystardust.InputMethodBlocker; 2 | 3 | import net.minecraft.client.gui.*; 4 | import net.minecraft.client.gui.inventory.GuiContainerCreative; 5 | import net.minecraft.client.gui.inventory.GuiEditSign; 6 | import net.minecraftforge.client.event.GuiOpenEvent; 7 | import net.minecraftforge.client.event.GuiScreenEvent; 8 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 9 | import net.minecraftforge.fml.relauncher.Side; 10 | import net.minecraftforge.fml.relauncher.SideOnly; 11 | 12 | import java.lang.reflect.Field; 13 | 14 | @SideOnly(Side.CLIENT) 15 | public class GameEventHandle { 16 | private static final boolean DEBUG = false; 17 | @SubscribeEvent 18 | public void onChatGUI(GuiOpenEvent event) throws NoSuchFieldException, IllegalAccessException { 19 | if (event.gui instanceof GuiChat){ 20 | NativeUtils.activeInputMethod(""); 21 | } 22 | } 23 | @SubscribeEvent 24 | public void onRepairGUI(GuiScreenEvent.MouseInputEvent event) throws NoSuchFieldException, IllegalAccessException { 25 | if (event.gui instanceof GuiRepair){ 26 | GuiRepair guiScreen = (GuiRepair) event.gui; 27 | if (DEBUG){ 28 | for (Field f:ReflectionUtils.getPrivateObjectList(GuiRepair.class,GuiTextField.class,guiScreen)){ 29 | System.out.println(f); 30 | } 31 | }else { 32 | GuiTextField textField = (GuiTextField) ReflectionUtils.getPrivateField(guiScreen.getClass(),"field_147091_w",guiScreen); 33 | if (textField.isFocused()){ 34 | NativeUtils.activeInputMethod(""); 35 | }else { 36 | NativeUtils.inactiveInputMethod(""); 37 | } 38 | } 39 | } 40 | } 41 | @SubscribeEvent 42 | public void onCreativeGUI(GuiScreenEvent.MouseInputEvent event) throws NoSuchFieldException, IllegalAccessException { 43 | if (event.gui instanceof GuiContainerCreative){ 44 | GuiContainerCreative guiContainerCreative = (GuiContainerCreative) event.gui; 45 | if (DEBUG){ 46 | for (Field f:ReflectionUtils.getPrivateObjectList(GuiContainerCreative.class,GuiTextField.class,guiContainerCreative)){ 47 | System.out.println(f); 48 | } 49 | }else { 50 | GuiTextField searchField = (GuiTextField) ReflectionUtils.getPrivateField(guiContainerCreative.getClass(),"field_147062_A",guiContainerCreative); 51 | if (searchField.isFocused()){ 52 | NativeUtils.activeInputMethod(""); 53 | }else { 54 | NativeUtils.inactiveInputMethod(""); 55 | } 56 | } 57 | } 58 | } 59 | @SubscribeEvent 60 | public void onControlGUI(GuiOpenEvent event){ 61 | if (event.gui instanceof GuiControls){ 62 | NativeUtils.inactiveInputMethod(""); 63 | } 64 | } 65 | @SubscribeEvent 66 | public void onInGameGUI(GuiOpenEvent event){ 67 | if (event.gui==null){ 68 | NativeUtils.inactiveInputMethod(""); 69 | } 70 | } 71 | @SubscribeEvent 72 | public void onSign(GuiOpenEvent event){ 73 | if (event.gui instanceof GuiEditSign){ 74 | NativeUtils.activeInputMethod(""); 75 | } 76 | } 77 | @SubscribeEvent 78 | public void onCommandBlock(GuiOpenEvent event){ 79 | if (event.gui instanceof GuiCommandBlock){ 80 | NativeUtils.activeInputMethod(""); 81 | } 82 | } 83 | @SubscribeEvent 84 | public void onCreateWorld(GuiOpenEvent event){ 85 | if (event.gui instanceof GuiCreateWorld){ 86 | NativeUtils.activeInputMethod(""); 87 | } 88 | } 89 | @SubscribeEvent 90 | public void onEditBook(GuiOpenEvent event){ 91 | if (event.gui instanceof GuiScreenBook){ 92 | NativeUtils.activeInputMethod(""); 93 | } 94 | } 95 | @SubscribeEvent 96 | public void onRenameWorld(GuiOpenEvent event){ 97 | if (event.gui instanceof GuiRenameWorld){ 98 | NativeUtils.activeInputMethod(""); 99 | } 100 | } 101 | @SubscribeEvent 102 | public void onAddServer(GuiOpenEvent event){ 103 | if (event.gui instanceof GuiScreenAddServer){ 104 | NativeUtils.activeInputMethod(""); 105 | } 106 | } 107 | @SubscribeEvent 108 | public void onDirectJoinServer(GuiOpenEvent event){ 109 | if (event.gui instanceof GuiScreenServerList){ 110 | NativeUtils.activeInputMethod(""); 111 | } 112 | } 113 | @SubscribeEvent 114 | public void onMultiPlayer(GuiOpenEvent event){ 115 | if (event.gui instanceof GuiMultiplayer){ 116 | NativeUtils.inactiveInputMethod(""); 117 | } 118 | } 119 | @SubscribeEvent 120 | public void onSelectWorld(GuiOpenEvent event){ 121 | if (event.gui instanceof GuiSelectWorld){ 122 | NativeUtils.inactiveInputMethod(""); 123 | } 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /1.8.x/src/main/java/com/github/skystardust/InputMethodBlocker/InputMethodBlocker.java: -------------------------------------------------------------------------------- 1 | package com.github.skystardust.InputMethodBlocker; 2 | 3 | import net.minecraftforge.common.MinecraftForge; 4 | import net.minecraftforge.fml.common.Mod; 5 | import net.minecraftforge.fml.common.event.FMLInitializationEvent; 6 | import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; 7 | import net.minecraftforge.fml.relauncher.Side; 8 | import net.minecraftforge.fml.relauncher.SideOnly; 9 | 10 | import java.io.*; 11 | 12 | @Mod( 13 | modid = InputMethodBlocker.MOD_ID, 14 | name = InputMethodBlocker.MOD_NAME, 15 | version = InputMethodBlocker.MOD_VERSION, 16 | acceptedMinecraftVersions = InputMethodBlocker.GAME_VERSION 17 | ) 18 | @SideOnly(Side.CLIENT) 19 | public class InputMethodBlocker { 20 | public static final String MOD_ID = "inputmethodblocker"; 21 | public static final String MOD_NAME = "InputMethodBlocker"; 22 | public static final String MOD_VERSION = "1.5.0"; 23 | public static final String GAME_VERSION = "[1.8,1.8.9]"; 24 | 25 | @Mod.EventHandler 26 | public void preInit(FMLPreInitializationEvent event){ 27 | MinecraftForge.EVENT_BUS.register(new GameEventHandle()); 28 | try { 29 | saveNativeFile(); 30 | } catch (IOException e) { 31 | e.printStackTrace(); 32 | } 33 | 34 | } 35 | @Mod.EventHandler 36 | public void init(FMLInitializationEvent event){ 37 | NativeUtils.inactiveInputMethod(""); 38 | } 39 | 40 | public void saveNativeFile() throws IOException { 41 | OSChecker.OSType osType = OSChecker.getOsType(); 42 | if (osType== OSChecker.OSType.WIN_X64){ 43 | saveTempNativeFile("InputMethodBlocker-Natives-x64.dll"); 44 | } 45 | else if (osType== OSChecker.OSType.WIN_X32){ 46 | saveTempNativeFile("InputMethodBlocker-Natives-x86.dll"); 47 | } 48 | } 49 | private void saveTempNativeFile(String fileName) throws IOException { 50 | InputStream fileInputStream = getClass().getClassLoader().getResource(fileName).openStream(); 51 | File nativeFile = File.createTempFile("InputMethodBlocker", ".dll"); 52 | FileOutputStream out = new FileOutputStream(nativeFile); 53 | int i; 54 | byte [] buf = new byte[1024]; 55 | while((i=fileInputStream.read(buf))!=-1) { 56 | out.write(buf,0,i); 57 | } 58 | fileInputStream.close(); 59 | out.close(); 60 | nativeFile.deleteOnExit(); 61 | System.load(nativeFile.toString()); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /1.8.x/src/main/java/com/github/skystardust/InputMethodBlocker/NativeUtils.java: -------------------------------------------------------------------------------- 1 | package com.github.skystardust.InputMethodBlocker; 2 | 3 | public class NativeUtils { 4 | public static native void inactiveInputMethod(String windowName); 5 | public static native void activeInputMethod(String windowName); 6 | } 7 | -------------------------------------------------------------------------------- /1.8.x/src/main/java/com/github/skystardust/InputMethodBlocker/OSChecker.java: -------------------------------------------------------------------------------- 1 | package com.github.skystardust.InputMethodBlocker; 2 | 3 | public class OSChecker { 4 | public static OSType getOsType(){ 5 | String typeName = System.getProperty("os.arch"); 6 | if (typeName.contains("64")){ 7 | return OSType.WIN_X64; 8 | } 9 | return OSType.WIN_X32; 10 | } 11 | public enum OSType{ 12 | WIN_X32,WIN_X64 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /1.8.x/src/main/java/com/github/skystardust/InputMethodBlocker/ReflectionUtils.java: -------------------------------------------------------------------------------- 1 | package com.github.skystardust.InputMethodBlocker; 2 | 3 | import java.lang.reflect.Field; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | public class ReflectionUtils { 8 | public static Object getPrivateField(Class clazz,String name,Object object) throws NoSuchFieldException, IllegalAccessException { 9 | Field field = clazz.getDeclaredField(name); 10 | field.setAccessible(true); 11 | Object returnObject = field.get(object); 12 | return returnObject; 13 | } 14 | public static List getPrivateObjectList(Class clazz, Class type, Object object) throws IllegalAccessException { 15 | Field[] fields = clazz.getDeclaredFields(); 16 | List list = new ArrayList(); 17 | for (int i=0;i \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /1.9-1.10.2/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /1.9-1.10.2/src/main/java/com/github/skystardust/InputMethodBlocker/GameEventHandle.java: -------------------------------------------------------------------------------- 1 | package com.github.skystardust.InputMethodBlocker; 2 | 3 | import net.minecraft.client.gui.*; 4 | import net.minecraft.client.gui.inventory.GuiContainerCreative; 5 | import net.minecraft.client.gui.inventory.GuiEditSign; 6 | import net.minecraftforge.client.event.GuiOpenEvent; 7 | import net.minecraftforge.client.event.GuiScreenEvent; 8 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 9 | import net.minecraftforge.fml.relauncher.Side; 10 | import net.minecraftforge.fml.relauncher.SideOnly; 11 | 12 | import java.lang.reflect.Field; 13 | 14 | @SideOnly(Side.CLIENT) 15 | public class GameEventHandle { 16 | private static final boolean DEBUG = false; 17 | @SubscribeEvent 18 | public void onChatGUI(GuiOpenEvent event) throws NoSuchFieldException, IllegalAccessException { 19 | if (event.getGui() instanceof GuiChat){ 20 | NativeUtils.activeInputMethod(""); 21 | } 22 | } 23 | @SubscribeEvent 24 | public void onRepairGUI(GuiScreenEvent.MouseInputEvent event) throws NoSuchFieldException, IllegalAccessException { 25 | if (event.getGui() instanceof GuiRepair){ 26 | GuiRepair guiScreen = (GuiRepair) event.getGui(); 27 | if (DEBUG){ 28 | for (Field f:ReflectionUtils.getPrivateObjectList(GuiRepair.class,GuiTextField.class,guiScreen)){ 29 | System.out.println(f); 30 | } 31 | }else { 32 | GuiTextField textField = (GuiTextField) ReflectionUtils.getPrivateField(guiScreen.getClass(),"field_147091_w",guiScreen); 33 | if (textField.isFocused()){ 34 | NativeUtils.activeInputMethod(""); 35 | }else { 36 | NativeUtils.inactiveInputMethod(""); 37 | } 38 | } 39 | } 40 | } 41 | @SubscribeEvent 42 | public void onCreativeGUI(GuiScreenEvent.MouseInputEvent event) throws NoSuchFieldException, IllegalAccessException { 43 | if (event.getGui() instanceof GuiContainerCreative){ 44 | GuiContainerCreative guiContainerCreative = (GuiContainerCreative) event.getGui(); 45 | if (DEBUG){ 46 | for (Field f:ReflectionUtils.getPrivateObjectList(GuiContainerCreative.class,GuiTextField.class,guiContainerCreative)){ 47 | System.out.println(f); 48 | } 49 | }else { 50 | GuiTextField searchField = (GuiTextField) ReflectionUtils.getPrivateField(guiContainerCreative.getClass(),"field_147062_A",guiContainerCreative); 51 | if (searchField.isFocused()){ 52 | NativeUtils.activeInputMethod(""); 53 | }else { 54 | NativeUtils.inactiveInputMethod(""); 55 | } 56 | } 57 | } 58 | } 59 | @SubscribeEvent 60 | public void onControlGUI(GuiOpenEvent event){ 61 | if (event.getGui() instanceof GuiControls){ 62 | NativeUtils.inactiveInputMethod(""); 63 | } 64 | } 65 | @SubscribeEvent 66 | public void onInGameGUI(GuiOpenEvent event){ 67 | if (event.getGui()==null){ 68 | NativeUtils.inactiveInputMethod(""); 69 | } 70 | } 71 | @SubscribeEvent 72 | public void onSign(GuiOpenEvent event){ 73 | if (event.getGui() instanceof GuiEditSign){ 74 | NativeUtils.activeInputMethod(""); 75 | } 76 | } 77 | @SubscribeEvent 78 | public void onCommandBlock(GuiOpenEvent event){ 79 | if (event.getGui() instanceof GuiCommandBlock){ 80 | NativeUtils.activeInputMethod(""); 81 | } 82 | } 83 | @SubscribeEvent 84 | public void onCreateWorld(GuiOpenEvent event){ 85 | if (event.getGui() instanceof GuiCreateWorld){ 86 | NativeUtils.activeInputMethod(""); 87 | } 88 | } 89 | @SubscribeEvent 90 | public void onEditBook(GuiOpenEvent event){ 91 | if (event.getGui() instanceof GuiScreenBook){ 92 | NativeUtils.activeInputMethod(""); 93 | } 94 | } 95 | @SubscribeEvent 96 | public void onRenameWorld(GuiOpenEvent event){ 97 | if (event.getGui() instanceof GuiWorldEdit){ 98 | NativeUtils.activeInputMethod(""); 99 | } 100 | } 101 | @SubscribeEvent 102 | public void onAddServer(GuiOpenEvent event){ 103 | if (event.getGui() instanceof GuiScreenAddServer){ 104 | NativeUtils.activeInputMethod(""); 105 | } 106 | } 107 | @SubscribeEvent 108 | public void onDirectJoinServer(GuiOpenEvent event){ 109 | if (event.getGui() instanceof GuiScreenServerList){ 110 | NativeUtils.activeInputMethod(""); 111 | } 112 | } 113 | @SubscribeEvent 114 | public void onMultiPlayer(GuiOpenEvent event){ 115 | if (event.getGui() instanceof GuiMultiplayer){ 116 | NativeUtils.inactiveInputMethod(""); 117 | } 118 | } 119 | @SubscribeEvent 120 | public void onSelectWorld(GuiOpenEvent event){ 121 | if (event.getGui() instanceof GuiWorldSelection){ 122 | NativeUtils.inactiveInputMethod(""); 123 | } 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /1.9-1.10.2/src/main/java/com/github/skystardust/InputMethodBlocker/InputMethodBlocker.java: -------------------------------------------------------------------------------- 1 | package com.github.skystardust.InputMethodBlocker; 2 | 3 | import net.minecraftforge.common.MinecraftForge; 4 | import net.minecraftforge.fml.common.Mod; 5 | import net.minecraftforge.fml.common.event.FMLInitializationEvent; 6 | import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; 7 | import net.minecraftforge.fml.relauncher.Side; 8 | import net.minecraftforge.fml.relauncher.SideOnly; 9 | 10 | import java.io.*; 11 | 12 | @Mod( 13 | modid = InputMethodBlocker.MOD_ID, 14 | name = InputMethodBlocker.MOD_NAME, 15 | version = InputMethodBlocker.MOD_VERSION, 16 | acceptedMinecraftVersions = InputMethodBlocker.GAME_VERSION 17 | ) 18 | @SideOnly(Side.CLIENT) 19 | public class InputMethodBlocker { 20 | public static final String MOD_ID = "inputmethodblocker"; 21 | public static final String MOD_NAME = "InputMethodBlocker"; 22 | public static final String MOD_VERSION = "1.5.0"; 23 | public static final String GAME_VERSION = "[1.9,1.10.2]"; 24 | 25 | @Mod.EventHandler 26 | public void preInit(FMLPreInitializationEvent event){ 27 | MinecraftForge.EVENT_BUS.register(new GameEventHandle()); 28 | try { 29 | saveNativeFile(); 30 | } catch (IOException e) { 31 | e.printStackTrace(); 32 | } 33 | 34 | } 35 | @Mod.EventHandler 36 | public void init(FMLInitializationEvent event){ 37 | NativeUtils.inactiveInputMethod(""); 38 | } 39 | 40 | public void saveNativeFile() throws IOException { 41 | OSChecker.OSType osType = OSChecker.getOsType(); 42 | if (osType== OSChecker.OSType.WIN_X64){ 43 | saveTempNativeFile("InputMethodBlocker-Natives-x64.dll"); 44 | } 45 | else if (osType== OSChecker.OSType.WIN_X32){ 46 | saveTempNativeFile("InputMethodBlocker-Natives-x86.dll"); 47 | } 48 | } 49 | private void saveTempNativeFile(String fileName) throws IOException { 50 | InputStream fileInputStream = getClass().getClassLoader().getResource(fileName).openStream(); 51 | File nativeFile = File.createTempFile("InputMethodBlocker", ".dll"); 52 | FileOutputStream out = new FileOutputStream(nativeFile); 53 | int i; 54 | byte [] buf = new byte[1024]; 55 | while((i=fileInputStream.read(buf))!=-1) { 56 | out.write(buf,0,i); 57 | } 58 | fileInputStream.close(); 59 | out.close(); 60 | nativeFile.deleteOnExit(); 61 | System.load(nativeFile.toString()); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /1.9-1.10.2/src/main/java/com/github/skystardust/InputMethodBlocker/NativeUtils.java: -------------------------------------------------------------------------------- 1 | package com.github.skystardust.InputMethodBlocker; 2 | 3 | public class NativeUtils { 4 | public static native void inactiveInputMethod(String windowName); 5 | public static native void activeInputMethod(String windowName); 6 | } 7 | -------------------------------------------------------------------------------- /1.9-1.10.2/src/main/java/com/github/skystardust/InputMethodBlocker/OSChecker.java: -------------------------------------------------------------------------------- 1 | package com.github.skystardust.InputMethodBlocker; 2 | 3 | public class OSChecker { 4 | public static OSType getOsType(){ 5 | String typeName = System.getProperty("os.arch"); 6 | if (typeName.contains("64")){ 7 | return OSType.WIN_X64; 8 | } 9 | return OSType.WIN_X32; 10 | } 11 | public enum OSType{ 12 | WIN_X32,WIN_X64 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /1.9-1.10.2/src/main/java/com/github/skystardust/InputMethodBlocker/ReflectionUtils.java: -------------------------------------------------------------------------------- 1 | package com.github.skystardust.InputMethodBlocker; 2 | 3 | import java.lang.reflect.Field; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | public class ReflectionUtils { 8 | public static Object getPrivateField(Class clazz,String name,Object object) throws NoSuchFieldException, IllegalAccessException { 9 | Field field = clazz.getDeclaredField(name); 10 | field.setAccessible(true); 11 | Object returnObject = field.get(object); 12 | return returnObject; 13 | } 14 | public static List getPrivateObjectList(Class clazz, Class type, Object object) throws IllegalAccessException { 15 | Field[] fields = clazz.getDeclaredFields(); 16 | List list = new ArrayList(); 17 | for (int i=0;i