[Tutorial]2024.4 Riding Position

Started by dkrdjdi on

Topic category: User side tutorials

Active 2 days ago
Joined May 2013
Points:
904

User statistics:

  • Modifications: 0
  • Forum topics: 25
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 109
[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
Active 1 month ago
Joined Feb 2025
Points:
12

User statistics:

  • Modifications: 0
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 3
hello, should it work on 1…
Sun, 02/23/2025 - 13:12

hello, should it work on 1.20.1?

 

Active 2 days ago
Joined May 2013
Points:
904

User statistics:

  • Modifications: 0
  • Forum topics: 25
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 109
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'.

Active 2 days ago
Joined May 2013
Points:
904

User statistics:

  • Modifications: 0
  • Forum topics: 25
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 109
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