LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: clovis99 on October 02, 2016, 21:21:24

Title: Sending events by program
Post by: clovis99 on October 02, 2016, 21:21:24
Hello,
I want to send mouse and keyboard events programmatically in a mod  for Minecraft. I have try to use java.AWT.Robot but result seems to be unpredictable (I am on Mac OS 10.10.5 and I have heard Robot has problem on it). How can I achieve that?
Excuse me if my question is stupid but I am newbie in LWJGL and Minecraft modding.
Thanks.
Title: Re: Sending events by program
Post by: abcdef on October 03, 2016, 07:46:42
Have you asked this on the minecraft forums? Minecraft uses LWJGL but how they use it is with them and not the LWJGL team. If there is a bug they will come here but you should ask them directly first. If your question is really LWJGL based then post some example LWJGL code showing where you are having issues. Sounds like your question is not LWJGL based though as you are talking about java.awt.Robot
Title: Re: Sending events by program
Post by: clovis99 on October 03, 2016, 10:28:12
Thanks for your answer.
I have try to ask Minecraft forge forum with not much success.
May I reformulate my question:
Is it possible, using LWJGL, to simulate physical mouse click and keyboard key down? Or perhaps to place such event in the event queue?
Title: Re: Sending events by program
Post by: abcdef on October 04, 2016, 08:30:47
I don't believe its possible with LWJGL, LWJGL 3 uses GLFW for all its mouse  / keyboard / controller handling so you can look at GLFW to see if it supports it. I don't know if minecraft uses LWJGL3 though, if it uses LWJGL 2 then the mouse / keyboard handling uses custom code which is basically platform specific and again, from my knowledge, it doesn't have any capabilities to input events manually. There is probably a reason why minecraft mods require you to use java.awt.Robots because its the only generic way of actually doing it but as you say even that has its own problems.

Looks like you are stuck unfortunately. :(
Title: Re: Sending events by program
Post by: clovis99 on October 04, 2016, 11:42:14
Thank you.