PaperMC/Paper

Arrow bouncing back on entity causes it to allow pickup again

thegatesdev opened this issue · 4 comments

Expected behavior

An arrow projectile modified with the following code:

Arrow arrow;
arrow.setPickupStatus(AbstractArrow.PickupStatus.DISALLOWED);

should never allow pickup.

Observed/Actual behavior

An arrow, modified with the above code, after it 'bounces back' from an entity, is suddenly allowed to be picked up.
'Bouncing back' occurs when the entity is on damage cooldown (The video demonstrates this by damaging the entity with an arrow prior to firing other arrows that will bounce back).

Steps/models to reproduce

Code used (this video is for context, not the actual issue):

arrow.setPickupStatus(AbstractArrow.PickupStatus.CREATIVE_ONLY);
2024-06-12_21-58-29-short.mp4

Code used (the actual issue):

arrow.setPickupStatus(AbstractArrow.PickupStatus.DISALLOWED);
2024-06-12_22-01-35.mp4

Plugin and Datapack List

Plugins:

[22:21:17 INFO]: Server Plugins (1):
[22:21:17 INFO]: Bukkit Plugins:
[22:21:17 INFO]:  - CrossYourBows

Datapacks

[22:21:32 INFO]: There are 3 data pack(s) enabled: [vanilla (built-in)], [file/bukkit (world)], [paper (built-in)]
[22:21:32 INFO]: There are no more data packs available

Paper version

[22:20:24 INFO]: Checking version, please wait...
[22:20:24 INFO]: This server is running Paper version 1.20.6-138-master@906df69 (2024-06-10T06:32:15Z) (Implementing API version 1.20.6-R0.1-SNAPSHOT)
You are running the latest version

Other

The plugin named 'CrossYourBows' is the one modifying the arrow.
This is done in the EntityShootBowEvent.
In addition, the 'knockbackStrenght', 'pierceLevel', 'damage' and 'critical' properties are adjusted as well.
The plugin does not modify the arrow entity at any other time than in that specific event.

Note that (as shown in the video's) the items get returned, even in creative mode.

Thanks for looking at this, lmk if any more info is needed, I can quickly test out the setup.

This is likely causing some serious issues on our server/s as well.

24w09a is the cause of this

To expand on how a vanilla change caused this... When a projectile is deflected, it's owner is changed to the entity that it deflected off of. And for arrows, when the arrow's owner is changed to a player and the pickup status was disallowed, it's reset to allowed. I probably need some clarification on how this is a vanilla feature or not before we move to change it in some way. I created a mojira report which hopefully provides some insight.