diff --git a/Minecraft.Client/LocalPlayer.cpp b/Minecraft.Client/LocalPlayer.cpp index 33205b6e..3d99e0a8 100644 --- a/Minecraft.Client/LocalPlayer.cpp +++ b/Minecraft.Client/LocalPlayer.cpp @@ -252,7 +252,7 @@ void LocalPlayer::aiStep() bool forwardEnoughToContinueSprint = input->ya >= runTreshold; // 4J - altered this slightly to make sure that the joypad returns to below returnTreshold in between registering two movements up to runThreshold - if (onGround && !isSprinting() && enoughFoodToSprint && !isUsingItem() && !hasEffect(MobEffect::blindness)) + if ((onGround || isRiding()) && !isSprinting() && enoughFoodToSprint && !isUsingItem() && !hasEffect(MobEffect::blindness)) { if( !wasRunning && forwardEnoughToTriggerSprint ) { @@ -278,7 +278,7 @@ void LocalPlayer::aiStep() } if (isSneaking()) sprintTriggerTime = 0; #ifdef _WINDOWS64 - if (input->sprinting && !isSprinting() && onGround && enoughFoodToSprint && !isUsingItem() && !hasEffect(MobEffect::blindness) && !isSneaking()) + if (input->sprinting && !isSprinting() && (onGround || isRiding()) && enoughFoodToSprint && !isUsingItem() && !hasEffect(MobEffect::blindness) && !isSneaking()) { setSprinting(true); } diff --git a/Minecraft.World/Boat.cpp b/Minecraft.World/Boat.cpp index 60d0c807..23276a71 100644 --- a/Minecraft.World/Boat.cpp +++ b/Minecraft.World/Boat.cpp @@ -277,24 +277,36 @@ void Boat::tick() shared_ptr livingRider = dynamic_pointer_cast(rider.lock()); double forward = livingRider->yya; - if (forward > 0) + if (forward != 0) { double riderXd = -sin(livingRider->yRot * PI / 180); double riderZd = cos(livingRider->yRot * PI / 180); - xd += riderXd * acceleration * 0.05f; - zd += riderZd * acceleration * 0.05f; + float mult = livingRider->isSprinting() ? 2.0f : 1.0f; + float moveFactor = (float)forward; + if (forward < 0) moveFactor *= 0.5f; // Move slower backwards + xd += riderXd * acceleration * 0.05f * mult * moveFactor; + zd += riderZd * acceleration * 0.05f * mult * moveFactor; } } double curSpeed = sqrt(xd * xd + zd * zd); - - if (curSpeed > MAX_SPEED) + double maxSpeed = MAX_SPEED; + if (rider.lock() != nullptr && rider.lock()->instanceof(eTYPE_LIVINGENTITY)) { - double ratio = MAX_SPEED / curSpeed; + shared_ptr livingRider = dynamic_pointer_cast(rider.lock()); + if (livingRider->isSprinting()) + { + maxSpeed *= 1.5; + } + } + + if (curSpeed > maxSpeed) + { + double ratio = maxSpeed / curSpeed; xd *= ratio; zd *= ratio; - curSpeed = MAX_SPEED; + curSpeed = maxSpeed; } if (curSpeed > lastSpeed && acceleration < MAX_ACCELERATION) diff --git a/Minecraft.World/EntityHorse.cpp b/Minecraft.World/EntityHorse.cpp index cf5ec2c1..0c840d60 100644 --- a/Minecraft.World/EntityHorse.cpp +++ b/Minecraft.World/EntityHorse.cpp @@ -1416,7 +1416,9 @@ void EntityHorse::travel(float xa, float ya) flyingSpeed = getSpeed() * .1f; if (!level->isClientSide) { - setSpeed(static_cast(getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->getValue())); + float speed = static_cast(getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->getValue()); + if (livingRider->isSprinting()) speed *= 1.3f; + setSpeed(speed); Animal::travel(xa, ya); }