if (inventory.isFull()) {
return State.DROP;
} else {
tinRocks.interact("Mine");
return State.MINE;
}
You should not be interacting at all in your getState() method. getState() is purely for 'getting the state'. Thus, it should be:
if (inventory.isFull()) {
return State.DROP;
}
return State.MINE; //because you already know the
//inventory isn't full because it didn't returnState.DROP
//hence you don't need the 'else'
Also, you might want to consider checking if your player is animating. You need to either use a conditionalsleep to check when your player has stopped animating, or you need to make a new state that is validated if your player is animating. Otherwise, when it's mining, it will keep finding other rocks to mine, and will click away from your current rock.
Also, it's very inefficient and costly to initialize an object in your getState() method. I'd say it's not inherently necessary to do so either, so I'd recommend finding a way around it.
currentRock.interact("Mine");
sleepB(1500);
Rocks will not always take exactly 1.5 seconds to mine. I'd look into conditional sleeps here if I were you. Or, like I said, make a new state, and just break the 'MINE' state directly after interacting.
Also note that you should be checking if the rock is a null! You might get null pointer exceptions when running the script.
Edit: my bad looks like you have a check for if your player is animating. I'd implement a conditional sleep after interacting with the rock that checks if it's a null though