Hello everyone.
I just started creating mod with forge and i am new to it.
I saw some other post about my question but none resolved my problem.
I tried this code but also with all the other method (move , moveto , lerpMotion) but none would work:
public static int movingfunction(CommandContext<CommandSourceStack> context){
CommandSourceStack source = context.getSource();
if (!(source.getEntity() instanceof ServerPlayer)) {
return 0;
}
ServerPlayer player = (ServerPlayer ) source.getEntity();
double moveSpeed = 0.5;
for (int i =0; i<10000;i++) {
LOGGER.info("running for the {} time", i);
double x = player.getViewVector(1.0f).x * moveSpeed;
double y = player.getViewVector(1.0f).y * moveSpeed;
double z = 0;
Vec3 movementVec = new Vec3(x, y, z);
LOGGER.info("x ={} y ={} z ={}", x, y, z);
player.moveRelative(0.0F, movementVec);
;
}
player.jumpFromGround();
return 1; // Code de retour de la commande
}
when i tried the code with move function my x and y were calculated this way :
double x = player.getX() + player.getViewVector(1.0f).x * moveSpeed;
double y = player.getY() + player.getViewVector(1.0f).y * moveSpeed;
and when i would log them i could see they were increasing , but my player was still standing firmly on his spot.
I feel like the position was updated on the server but not on the client side maybe ?
thanks for your help.