2
votes

I am trying to use the Java Robot class to move the player's camera. I am going to move it with a midi keyboard, I have all the other movements worked out, but mouse is much harder.

When I try:

Robot r = new Robot();
Point m = MouseInfo.getPointerInfo().getLocation();
int x = m.x;
int y =m.y;

if(shortMessage.getData1() == 78) {
    r.mouseMove(x+shortMessage.getData2(),y);
}
else if(shortMessage.getData1() == 76) {

}

It makes the camera look down and turn around.

I really don't want to code a mod for Minecraft and keep it external.

I tried, with the same code, in the game Payday 2 and it worked flawlessly.

1
I have the same problem: as addition, even just calling mouseMove with the current coordinates from MouseInfo causes the camera to look down.Infima

1 Answers

0
votes

In-game, go to Options > Controls > Mouse Settings and set Raw input to OFF. Now you can simulate in-game mouse movement externally, like with awt.Robot.mouseMove.