feat: remove sprinting

This commit is contained in:
str1k3r committed 2026-09-26 15:14:59 -04:00
1 parent 5b198d7b31
commit bdfe5350cd
14 files changed
+18 -196

No files matched your search

+5 -15
View File
@@ -435,10 +435,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
}
int y0 = 0;
// 4J-PB - no hardcore in xbox
// if (minecraft.level.getLevelData().isHardcore()) {
// y0 = 5;
// }
blit(xo, yo, 16 + bg * 9, 9 * 0, 9, 9);
if (blink)
{
@@ -513,11 +510,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
else if( minecraft->player->isSneaking() )
{
characterDisplayTimer[iPad] = 30;
}
else if( minecraft->player->isSprinting() )
{
characterDisplayTimer[iPad] = 30;
}
}
else if( minecraft->player->abilities.flying)
{
characterDisplayTimer[iPad] = 5; // quickly get rid of the player display if they stop flying
@@ -527,10 +520,9 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
--characterDisplayTimer[iPad];
}
bool displayCrouch = minecraft->player->isSneaking() || ( characterDisplayTimer[iPad] > 0 );
bool displaySprint = minecraft->player->isSprinting() || ( characterDisplayTimer[iPad] > 0 );
bool displayFlying = minecraft->player->abilities.flying || ( characterDisplayTimer[iPad] > 0 );
if( bDisplayGui && (displayCrouch || displaySprint || displayFlying) )
if( bDisplayGui && (displayCrouch || displayFlying) )
{
EntityRenderDispatcher::instance->prepare(minecraft->level, minecraft->textures, minecraft->font, minecraft->cameraTargetPlayer, minecraft->options, a);
glEnable(GL_RESCALE_NORMAL);
@@ -795,8 +787,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
#endif
lastTickA = a;
// 4J Stu - This is now displayed in a xui scene
#if 0
#if RENDER_HUD
// Jukebox CD message
if (overlayMessageTime > 0)
{
@@ -843,8 +834,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDisable(GL_ALPHA_TEST);
// 4J Stu - We have moved the chat text to a xui
#if 0
#if RENDER_HUD
glPushMatrix();
// 4J-PB we need to move this up a bit because we've moved the quick select
//glTranslatef(0, ((float)screenHeight) - 48, 0);
+7 -88
View File
@@ -60,7 +60,6 @@ LocalPlayer::LocalPlayer(Minecraft *minecraft, Level *level, User *user, int dim
flyX = flyY = flyZ = 0.0f; // 4J added
m_awardedThisSession = 0;
sprintTriggerTime = 0;
sprintTriggerRegisteredReturn = false;
twoJumpsRegistered = false;
sprintTime = 0;
@@ -218,15 +217,6 @@ bool LocalPlayer::isEffectiveAI()
void LocalPlayer::aiStep()
{
if (sprintTime > 0)
{
sprintTime--;
if (sprintTime == 0)
{
setSprinting(false);
}
}
if (sprintTriggerTime > 0) sprintTriggerTime--;
if (minecraft->gameMode->isCutScene())
{
x = z = 0.5;
@@ -283,7 +273,6 @@ void LocalPlayer::aiStep()
{
input->xa *= 0.2f;
input->ya *= 0.2f;
sprintTriggerTime = 0;
}
// this.heightOffset = input.sneaking?1.30f:1.62f; // 4J - this was already commented out
if (input->sneaking) // 4J - removed - TODO replace
@@ -296,45 +285,6 @@ void LocalPlayer::aiStep()
checkInTile(x + bbWidth * 0.35, bb->y0 + 0.5, z - bbWidth * 0.35);
checkInTile(x + bbWidth * 0.35, bb->y0 + 0.5, z + bbWidth * 0.35);
bool enoughFoodToSprint = getFoodData()->getFoodLevel() > FoodConstants::MAX_FOOD * FoodConstants::FOOD_SATURATION_LOW;
// 4J Stu - If we can fly, then we should be able to sprint without requiring food. This is particularly a problem for people who save a survival
// world with low food, then reload it in creative.
if(abilities.mayfly || isAllowedToFly() ) enoughFoodToSprint = true;
// 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( !wasRunning && input->ya >= runTreshold )
{
if (sprintTriggerTime == 0)
{
sprintTriggerTime = 7;
sprintTriggerRegisteredReturn = false;
}
else
{
if( sprintTriggerRegisteredReturn )
{
setSprinting(true);
sprintTriggerTime = 0;
sprintTriggerRegisteredReturn = false;
}
}
}
else if( ( sprintTriggerTime > 0 ) && ( input->ya == 0.0f ) ) // ya of 0.0f here signifies that we have returned to the deadzone
{
sprintTriggerRegisteredReturn = true;
}
}
if (isSneaking()) sprintTriggerTime = 0;
// 4J-PB - try not stopping sprint on collision
//if (isSprinting() && (input->ya < runTreshold || horizontalCollision || !enoughFoodToSprint))
if (isSprinting() && (input->ya < runTreshold || !enoughFoodToSprint))
{
setSprinting(false);
}
// 4J Stu - Fix for #52705 - Customer Encountered: Player can fly in bed while being in Creative mode.
if (!isSleeping() && (abilities.mayfly || isAllowedToFly() ))
{
@@ -437,33 +387,16 @@ void LocalPlayer::aiStep()
else
#endif
{
if( isSprinting() )
flyX = 0.0f;
flyY = 0.0f;
flyZ = 0.0f;
if( ullDpad_filtered & (1LL<<MINECRAFT_ACTION_DPAD_UP))
{
// Accelrate up to full speed if we are sprinting, moving in the direction of the view vector
flyX = (float)viewVector->x * input->ya;
flyY = (float)viewVector->y * input->ya;
flyZ = (float)viewVector->z * input->ya;
float scale = ((float)(SPRINT_DURATION - sprintTime))/10.0f;
scale = scale * scale;
if ( scale > 1.0f ) scale = 1.0f;
flyX *= scale;
flyY *= scale;
flyZ *= scale;
flyY = 0.1f;
}
else
if( ullDpad_filtered & (1LL<<MINECRAFT_ACTION_DPAD_DOWN))
{
flyX = 0.0f;
flyY = 0.0f;
flyZ = 0.0f;
if( ullDpad_filtered & (1LL<<MINECRAFT_ACTION_DPAD_UP))
{
flyY = 0.1f;
}
if( ullDpad_filtered & (1LL<<MINECRAFT_ACTION_DPAD_DOWN))
{
flyY = -0.1f;
}
}
}
@@ -1111,13 +1044,6 @@ bool LocalPlayer::checkInTile(double x, double y, double z)
}
void LocalPlayer::setSprinting(bool value)
{
Player::setSprinting(value);
if (value == false) sprintTime = 0;
else sprintTime = SPRINT_DURATION;
}
void LocalPlayer::setExperienceValues(float experienceProgress, int totalExp, int experienceLevel)
{
this->experienceProgress = experienceProgress;
@@ -1236,13 +1162,6 @@ bool LocalPlayer::creativeModeHandleMouseClick(int button, bool buttonPressed)
// If we're in disabled mode already (set when sprinting) then don't do anything - if we're sprinting, we don't auto-repeat at all.
// With auto repeat on, we can quickly place fires causing photosensitivity issues due to rapid flashing
if( lastClickState == lastClick_disabled ) return false;
// If we've started sprinting, go into this mode & also don't do anything
// Ignore repeate when sleeping
if( isSprinting() )
{
lastClickState = lastClick_disabled;
return false;
}
// Get distance from last click point in each axis
float dX = (float)x - lastClickX;
@@ -1360,7 +1279,7 @@ bool LocalPlayer::creativeModeHandleMouseClick(int button, bool buttonPressed)
bool itemPlaced = handleMouseClick(button);
// If we're sprinting or riding, don't auto-repeat at all. With auto repeat on, we can quickly place fires causing photosensitivity issues due to rapid flashing
// Also ignore repeats when the player is sleeping
if( isSprinting() || isRiding() || isSleeping() )
if( isRiding() || isSleeping() )
{
lastClickState = lastClick_disabled;
}
-2
View File
@@ -26,7 +26,6 @@ public:
Input *input;
protected:
Minecraft *minecraft;
int sprintTriggerTime;
bool sprintTriggerRegisteredReturn; // 4J added
bool twoJumpsRegistered; // 4J added
@@ -172,7 +171,6 @@ protected:
bool checkInTile(double x, double y, double z);
public:
void setSprinting(bool value);
void setExperienceValues(float experienceProgress, int totalExp, int experienceLevel);
bool hasPermission(EGameCommand command);
+1 -1
View File
@@ -3271,7 +3271,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
// Also disable repeat when the player is sleeping to stop the waking up right after using the bed
bool firstClick = ( player->lastClickTick[1] == 0 );
bool autoRepeat = ticks - player->lastClickTick[1] >= timer->ticksPerSecond / 4;
if ( player->isRiding() || player->isSprinting() || player->isSleeping() ) autoRepeat = false;
if ( player->isRiding() || player->isSleeping() ) autoRepeat = false;
if (InputManager.ButtonDown(iPad, MINECRAFT_ACTION_USE) )
{
// If the player has just exited a bed, then delay the time before a repeat key is allowed without releasing
@@ -25,7 +25,6 @@ MultiplayerLocalPlayer::MultiplayerLocalPlayer(Minecraft *minecraft, Level *leve
lastOnGround = false;
lastSneaked = false;
lastIdle = false;
lastSprinting = false;
positionReminder = 0;
this->connection = connection;
@@ -72,15 +71,6 @@ void MultiplayerLocalPlayer::tick()
void MultiplayerLocalPlayer::sendPosition()
{
bool sprinting = isSprinting();
if (sprinting != lastSprinting)
{
if (sprinting) connection->send(shared_ptr<PlayerCommandPacket>( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::START_SPRINTING)));
else connection->send(shared_ptr<PlayerCommandPacket>( new PlayerCommandPacket(shared_from_this(), PlayerCommandPacket::STOP_SPRINTING)));
lastSprinting = sprinting;
}
bool sneaking = isSneaking();
if (sneaking != lastSneaked)
{
@@ -27,7 +27,6 @@ private:
bool lastOnGround;
bool lastSneaked;
bool lastIdle;
bool lastSprinting;
int positionReminder;
public:
void sendPosition();
-8
View File
@@ -209,14 +209,6 @@ void OzelotModel::prepareMobModel(shared_ptr<Mob> mob, float time, float r, floa
tail2->xRot = 0.5f * PI;
state = SNEAK_STATE;
}
else if (ozelot->isSprinting())
{
tail2->y = tail1->y;
tail2->z += 2;
tail1->xRot = 0.5f * PI;
tail2->xRot = 0.5f * PI;
state = SPRINT_STATE;
}
else if (ozelot->isSitting())
{
body->xRot = 45 / (float) (180 / PI);
-8
View File
@@ -696,14 +696,6 @@ void PlayerConnection::handlePlayerCommand(shared_ptr<PlayerCommandPacket> packe
{
player->setSneaking(false);
}
else if (packet->action == PlayerCommandPacket::START_SPRINTING)
{
player->setSprinting(true);
}
else if (packet->action == PlayerCommandPacket::STOP_SPRINTING)
{
player->setSprinting(false);
}
else if (packet->action == PlayerCommandPacket::STOP_SLEEPING)
{
player->stopSleepInBed(false, true, true);
-23
View File
@@ -492,19 +492,6 @@ void Entity::baseTick()
xRotO = xRot;
yRotO = yRot;
if (isSprinting() && !isInWater() && canCreateParticles())
{
int xt = Mth::floor(x);
int yt = Mth::floor(y - 0.2f - this->heightOffset);
int zt = Mth::floor(z);
int t = level->getTile(xt, yt, zt);
int d = level->getData(xt, yt, zt);
if (t > 0)
{
level->addParticle(PARTICLE_TILECRACK(t,d), x + (random->nextFloat() - 0.5) * bbWidth, bb->y0 + 0.1, z + (random->nextFloat() - 0.5) * bbWidth, -xd * 4, 1.5, -zd * 4);
}
}
if (updateInWaterState())
{
if (!wasInWater && !firstTick && canCreateParticles())
@@ -1724,16 +1711,6 @@ void Entity::setIsIdle(bool value)
setSharedFlag(FLAG_IDLEANIM, value);
}
bool Entity::isSprinting()
{
return getSharedFlag(FLAG_SPRINTING);
}
void Entity::setSprinting(bool value)
{
setSharedFlag(FLAG_SPRINTING, value);
}
bool Entity::isInvisible()
{
return getSharedFlag(FLAG_INVISIBLE);
+4 -7
View File
@@ -126,11 +126,10 @@ private:
static const int FLAG_ONFIRE = 0;
static const int FLAG_SNEAKING = 1;
static const int FLAG_RIDING = 2;
static const int FLAG_SPRINTING = 3;
static const int FLAG_USING_ITEM = 4;
static const int FLAG_INVISIBLE = 5;
static const int FLAG_IDLEANIM = 6;
static const int FLAG_EFFECT_WEAKENED = 7; //4J ADDED, needed for cure villager tooltip.
static const int FLAG_USING_ITEM = 3;
static const int FLAG_INVISIBLE = 4;
static const int FLAG_IDLEANIM = 5;
static const int FLAG_EFFECT_WEAKENED = 6; //4J ADDED, needed for cure villager tooltip.
static const int DATA_AIR_SUPPLY_ID = 1;
private:
@@ -313,8 +312,6 @@ public:
virtual void setSneaking(bool value);
virtual bool isIdle();
virtual void setIsIdle(bool value);
virtual bool isSprinting();
virtual void setSprinting(bool value);
virtual bool isInvisible();
virtual bool isInvisibleTo(shared_ptr<Player> plr);
virtual void setInvisible(bool value);
-7
View File
@@ -1333,13 +1333,6 @@ void Mob::jumpFromGround()
{
yd += (getEffect(MobEffect::jump)->getAmplifier() + 1) * .1f;
}
if (isSprinting())
{
float rr = yRot * Mth::RAD_TO_GRAD;
xd -= Mth::sin(rr) * 0.2f;
zd += Mth::cos(rr) * 0.2f;
}
this->hasImpulse = true;
}
-4
View File
@@ -71,23 +71,19 @@ void Ozelot::serverAiMobStep()
if (speed == SNEAK_SPEED)
{
setSneaking(true);
setSprinting(false);
}
else if (speed == SPRINT_SPEED)
{
setSneaking(false);
setSprinting(true);
}
else
{
setSneaking(false);
setSprinting(false);
}
}
else
{
setSneaking(false);
setSprinting(false);
}
}
-19
View File
@@ -1012,11 +1012,6 @@ void Player::aiStep()
this->walkingSpeed = abilities.getWalkingSpeed();
this->flyingSpeed = defaultFlySpeed;
if (isSprinting())
{
walkingSpeed += abilities.getWalkingSpeed() * 0.3f;
flyingSpeed += defaultFlySpeed * 0.3f;
}
float tBob = (float) sqrt(xd * xd + zd * zd);
@@ -1583,10 +1578,6 @@ void Player::attack(shared_ptr<Entity> entity)
magicBoost = EnchantmentHelper::getDamageBonus(inventory, mob);
knockback += EnchantmentHelper::getKnockbackBonus(inventory, mob);
}
if (isSprinting())
{
knockback += 1;
}
if (dmg > 0 || magicBoost > 0)
{
@@ -1617,7 +1608,6 @@ void Player::attack(shared_ptr<Entity> entity)
entity->push(-Mth::sin(yRot * PI / 180) * knockback * .5f, 0.1, Mth::cos(yRot * PI / 180) * knockback * .5f);
xd *= 0.6;
zd *= 0.6;
setSprinting(false);
}
if (bCrit)
@@ -2033,11 +2023,6 @@ void Player::jumpFromGround()
// 4J Stu - This seems to have been missed from 1.7.3, but do we care?
//awardStat(Stats::jump, 1);
if (isSprinting())
{
causeFoodExhaustion(FoodConstants::EXHAUSTION_SPRINT_JUMP);
}
else
{
causeFoodExhaustion(FoodConstants::EXHAUSTION_JUMP);
}
@@ -2122,10 +2107,6 @@ void Player::checkMovementStatistiscs(double dx, double dy, double dz)
distanceWalk -= newDistance;
awardStat( GenericStats::walkOneM(), GenericStats::param_walk(newDistance/100) );
}
if (isSprinting())
{
causeFoodExhaustion(FoodConstants::EXHAUSTION_SPRINT * horizontalDistance * .01f);
}
else
{
causeFoodExhaustion(FoodConstants::EXHAUSTION_WALK * horizontalDistance * .01f);
+1 -3
View File
@@ -14,10 +14,9 @@ Bringing the October 10th 2014 Source Leak back down to TU0
- [ ] Adventure Mode
- [ ] Creative Mode
- [ ] Bonus Chests
- [ ] World Seeds
- [ ] Experience
- [ ] Enchanting
- [ ] Sprinting
- [x] Sprinting
- [ ] Superflat
- [ ] Brewing
@@ -30,7 +29,6 @@ Bringing the October 10th 2014 Source Leak back down to TU0
- [ ] Ravines
## Removed Dimensions
- [ ] Nether
- [ ] The End
## Removed Biomes