Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use PlayerAuthInputPacket::SNEAKING flag to test for sneaking #6544

Open
wants to merge 1 commit into
base: stable
Choose a base branch
from

Conversation

Muqsit
Copy link
Member

@Muqsit Muqsit commented Nov 29, 2024

PlayerAuthInputPacket::SNEAKING flag covers the case where a player is sneaking during flight, something which START_SNEAKING & STOP_SNEAKING currently do not.

Related issues & PRs

Changes

Behavioural changes

The server now correctly recognizes players who are sneaking while flying. Players are once again able to place blocks against interactable blocks (like chests and item frames) while in this state (without triggering block interaction). When under a slab (1.5 block space), players can place blocks and must explicitly sneak (on PC, by pressing shift key) to perform the usual sneak functionality.

Tests

// Debug chat message to test whether PlayerToggleSneakEvent is triggered as expected
// (i.e., no duplicate event calls, sneak event is initiated and terminated at proper times)
$plugin->getServer()->getPluginManager()->registerEvent(PlayerToggleSneakEvent::class, function(PlayerToggleSneakEvent $event) : void{
	$event->getPlayer()->sendMessage(gmdate("Y-m-d H:i:s.v") . ": sneaking=" . ($event->isSneaking() ? "yes" : "no"));
}, EventPriority::MONITOR, $plugin);
mmAW5zY.-.Imgur.mp4
VoA1jSo.-.Imgur.mp4

this flag covers the case where a player is sneaking during flight, something which START_SNEAKING & STOP_SNEAKING do not
@Muqsit Muqsit added Category: Gameplay Related to Minecraft gameplay experience Type: Fix Bug fix, typo fix, or any other fix labels Nov 29, 2024
@Muqsit Muqsit requested a review from a team as a code owner November 29, 2024 19:36
@dktapps
Copy link
Member

dktapps commented Nov 29, 2024

I'd imagine this probably fixes #5903 too.

I wouldn't be surprised if this kind of issue shows up with the other start/stop flags. Might be worth testing.

@Muqsit
Copy link
Member Author

Muqsit commented Nov 29, 2024

I'd imagine this probably fixes #5903 too.

I wouldn't be surprised if this kind of issue shows up with the other start/stop flags. Might be worth testing.

After some discussion and testing, the issue above is also addressed by this fix. However this PR trades the sneak functionality for a visual bug where players appear standing while they are under a slab/the 1.5 block space.

@dktapps
Copy link
Member

dktapps commented Dec 1, 2024

Per internal discussion, sneaking needs to be split into "interact" sneaking (disables block interaction) vs "actual" sneaking (makes the player appear to sneak, reduces its collision box) to fully address this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Gameplay Related to Minecraft gameplay experience Type: Fix Bug fix, typo fix, or any other fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Being in the 1.5 block space is interpreted as pressing the shift key Sneaking while flying does not work
2 participants