Change the Y position of the player when they ride to it?

Started by Elastico345 on Wed, 03/07/2018 - 17:58
Last seen on 02:16, 25. Apr 2018
Joined Apr 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Change the Y position of the player when they ride to it?
Wed, 03/07/2018 - 17:58

Because If I ride to it, I'm floating above it which looks weird. So I would like to know whats the code to change the Y position of the player when they're riding to it.

 

heres the image of it.

 

Player floating on the Trike

Last seen on 15:19, 28. Mar 2018
Joined Apr 2016
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Didn't i reply to this topic…
Sat, 03/10/2018 - 14:49

Didn't i reply to this topic? for some reason im seeing that my replies get removed on multiple posts...

Last seen on 02:16, 25. Apr 2018
Joined Apr 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
yea i just realized that…
Sat, 03/10/2018 - 14:56

yea i just realized that yesterday as well

Last seen on 02:16, 25. Apr 2018
Joined Apr 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Mind saying that code again?…
Sun, 03/11/2018 - 13:55

Mind saying that code again? I'm gonna copy and paste that again on my notepad

Last seen on 15:19, 28. Mar 2018
Joined Apr 2016
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
my apologies for the late…
Tue, 03/13/2018 - 19:23

my apologies for the late reply here is the code again *NOTE paste this code after the part that makes the mob rideable:

 

public void updatePassenger(Entity passenger) {
            if (this.isPassenger(passenger)) {
                float f = MathHelper.cos(this.renderYawOffset * 0.017453292F);
                float f1 = MathHelper.sin(this.renderYawOffset * 0.017453292F);
                float f2 = 0.3F;
                passenger.setPosition(this.posX + (double) (0.3F * f1), this.posY + this.getMountedYOffset() + 2.2D + passenger.getYOffset(),
                        this.posZ - (double) (0.3F * f));
            }
        }

 

change the 2.2D to your likings.