-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Fix EntityShootBowEvent/ProjectileLaunchEvent consuming arrows when cancelled #9949
base: master
Are you sure you want to change the base?
Conversation
f69833b
to
76a43b6
Compare
76a43b6
to
fdb3a73
Compare
fdb3a73
to
3bbd3fc
Compare
due to mojang moving logic around the arrow itemstack will now get removed before the event is even called. easiest way to deal with this seems to just give the player the itemstack back. This pr also still fixes to desync happening with PlayerReadyBowEvent and EntityShootBowEvent EDIT: not sure if i should add an extra patch just to fix that itemstack removal so i will just leave it in this patch for now |
3bbd3fc
to
add3db6
Compare
patches/api/0108-EntityShootBowEvent-consumeArrow-and-getArrowItem-AP.patch
Show resolved
Hide resolved
Rather certain this is not going to work out nicely regarding infinitely enchantment. |
We could either add some checks regarding those enchantments (not sure about the state changes though) or we do some refactoring and remove the item after the event is called. i will take a second look at moving that removal to after the event call later |
Yea I think I may be in favour of removing item post event call. How to track that nicely is going to be a fun challenge. We also need to make sure that nothing there runs that could be affected by not removing items. Regarding removal anyway, if the diff ends up with some form of tracking wrapper around Item stack, we may also be able to remove and precisely readd. |
Problem: EntityShootBowEvent is called for Crossbows. Is that intended behaivour? If it is what are we supposed to do when the event is cancelled/consumeItem is set to false? just leaving the arrow in the crossbow would basically allow for rapid fire with consumeItem on false |
In 1.20.4, that field was simply ignored for crossbows. So it would always "consume". |
0128d2b
to
a83b1d4
Compare
not fully fix. |
How is that? |
up, broken on 1.20.6/1.21.1 |
b7697e7
to
963fbf7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems this patch introduce a new dupe for arrow. Crossbow doesn't consume the arrow when the item is used in survival but the player can still launched the projectile.
And some diff around EntityShootBowEvent#setConsumeItem deprecation has been removed during the rebase.
This issue still exists in the latest version. The build version provided by 9949 may still become invalid in some cases (which I cannot accurately explain) |
Can you try at least? Or show it via screenshots/video? |
ca2cd21
to
1ec5810
Compare
Resolved your comments lulu, now with a cuter looking entity load crossbow event impl. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Arrows with the intangible_projectile component launched in survival with a bow are not consumed.
closes #9919 (inventory desync doesn't seem to be an issue anymore since the arrow just gets consumed even when cancelled)
closes #7702 (same here)
closes #11113
closes #10665
Download the paperclip jar for this pull request: paper-9949.zip