-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Use book packet for both methods #13298
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
base: main
Are you sure you want to change the base?
Use book packet for both methods #13298
Conversation
item stack swap technique is dumb af and outright dangerous
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.
Thread safety is never a promise for these methods, potentially an async catcher would be useful. The current method cannot ever be made async due to the resolve logic.
This causes a behavior change, as the book item is no longer resolved, which currently openItemGui does.
Should we be resolving the book in both methods? |
|
No, only the method you are changing. |
to prevent any behaviour change
item stack swap technique is risky, what if openItemGui threw an exception? what if the author (stupidly) called openbook() async, assuming it would just send a packet (which it should), the result would be sometimes the players hand item is deleted and replaced with a book item they shouldn't have.
The only argument in favour of itemstack swap technique is that its less maintenance work than sending packet, but we are already sending packet in a virtually identical method.
#12582
PR untested ATM (Can someone test? 😄)