Merge branch 'pieeebot:main' into upstream-merge

This commit is contained in:
George V. 2026-04-14 19:32:01 +03:00 committed by GitHub
commit 8bfebcabf4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 10 deletions

View file

@ -252,7 +252,7 @@ void LocalPlayer::aiStep()
bool forwardEnoughToContinueSprint = input->ya >= runTreshold; 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 // 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 ) if( !wasRunning && forwardEnoughToTriggerSprint )
{ {
@ -278,7 +278,7 @@ void LocalPlayer::aiStep()
} }
if (isSneaking()) sprintTriggerTime = 0; if (isSneaking()) sprintTriggerTime = 0;
#ifdef _WINDOWS64 #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); setSprinting(true);
} }

View file

@ -277,24 +277,36 @@ void Boat::tick()
shared_ptr<LivingEntity> livingRider = dynamic_pointer_cast<LivingEntity>(rider.lock()); shared_ptr<LivingEntity> livingRider = dynamic_pointer_cast<LivingEntity>(rider.lock());
double forward = livingRider->yya; double forward = livingRider->yya;
if (forward > 0) if (forward != 0)
{ {
double riderXd = -sin(livingRider->yRot * PI / 180); double riderXd = -sin(livingRider->yRot * PI / 180);
double riderZd = cos(livingRider->yRot * PI / 180); double riderZd = cos(livingRider->yRot * PI / 180);
xd += riderXd * acceleration * 0.05f; float mult = livingRider->isSprinting() ? 2.0f : 1.0f;
zd += riderZd * acceleration * 0.05f; 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); double curSpeed = sqrt(xd * xd + zd * zd);
double maxSpeed = MAX_SPEED;
if (curSpeed > MAX_SPEED) if (rider.lock() != nullptr && rider.lock()->instanceof(eTYPE_LIVINGENTITY))
{ {
double ratio = MAX_SPEED / curSpeed; shared_ptr<LivingEntity> livingRider = dynamic_pointer_cast<LivingEntity>(rider.lock());
if (livingRider->isSprinting())
{
maxSpeed *= 1.5;
}
}
if (curSpeed > maxSpeed)
{
double ratio = maxSpeed / curSpeed;
xd *= ratio; xd *= ratio;
zd *= ratio; zd *= ratio;
curSpeed = MAX_SPEED; curSpeed = maxSpeed;
} }
if (curSpeed > lastSpeed && acceleration < MAX_ACCELERATION) if (curSpeed > lastSpeed && acceleration < MAX_ACCELERATION)

View file

@ -1416,7 +1416,9 @@ void EntityHorse::travel(float xa, float ya)
flyingSpeed = getSpeed() * .1f; flyingSpeed = getSpeed() * .1f;
if (!level->isClientSide) if (!level->isClientSide)
{ {
setSpeed(static_cast<float>(getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->getValue())); float speed = static_cast<float>(getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->getValue());
if (livingRider->isSprinting()) speed *= 1.3f;
setSpeed(speed);
Animal::travel(xa, ya); Animal::travel(xa, ya);
} }