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

Players are able to Riptide without calling PlayerRiptideEvent #11676

Open
ILikePtatoes opened this issue Nov 27, 2024 · 3 comments
Open

Players are able to Riptide without calling PlayerRiptideEvent #11676

ILikePtatoes opened this issue Nov 27, 2024 · 3 comments
Labels

Comments

@ILikePtatoes
Copy link

Expected behavior

Player riptides and swaps to another item, animation still appears and PlayerRiptideEvent is called.

Observed/Actual behavior

Player riptides and swaps to another item, no animation appears, and PlayerRiptideEvent is not called, however their character is as if they did Riptide.

Steps/models to reproduce

  1. Get riptide trident
  2. Hold right-click in water
  3. Release and swap to another item quickly

Plugin and Datapack List

N/A

Paper version

This server is running Paper version 1.21.3-65-master@7e789e8 (2024-11-26T19:11:22Z) (Implementing API version 1.21.3-R0.1-SNAPSHOT)
You are running the latest version
Previous version: 1.21.1-69-925c3b9 (MC: 1.21.1)

Other

No response

@Strokkur424
Copy link

I can reproduce this on the latest build consistently with this test code:

@EventHandler
public void onPlayerRiptide(PlayerRiptideEvent event) {
    this.getLogger().info("A player just triggered a PRE");
}

Using a riptide trident like normal, I get the following, expected output into the console:

[23:55:37 INFO]: [Paper-Test-Plugin] A player just triggered a PRE
[23:55:41 INFO]: [Paper-Test-Plugin] A player just triggered a PRE

Switching items in the same moment as releasing the right-click on the trident does propel the player, but not trigger the console log.

@Strokkur424
Copy link

Looking into this a bit deeper it seems that net.minecraft.world.entity.LivingEntity#releaseUsingItem() has its this.useItem as an empty item when switching, which causes the event to not happen server-side, yet the client probably still thinks that the trident gets used, causing a desync.

[00:12:06 INFO]: [--DebugLogger] releaseUsingItem: item.minecraft.trident
[00:12:06 INFO]: [Paper-Test-Plugin] A player just triggered a PRE
[00:12:14 INFO]: [--DebugLogger] releaseUsingItem: empty
[00:12:19 INFO]: [--DebugLogger] releaseUsingItem: empty

(The two empty releaseUsingItems is when I switched as I released)

@Strokkur424
Copy link

Seems to be related to this bug on the Mojang bug tracker: https://bugs.mojang.com/browse/MC-249911

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

2 participants