Skip to content

Commit

Permalink
fix: player controlled dragon walking speed
Browse files Browse the repository at this point in the history
  • Loading branch information
SiverDX authored and TheBv committed Dec 27, 2023
1 parent b0d66f4 commit 4444cf2
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2070,7 +2070,7 @@ public void travel(@NotNull Vec3 pTravelVector) {
// Note: when motion is handled by the client no server side setDeltaMovement() should be called
// otherwise the movement will halt
// Todo: move wrongly fix
float flyingSpeed;
float flyingSpeed; // FIXME :: Why overlay the flyingSpeed variable from LivingEntity
if (allowLocalMotionControl && this.getControllingPassenger() != null) {
LivingEntity rider = this.getControllingPassenger();
if (rider == null) {
Expand Down Expand Up @@ -2204,7 +2204,7 @@ else if (isInWater() || isInLava()) {
// Walking control
else {
double forward = rider.zza;
double strafing = rider.xxa;
double strafing = rider.xxa * 0.5f;
// Inherit y motion for dropping
double vertical = pTravelVector.y;
float speed = (float) this.getAttributeValue(Attributes.MOVEMENT_SPEED);
Expand All @@ -2217,21 +2217,16 @@ else if (isInWater() || isInLava()) {
forward *= rider.isSprinting() ? 1.2f : 1.0f;
// Slower going back
forward *= rider.zza > 0 ? 1.0f : 0.2f;
// Slower going sideway
strafing *= 0.05f;

if (this.isControlledByLocalInstance()) {
flyingSpeed = speed * 0.1F;
this.setSpeed(flyingSpeed);

this.setSpeed(speed);
// Vanilla walking behavior includes going up steps
super.travel(new Vec3(strafing, vertical, forward));
} else {
this.setDeltaMovement(Vec3.ZERO);
}
this.tryCheckInsideBlocks();
this.updatePitch(this.yOld - this.getY());
return;
}
}
// No rider move control
Expand Down

0 comments on commit 4444cf2

Please sign in to comment.