ジャンプ

From Minecraft Parkour Wiki
Revision as of 09:59, 8 May 2022 by KK kaku (talk | contribs) (Created page with "== 発動 ==")
Other languages:

Jumping is an essential mechanic that is quite self-explanatory.


発動

To start a jump, the player must have been on ground the previous tick. This is why the player is able to run off a block for 1 tick (e.g. with a headhitter timing) and still be able to jump.

When the Jump key is held, the player jumps at most once every 10 ticks (0.5s)

  • Holding jump is not optimal when going up by more than 0.75b per jump. (consequence: towering is faster when jumping manually)
  • Releasing jump resets the cooldown, making the player able to jump again on the next tick.

When a jump is initiated, the player's vertical speed is set to 0.42. On every following tick, it is decreased by 0.08 (gravity), then multiplied by 0.98 (drag).

  • When the player hits a ceiling, their vertical speed is set to 0 and they immediately start falling.
  • When the player hits the ground, their vertical speed is set to 0 and the onGround flag is set as true.

Jumping in water or lava makes the player move upward.


ジャンプの高さ

Prior to 1.9, the maximum jump height is 1.249b. It is increased in 1.9+ by ~0.003b, making the player able to jump 1.252b high.

On flat ground, a jump lasts 12 ticks (0.6s).


速度

When combined with Sprinting, jumping adds 0.2 units of acceleration towards the player's facing.

In air, the player accelerates less quickly (only 20% of the base acceleration value), but conserves more speed (91% every tick, instead of 54.6%).

Therefore, sprint-jumping is a very efficient way to build and conserve speed.


ソースコード

The following snippets of code deal with how jump is activated.
/* From EntityLivingBase.java, stripped of irrelevant code */
public void onLivingUpdate()
{
    if (this.jumpTicks > 0)
        --this.jumpTicks;
</div>

    <div lang="en" dir="ltr" class="mw-content-ltr">
if (this.isJumping)
    {
        if (this.isInWater())
            this.handleJumpWater(); //motionY += 0.04
</div>

        <div lang="en" dir="ltr" class="mw-content-ltr">
else if (this.isInLava())
            this.handleJumpLava();  //motionY += 0.04
</div>

        else if (this.onGround && this.jumpTicks == 0)
        {
                this.jump();
                this.jumpTicks = 10;
        }
    }

    <div lang="en" dir="ltr" class="mw-content-ltr">
//releasing the jump key resets the 10 tick cooldown.
    else
        this.jumpTicks = 0;
}
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
/* From EntityLivingBase.java */
protected void jump()
{
    this.motionY = 0.42; //Initial speed
</div>

    <div lang="en" dir="ltr" class="mw-content-ltr">
//apply jump boost
    if (this.isPotionActive(Potion.jump))
        this.motionY += (this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F;
</div>

    <div lang="en" dir="ltr" class="mw-content-ltr">
//apply sprintjump boost
    if (this.isSprinting())
    {
        float f = this.rotationYaw * 0.017453292F; //multiply by pi/180 to convert to radians
        this.motionX -= MathHelper.sin(f) * 0.2F;
        this.motionZ += MathHelper.cos(f) * 0.2F;
    }
}