Posted February 8, 201312 yr Ive been trying to make a vehicle mod, but the only way i can find of allowing the player to control motion is by using the mounted entity's motion values. What i want to achieve is for the ws keys to control forward/backward motion and for the ad keys to steer it. Is there any way of tapping in to the player's key handler so it can be used to control the car ? http://www.mcportcentral.co.za/add_images/mcportcentral-banner.jpg[/img]
February 9, 201312 yr u can check the motion, the position, create a key handler, there are a lot of methods...
February 11, 201312 yr Author u can check the motion, the position, create a key handler, there are a lot of methods... My current system uses motion, but that only gets what direction the player is trying to move, not what keys are being pressed ( i may try to separate the motion in to two vectors representing ad & ws but i recon there is an easier way to do this). Position is much the same as motion, and would be very hard to resolve back to the original keys. Finally, a key handler was my first idea for controlling motion, unfortunately, it overrides vanilla key bindings so when the player exits the car, they can no longer move. http://www.mcportcentral.co.za/add_images/mcportcentral-banner.jpg[/img]
February 11, 201312 yr Why not set it to custom controls via keybinding them? Just like BMW Car mod does it, they dont override the vannila controls, they present own control setting for users. ~I was here~
February 12, 201312 yr If you want to know when the key binding assigned to move forward/backward/etc. is pressed, you should check (client side) when FMLClientHandler.instance().getClient().gameSettings.keyBindForward.pressed is true. GameSettings holds all the vanilla keybinds, and that way you'll always know when the right key is pressed, even if the player ever changes it. Then you need to relay the info to the server, but it seems to me you already know how to do that.
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.