[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
Joined May 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I don't know if it works in…
Mon, 03/10/2025 - 05:50

I don't know if it works in version 1.20.1...

Given that the symbol is not there, in version 1.20.1, you may need to use something else instead of 'Entity Passenger'.

Joined May 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
import net.minecraft.world…
Mon, 03/10/2025 - 05:52

import net.minecraft.world.entity.Entity;

Please check if this part exists in the code