[Not Pressing But Still Could Use] Trying to Launch the Player With setVelocity Code

Started by rmsandegs on Sat, 11/02/2019 - 20:07

Topic category: Advanced modding

Last seen on 03:21, 6. Dec 2019
Joined May 2014
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
[Not Pressing But Still Could Use] Trying to Launch the Player With setVelocity Code
Fri, 11/08/2019 - 02:06 (edited)

In my mod I have a pair of wings you can craft and put in your inventory. By pressing the 'C' key, you can "flap" with the wings and they send you into the air. The item and the keybind work fine, but it's the procedure of launching the player into the air that I'm having problems with.

I modified the procedure to use "addVelocity" to accomplish this. It worked in MCreator 1.9.0 but is mysteriously broken in 1.9.1. I've looked online for a very long time but haven't come to anything that's worked so far.

The strange part is that the rest of the modified procedure works perfectly. It plays an Ender Dragon wing flap sound and creates some flame particles. That all works. It's only the addVelocity part.

The problem line of code is this: 

entity.addVelocity(entity.getLookVec().x, 1.2 + (entity.motionY * -1), entity.getLookVec().z);

where "entity" is referring to the player and getLookVec is used to launch the player in the 'x' and 'z' direction they're looking in.

This is the only place I know to post stuff like this, but if you don't focus on custom code I entirely get it. Thank you for your time nonetheless.

Edited by rmsandegs on Fri, 11/08/2019 - 02:06