[Tutorial]2024.4 Riding Position

Started by dkrdjdi on

Topic category: User side tutorials

Joined May 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[Tutorial]2024.4 Riding Position
Fri, 01/24/2025 - 05:15 (edited)

You can add the code to the last line of the entity code and modify the value.


@Override
protected void positionRider(Entity passenger, MoveFunction moveFunction) {
if (this.hasPassenger(passenger)) {
double offsetX = this.getX(); 
double offsetY = this.getY() + 1.0D; //Riding height Position
double offsetZ = this.getZ();
double offsetForward = -1.5D; //Front, back Position
double offsetSide = 0.0D; //Side Position

offsetX += -Math.sin(Math.toRadians(this.getYRot())) * offsetForward 
+ Math.cos(Math.toRadians(this.getYRot())) * offsetSide;
offsetZ += Math.cos(Math.toRadians(this.getYRot())) * offsetForward 
+ Math.sin(Math.toRadians(this.getYRot())) * offsetSide;

passenger.setPos(offsetX, offsetY, offsetZ);
}
}


}

Edited by dkrdjdi on Fri, 01/24/2025 - 05:15