Here is the code I have so far:
public void click(int x, int y, int xT, int yT, boolean button) {
x = mX = dev(x, xT);
y = mY = dev(y, yT);
int b0 = button ? MouseEvent.BUTTON1 : MouseEvent.BUTTON2;
long t0 = System.currentTimeMillis(), t1 = t0;
t0 -= dev(1, 80F);
Component c = bot.getCanvas();
MouseEvent evt = new MouseEvent(c, MouseEvent.MOUSE_MOVED, t0, 0, x, y, 1, false, b0);
bot.getMouseEventHandler().mouseMoved(evt);
evt = new MouseEvent(c, MouseEvent.MOUSE_PRESSED, t0, 0, x, y, 1, false, b0);
bot.getMouseEventHandler().mousePressed(evt);
evt = new MouseEvent(c, MouseEvent.MOUSE_RELEASED, t1, 0, x, y, 1, false, b0);
bot.getMouseEventHandler().mouseReleased(evt);
evt = new MouseEvent(c, MouseEvent.MOUSE_CLICKED, t1, 0, x, y, 1, false, b0);
bot.getMouseEventHandler().mouseClicked(evt);
}
I am painting mX and mY and it's definitely on the game screen yet it is not registering as a click, not walking or even showing hover options when the mouse event is fired over an object. Any ideas? EDIT: The code DOES work but only when human input is ENABLED in the gui. Upon disabling human input, the code no longer clicks. How can I bypass this?