- Joined
- Jul 2, 2012
- Messages
- 1,080
- Reaction score
- 950
- Points
- 0
Redid a few things, made it easier to update, next time I will make it so you can add your own corrections.
For those who are interested, the source:
How to use:
To enable autocorrect hit the ~ key (above tab), and click autocorrect to toggle. Hit escape to exit the gui. It will only correct a few common things, capitalise your sentence, etc.
Download:
AutoCorrect.rar
Installation instructions:
How to install:
1. Open start menu
2. Type %appdata% in the search bar and hit enter
3. .Minecraft>bin
4. Right click on minecraft.jar and select open with> WinRAR or 7zip
5. Delete META-INF
6. Drag the paste files into your minecraft.jar which you have open in WinRAR.
If you want to add any corrections, lemme know.
For those who are interested, the source:
Code:
package net.minecraft.src;
import java.util.*;
import net.minecraft.client.Minecraft;
import org.lwjgl.input.Keyboard;
public class CorrectChat {
public static String chatMessage;
static List<String> replacementList = new ArrayList<String>();
static String[] subList;
public static String correctedMessage;
public static boolean showGui = false;
private static boolean[] keyStates = new boolean[256];
public static boolean autoCorrect;
public static boolean checkKey(int i, Minecraft mc)
{
if(mc.currentScreen !=null) {
return false;
}
if(Keyboard.isKeyDown(i) != keyStates[i]) {
return keyStates[i] = !keyStates[i];
} else {
return false;
}
}
public static void keyBinds(Minecraft mc) {
if (checkKey(Keyboard.KEY_ESCAPE, mc)) {showGui = false;}
if (checkKey(Keyboard.KEY_GRAVE, mc)) {showGui = true;}
}
public static void onUpdate(Minecraft mc)
{
keyBinds(mc);
if(showGui) {mc.displayGuiScreen(new AutoCorrectGUI());}
}
public static void Main()
{
establishCorrections();
changeToLowerCase(chatMessage);
correctUserInput(chatMessage);
capitalise(chatMessage);
correctedMessage = chatMessage;
}
public static void establishCorrections()
{
addToCorrections("fuck", "fudge");
addToCorrections(" baba ", " hoe ");
addToCorrections(" teh ", " the ");
addToCorrections(" waht ", " what ");
addToCorrections(" u ", " you ");
}
public static void changeToLowerCase(String par1Str)
{
chatMessage = par1Str.toLowerCase();
}
public static void capitalise(String par1Str)
{
chatMessage = chatMessage.substring(0, 1).toUpperCase() + chatMessage.substring(1).toLowerCase();
replace(" i ", " I ");
replace(" im ", " I'm ");
replace(" i'm ", " I'm ");
replace(" Im ", " I'm ");
}
public static void addToCorrections(String par1Str, String par2Str)
{
replacementList.add(par1Str + ":" + par2Str);
}
public static void recieveChatMessageFromOriginalClass(String chatMessageX)
{
chatMessage = chatMessageX;
Main();
}
public static void replace(String par1Str, String par2Str)
{
chatMessage = chatMessage.replaceAll(par1Str, par2Str);
}
public static void correctUserInput(String par1Str)
{
String regex = ":";
for(String z: replacementList)
{
subList = z.split(regex);
replace(subList[0], subList[1]);
}
}
}
Code:
package net.minecraft.src;
import net.minecraft.src.GuiButton;
public class AutoCorrectGUI extends GuiScreen {
public void initGui()
{
controlList.clear();
controlList.add(new GuiButton(1, 70, 5, 20, 20, ""));
}
public void drawScreen(int i, int j, float f)
{
drawRect(2, 2, 100, 30, 0x80808080);
//Toggles
if(CorrectChat.autoCorrect) {mc.fontRenderer.drawString("Auto Correct", 3, 12, 0x00FF00);}
else {mc.fontRenderer.drawString("Auto Correct", 3, 12, 0xFF0000);}
super.drawScreen(i, j, f);
}
public void actionPerformed(GuiButton guiButton)
{switch (guiButton.id)
{
case 1:
CorrectChat.autoCorrect = !CorrectChat.autoCorrect;
break;
}
}
}
How to use:
To enable autocorrect hit the ~ key (above tab), and click autocorrect to toggle. Hit escape to exit the gui. It will only correct a few common things, capitalise your sentence, etc.
Download:
AutoCorrect.rar
Installation instructions:
How to install:
1. Open start menu
2. Type %appdata% in the search bar and hit enter
3. .Minecraft>bin
4. Right click on minecraft.jar and select open with> WinRAR or 7zip
5. Delete META-INF
6. Drag the paste files into your minecraft.jar which you have open in WinRAR.
If you want to add any corrections, lemme know.