Nightstag Posted January 25, 2015 Share Posted January 25, 2015 Basically, I need to access an instance of player to change motionX, motionY, etc. How would I reference the main, or the being controlled instance of Player? Quote Link to comment Share on other sites More sharing options...
Anon10W1z Posted January 25, 2015 Share Posted January 25, 2015 Where are you trying to do this? Quote Maker of the Craft++ mod. Link to comment Share on other sites More sharing options...
Nightstag Posted January 25, 2015 Author Share Posted January 25, 2015 OK, basically, I need to change the player's motionX and motionY. How do I do this? Quote Link to comment Share on other sites More sharing options...
coolAlias Posted January 25, 2015 Share Posted January 25, 2015 Basically: player.motionX = someValue; player.motionZ = someValue; It would help if you provided some context for what you are trying to do. When, exactly, do you need to change the player's motion? Quote http://i.imgur.com/NdrFdld.png[/img] Link to comment Share on other sites More sharing options...
Nightstag Posted January 26, 2015 Author Share Posted January 26, 2015 I'm trying to call it within a method: public void roll(Player player) { player.motionX = 10; } I just need to know what to put in the parameter for player when I'm referencing it. Quote Link to comment Share on other sites More sharing options...
Nightstag Posted January 26, 2015 Author Share Posted January 26, 2015 It's triggered by a keystroke in onPlayerTick. Quote Link to comment Share on other sites More sharing options...
Draco18s Posted January 26, 2015 Share Posted January 26, 2015 You need packets. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given. Link to comment Share on other sites More sharing options...
Nightstag Posted January 26, 2015 Author Share Posted January 26, 2015 You sure? I did it with onUpdate before in a class that extends Item without packets. Quote Link to comment Share on other sites More sharing options...
Nightstag Posted January 27, 2015 Author Share Posted January 27, 2015 Suppose I was running it without using keys, how would I do it? Quote Link to comment Share on other sites More sharing options...
Nightstag Posted January 27, 2015 Author Share Posted January 27, 2015 I'd use a tick handler, not sure which one, though. I would assume server, though, correct? (Of course I would use an if inside of the method) Quote Link to comment Share on other sites More sharing options...
Nightstag Posted January 27, 2015 Author Share Posted January 27, 2015 My main question is what instance of player do I refer to to change motionX and motionY. I still need to know that to finish. Quote Link to comment Share on other sites More sharing options...
Draco18s Posted January 27, 2015 Share Posted January 27, 2015 My main question is what instance of player do I refer to to change motionX and motionY. I still need to know that to finish. If you're sending packets to the server (which you should be) then the one you modify is the one that sent the packet. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given. 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.