This repository has been archived by the owner on Jan 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
70b8245
commit 81e36e1
Showing
12 changed files
with
297 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
Manifest-Version: 1.0 | ||
FMLCorePlugin: org.devinprogress.inputfix.TransformerLoader | ||
Created-By: 1.7.0 (Oracle Corporation) | ||
FMLCorePlugin: org.devinprogress.YAIF.TransformerLoader | ||
FMLCorePluginContainsFMLMod: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
## Yet Another InputFix Mod | ||
Using ASM Transformer to hook into Minecraft, hoping to provide a universal solution available anywhere. | ||
Using ASM Transformer to hook into Minecraft, hoping to provide a universal solution to Minecraft IME issue. | ||
Forge Required. | ||
|
||
## Bugs & TODOs | ||
|
||
- IBus still not work. | ||
- Make it available for GuiEditSign & GuiEditBook | ||
- Complete the Bridge system | ||
|
||
## License | ||
- GPLv3 | ||
- **NOT** allowed in ModPacks without my permission. | ||
- USE AT YOUR OWN RISK |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
src/main/java/org/devinprogress/YAIF/Bridges/GuiChatBridge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
package org.devinprogress.YAIF.Bridges; | ||
|
||
import cpw.mods.fml.client.FMLClientHandler; | ||
import net.minecraft.client.gui.GuiChat; | ||
import net.minecraft.client.gui.GuiTextField; | ||
import org.devinprogress.YAIF.InputFieldWrapper; | ||
import org.devinprogress.YAIF.YetAnotherInputFix; | ||
|
||
import javax.swing.*; | ||
import java.lang.reflect.Field; | ||
import java.lang.reflect.Method; | ||
import java.util.logging.Logger; | ||
|
||
/** | ||
* Created by recursiveg on 14-9-13. | ||
*/ | ||
public class GuiChatBridge implements IActionBridge { | ||
private GuiChat screen=null; | ||
private GuiTextField txt=null; | ||
private InputFieldWrapper wrapper=null; | ||
|
||
private static Method keyTypedMethod=null; | ||
|
||
public GuiChatBridge(GuiTextField textField,GuiChat screen,InputFieldWrapper wrapper){ | ||
this.screen=screen; | ||
txt=textField; | ||
this.wrapper=wrapper; | ||
wrapper.DoActions(ActionFeedback.SetText,txt.getText()); | ||
|
||
//TODO: use AccessTransformer instead of reflection | ||
if(keyTypedMethod==null){ | ||
for(Method m:screen.getClass().getDeclaredMethods()){ | ||
if(m.getParameterTypes().length==2&&m.getReturnType()==void.class&&m.getParameterTypes()[0]==char.class&&m.getParameterTypes()[1]==int.class){ | ||
//The Method Desc "(CI)V" seem to be unique | ||
keyTypedMethod=m; | ||
keyTypedMethod.setAccessible(true); | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public ActionFeedback onEnter(JTextField txt) { //send | ||
this.txt.setText(txt.getText()); | ||
/*try { | ||
keyTypedMethod.invoke(screen, '\n', 28);//Magic Numbers can be found at http://minecraft.gamepedia.com/Key_Codes | ||
}catch(Exception e){ | ||
e.printStackTrace(); | ||
}*/ | ||
return ActionFeedback.Quit; | ||
} | ||
|
||
@Override | ||
public ActionFeedback onEsc(JTextField txt) { | ||
/*try { | ||
keyTypedMethod.invoke(screen, ' ', 1); | ||
}catch(Exception e){ | ||
e.printStackTrace(); | ||
}*/ | ||
return ActionFeedback.Quit; | ||
} | ||
|
||
@Override | ||
public ActionFeedback onChange(JTextField txt) { | ||
this.txt.setText(txt.getText()); | ||
return IActionBridge.ActionFeedback.Nothing; | ||
} | ||
|
||
@Override | ||
public ActionFeedback onTab(JTextField txt) { | ||
YetAnotherInputFix.logger.info("Tab Completion not finished yet."); | ||
//TODO: Finish it. | ||
return null;//return null == return Nothing | ||
} | ||
|
||
@Override | ||
public ActionFeedback onUp(JTextField txt) { | ||
try { | ||
keyTypedMethod.invoke(screen, ' ', 200); | ||
}catch(Exception e){ | ||
e.printStackTrace(); | ||
} | ||
wrapper.setTextNoEvent(this.txt.getText()); | ||
return null; | ||
} | ||
|
||
@Override | ||
public ActionFeedback onDown(JTextField txt) { | ||
try { | ||
keyTypedMethod.invoke(screen, ' ', 208); | ||
}catch(Exception e){ | ||
e.printStackTrace(); | ||
} | ||
wrapper.setTextNoEvent(this.txt.getText()); | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.