Ceiling Hover/zh: Difference between revisions
(Created page with "对于几乎每个方块,这只是意味着将玩家的垂直速度设置为 0。") |
(Created page with "<syntaxhighlight lang="java"> →in class Block: public void onVerticalCollision(Entity entityIn) { entityIn.motionY = 0.0D; } </syntaxhighlight>") |
||
Line 20: | Line 20: | ||
对于几乎每个方块,这只是意味着将玩家的垂直速度设置为 0。 |
对于几乎每个方块,这只是意味着将玩家的垂直速度设置为 0。 |
||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
<syntaxhighlight lang="java"> |
<syntaxhighlight lang="java"> |
||
/* in class Block */ |
/* in class Block */ |
||
Line 28: | Line 27: | ||
} |
} |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
</div> |
|||
Revision as of 11:38, 26 August 2021
Ceiling Hover is a glitch that makes the player "hover" between a ceiling and a bouncy block (slime, or beds since 1.12). It can be performed by jumping under a ceiling such that the block 2.001b below the ceiling has bouncing properties.
解释
每当玩家与一个方块(地板或天花板)垂直碰撞时,游戏将应用碰撞物理。
对于几乎每个方块,这只是意味着将玩家的垂直速度设置为 0。
/* in class Block */
public void onVerticalCollision(Entity entityIn)
{
entityIn.motionY = 0.0D;
}
There is one exception: Slime Blocks (and Beds in 1.12+).
/* in class BlockSlime */
public void onVerticalCollision(Entity entityIn)
{
if (entityIn.isSneaking())
super.onVerticalCollision(entityIn);
else if (entityIn.motionY < 0.0D)
entityIn.motionY = -entityIn.motionY;
}
- If the Player is sneaking, it's treated as a regular collision (Vertical motion is set to 0)
- Otherwise, it checks if the player's speed is negative, then inverts it.
Note that nothing would happen if the player is somehow moving at a positive speed (and not sneaking).
In fact, that's exactly what happens with this glitch.
When the game detects a vertical collision, it will consider the block 0.2m under the player's position to apply collision physics (even for ceiling collisions...)
Let's review the steps for the 1.8125bc Ceiling Hover setup:
- Jumping under 1.8125bc applies vertical collision with the block 0.2m below the player (at ground level).
- If that block is a slime block, then vertical speed won't be set to 0, and the player remains suspended under the ceiling.
- Repeat step (2) until the player's vertical speed becomes negative due to gravity.
Note: This glitch happens for a few ticks, but with Jump Boost it would take longer. Ceiling hover can be interrupted at any time by sneaking.
Consequences
This glitch is pretty insignificant: it isn't game-breaking in any way, and requires very specific setups to be made use of.