Posted July 14, 201510 yr Hello, i have a little question: how can i know where player wants to move on server side? I know that: -On client i can check for key binds press. -Server does not have keyboard. -Client sends packets to server about input. But: -All calls checking move key press go from MovementInputFromOptions, but this one is called only from EntityPlayerSP. ANd: -Somehow client sends to server data about movement. -In worst case i could send packets... But that's for worst case... What i'm trying to do: -In player update event check where player wants to move and modify motionX,Y,Z according to some side effects (not blocks, not entities, not tiles...). Just to know where player wants to move!!! I know everything else!!!!!!!!!!! Thanks for help! If you have any questions - just ask! Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
July 14, 201510 yr The client detects the key-pressing, and tells the server that it wants to move there. But why do you want this??
July 14, 201510 yr Author The client detects the key-pressing, and tells the server that it wants to move there. But why do you want this?? 1) I know this... -All calls checking move key press go from MovementInputFromOptions, but this one is called only from EntityPlayerSP. -Somehow client sends to server data about movement. 2) What i'm trying to do: -In player update event check where player wants to move and modify motionX,Y,Z according to some side effects (not blocks, not entities, not tiles...). Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
July 14, 201510 yr What i'm trying to do: -In player update event check where player wants to move and modify motionX,Y,Z according to some side effects (not blocks, not entities, not tiles...). Use the PlayerTickEvent , and modify the motionX/Y/Z variables in there. Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
July 14, 201510 yr Author What i'm trying to do: -In player update event check where player wants to move and modify motionX,Y,Z according to some side effects (not blocks, not entities, not tiles...). Use the PlayerTickEvent , and modify the motionX/Y/Z variables in there. I'm already doing this... I just need to know where player wants to move... This makes me sad... Op has to be rewritten... Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
July 14, 201510 yr Hi You might find this useful http://greyminecraftcoder.blogspot.com.au/2013/10/user-input.html a bit out of date; movement is now sent from EntityPlayerSP.onUpdateWalkingPlayer() to update player position, handled on NetHandlerPlayServer.processPlayer looks to me like it just updates the player position directly and doesn't store the 'which direction is player moving' anywhere. -TGG
July 14, 201510 yr Author Hi You might find this useful http://greyminecraftcoder.blogspot.com.au/2013/10/user-input.html a bit out of date; movement is now sent from EntityPlayerSP.onUpdateWalkingPlayer() to update player position, handled on NetHandlerPlayServer.processPlayer looks to me like it just updates the player position directly and doesn't store the 'which direction is player moving' anywhere. -TGG Thanks. I already understood that. So i had to do this: float fw = entity.moveForward; float st = entity.moveStrafing; boolean sneaking = entity.isSneaking(); boolean forward = fw > 0; boolean backwards = fw < 0; boolean left = st < 0; boolean right = st > 0; boolean up = false; boolean down = sneaking; Oh and also, forge has to create isJumping method in EntityLivingBase. Otherwise we have to use reflection to check if entity is jumping... Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
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.