Slime Block/ja: Difference between revisions

From Minecraft Parkour Wiki
Content added Content deleted
(Created page with "スライムブロック")
(Created page with "<syntaxhighlight lang="java"> //Entity.moveEntity()の終わりに呼び出される public void onLanded(Entity e) { if (e.isSneaking()) e.motionY = 0.0;")
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
<languages/>
<languages/>
スライムブロックは、その上に落ちるとバウンドするという特性のある特殊ブロックである。
<div lang="en" dir="ltr" class="mw-content-ltr">
A slime block is a special block which makes entities bounce when they fall on one.
</div>




== 摩擦 ==
<div lang="en" dir="ltr" class="mw-content-ltr">
== Friction ==
</div>


スライムブロックの[[Special:MyLanguage/slipperiness|slipperiness]]は0.8で、通常ブロック(0.6)と氷(0.98)の間に位置する。
<div lang="en" dir="ltr" class="mw-content-ltr">
Slime blocks have a slipperiness of 0.8, placing it between regular blocks (0.6) and ice (0.98).
</div>


それに加え、
<div lang="en" dir="ltr" class="mw-content-ltr">
On top of that,
</div>






== バウンド ==
<div lang="en" dir="ltr" class="mw-content-ltr">
== Slime Bounce ==
</div>


* スライムブロックの上に落ちると、垂直方向の速度が反転され、上方向にバウンドする。
<div lang="en" dir="ltr" class="mw-content-ltr">
* 着時地にジャンプキーを押しているとバウンドがキャンセルされ、落下ダメージを受けることなく通常通りにジャンプする。
* Falling on a slime block inverts the player's vertical speed, which causes them to bounce upward.
* 着地時にスニークを押しているとバウンドがキャンセルされ、落下ダメージを受ける。
* Holding Jump while landing cancels the bounce, and makes the player jump normally without taking fall damage.
* Holding Sneak while landing cancels the bounce, but the player takes fall damage.
</div>




Line 33: Line 21:
== ソースコード ==
== ソースコード ==


<div lang="en" dir="ltr" class="mw-content-ltr">
<syntaxhighlight lang="java">
<syntaxhighlight lang="java">
//called at the end of Entity.moveEntity()
//Entity.moveEntity()の終わりに呼び出される
public void onLanded(Entity e)
public void onLanded(Entity e)
{
{
if (e.isSneaking())
if (e.isSneaking())
e.motionY = 0.0;
e.motionY = 0.0;
</div>


else if (e.motionY < 0.0D)
else if (e.motionY < 0.0D)
Line 46: Line 32:
}
}


//Entity.moveEntity()の終わり、前述のメソッドの後に呼び出される
<div lang="en" dir="ltr" class="mw-content-ltr">
//called at the end of Entity.moveEntity(), after the previous method
public void onEntityCollidedWithBlock(Entity e)
public void onEntityCollidedWithBlock(Entity e)
{
{
Line 58: Line 43:
}
}
</syntaxhighlight>
</syntaxhighlight>
</div>

Latest revision as of 12:57, 11 May 2022

Other languages:

スライムブロックは、その上に落ちるとバウンドするという特性のある特殊ブロックである。


摩擦

スライムブロックのslipperinessは0.8で、通常ブロック(0.6)と氷(0.98)の間に位置する。

それに加え、


バウンド

  • スライムブロックの上に落ちると、垂直方向の速度が反転され、上方向にバウンドする。
  • 着時地にジャンプキーを押しているとバウンドがキャンセルされ、落下ダメージを受けることなく通常通りにジャンプする。
  • 着地時にスニークを押しているとバウンドがキャンセルされ、落下ダメージを受ける。


ソースコード

//Entity.moveEntity()の終わりに呼び出される
public void onLanded(Entity e)
{
    if (e.isSneaking())
        e.motionY = 0.0;

    else if (e.motionY < 0.0D)
        e.motionY = -e.motionY;
}

//Entity.moveEntity()の終わり、前述のメソッドの後に呼び出される
public void onEntityCollidedWithBlock(Entity e)
{
    if (Math.abs(e.motionY) < 0.1D && !e.isSneaking())
    {
        double mult = 0.4 + Math.abs(e.motionY)*0.2;
        e.motionX *= mult;
        e.motionZ *= mult;
    }
}