EverythingGames Posted October 22, 2015 Share Posted October 22, 2015 I need to be able to handle mouse input from the player and was wondering what the best way for that is - using the MouseEvent works well, but I need for the code to run every tick so long as the left click / right click is down. I also tried using the ClientTickEvent to check Mouse.isButtonDown() and event.phase, but that seemed too buggy and didn't send my packet every time. I would appreciate any input on this. Quote Development of Plugins [2012 - 2014] Development of Mods [2012 - Current] Link to comment Share on other sites More sharing options...
EverythingGames Posted October 22, 2015 Author Share Posted October 22, 2015 I'm guessing this would be correct: @SubscribeEvent public void onEvent(ClientTickEvent event) { if(event.phase.equals(Phase.START)) { if(Mouse.isButtonDown(0)) { UtilityMessage.sendMessageToServer(new MessageFire()); } } } Quote Development of Plugins [2012 - 2014] Development of Mods [2012 - Current] Link to comment Share on other sites More sharing options...
Ernio Posted October 22, 2015 Share Posted October 22, 2015 Don't send packets per tick. Do it once on Press (true) and unpress (false). Store bool in IEEP. Quote 1.7.10 is no longer supported by forge, you are on your own. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.