mojira.dev
MC-311727

The check for whether a player is standing on air doesn't use the player's updated position

In 26.3 snapshot 10 there was a new method added to the ServerGamePacketListenerImpl class meant to resolve ghost blocks (blocks that only exist on a client) if the server detects that a player is standing on air. This method is called from handlePlayerPositionChange() before the player as actually moved to the updated position:

boolean playerStandsOnSomething = this.player.verticalCollisionBelow;
if (isOnGround && !playerStandsOnSomething) {
    this.forceSendPlayerSupportBlocks();
}
this.player.move(MoverType.PLAYER, new Vec3(xDist, yDist, zDist));

However, the forceSendPlayerSupportBlocks() method then already treats the players position as the updated position:

private void forceSendPlayerSupportBlocks() {
    if (this.tickCount >= this.lastSupportedBlocksSend + 200) {
        this.lastSupportedBlocksSend = this.tickCount;
        LOGGER.info("Player {} standing on air - force-sending blocks below", this.player.getPlainTextName());
        AABB box = this.player.getBoundingBox();
        double justBelow = box.minY - 1.0E-5F;
        ...

So the server occasionally tries resyncing the wrong blocks and the 200 tick / 10 second cooldown makes it not trigger on the following ticks either.

I believe this should be able to be fixed by moving this.player.move(…) in handlePlayerPositionChange() in the first code snippet to right before the if (isOnGround && !playerStandsOnSomething) statement (Putting it before defining playerStandsOnSomething would be bad because this.player.verticalCollisionBelow is almost always false directly after applying movement received from player move packets).

The consequences of this are simply that the check doesn’t work properly when jumping onto blocks.

Additionally, I believe this check will also miss cases where the players scale is >= 1.667 while standing right in the middle of the ghost block since it only resyncs the blocks directly below the corners of the players hitbox.

Attachments

Comments 1

Thank you for helping us improve Minecraft! We saved your files:

[media][media]

Z0rty

slicedlime

Plausible

Platform HC

Normal

Networking

26.3 Pre-Release 2, 26.3

26.4 Snapshot 1

Retrieved