0
votes

I am making some key-binds for my speed-hack. I have part of the key-binds done. This is the error I get I think it is caused by putting the boolean in the wrong place.

== MCP v4.4 ==

> Recompiling client...
javac -g -source 1.6 -target 1.6 -classpath "lib/:lib/*:jars/bin/minecraft.jar:jars/bin/jinput.jar:jars/bin/lwjgl.jar:jars/bin/lwjgl_util.jar" -sourcepath src/minecraft -d bin/minecraft src/minecraft/net/minecraft/isom/*.java src/minecraft/net/minecraft/client/*.java src/minecraft/net/minecraft/src/*.java  conf/patches/*.java failed.
Return code : 1

== ERRORS FOUND ==

src/minecraft/net/minecraft/src/GuiIngame.java:48: illegal start of expression
public boolean checkKey(int i)
^

src/minecraft/net/minecraft/src/GuiIngame.java:48: ';' expected
public boolean checkKey(int i)
^

src/minecraft/net/minecraft/src/GuiIngame.java:48: ';' expected
public boolean checkKey(int i)
^

CODE

{
    public boolean checkKey(int i)  

    if(mc.currentScreen != null)
    {
        return false;
    }
    if(Keyboard.isKeyDown(i) != keyStates[i])
    {
        return keyStates[i] = !keyStates[i];
    } else
    {
        return false;
    }
}

EDIT NEW PROBLEM

CODE

Stack overflows formatting is funny so using pasteie http://pastie.org/2741100

3
You error is listed as being on line 48, so you aren't giving us all the code necessary to aid in solving the problem. - Brandon Buck
You want the entile .java file? - jtl999
Well, like I said, you error is on line 48, chances are it's not with the method syntax. More code relevant to the error would be nice, at least for me. - Brandon Buck
Updated pastie with file - jtl999
your checkKey() method is inside another method... - Sibbo

3 Answers

4
votes

Change:

{
    public boolean checkKey(int i)  

    if(mc.currentScreen != null)

to:

public boolean checkKey(int i)  
{

    if(mc.currentScreen != null)

Assuming the rest of your file has proper syntax.

0
votes

You have your { placed before the public boolean checkKey(int i). It should be placed just after it.

0
votes

Okay, now, the method before checkKey (renderGameOverlay) has no closing bracket, which is most likely what is throwing those errors. Indenting your code properly will help solve those problems.

EDIT*

By "help solve those problems" I mean that it will be easier to notice they're missing.