-
-
Notifications
You must be signed in to change notification settings - Fork 194
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 ArrowLooseEvent
not firing for bows
#1189
Fix ArrowLooseEvent
not firing for bows
#1189
Conversation
|
Wouldn't ArrowShotEvent or ArrowFiredEvent be a better name for it 🤔 ArrowLoose sounds weird. Not the point of the PR ik but I thought I'd suggest a rename. |
Actually it fires for bows no matter what the item is, which may not always be an arrow. BowShotEvent or BowFiredEvent would be better |
or possibly rename it to |
See that doesn't work bc it doesn't fire for every projectile, it fires from BowItem and CrossbowItem |
oh yea, that's true |
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.
Patching the line with the instanceof ServerLevel
is incorrect. While it prevents the arrow projectile from being spawned, it does not prevent the sound effect, the increment of the statistic, and the projectile item being consumed from the inventory.
(This should have been tested by adding an always-cancelling listener, which can be mimicked by modifying the EventHooks
method to always return -1
.)
The correct place to hook would be just after the getUseDuration
call, in order to avoid those side-effects I mentioned above, and following the original patch as seen in 1.20.5.
I would assume the name was decided to be the twin for |
That event name is at least 11.5 years old; i.e. it dates back to the time when there was only a bow and a single type of arrow. So, while the Nock event is its twin, the name was chosen because it properly fit back then. |
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.
Seems to work in my testing.
You need to clean up your patches. Re-add back unnecessarily removed blank lines, avoid renaming local variables without reason, etc.
Fixes #1188
This was just a TODO left during porting to 1.20.5