-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Add Shelf#getSlot using Vector #13453
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?
Conversation
Lulu13022002
left a comment
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.
Can you move the implementation to a common class like CraftSelectable or something.
PlayerInteractEvent#getClickedPosition should probably be renamed too but it can be done in another PR to not rely on a deprecated method.
Also next time don't show an image for your test code it's not convenient.
|
|
||
| @Override | ||
| public int getSlot(Vector clickVector) { | ||
| BlockFace facing = ((Directional) this.getBlockData()).getFacing(); |
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's not safe to cast the block data cause a plugin could simply change it to something else.
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.
Well i base in the other implementation... Maybe a Precondition.checkState can be good here?
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.
A precondition is better -1 has some other meaning here, i did the change for you. But from a quick look it's impossible for this method to return -1?
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.
looks like but not sure.. i prefer keep that docs xd
Okay, for the common class just move all to a new class with static methods not? |
9c2054c to
961f590
Compare
Close #13398 by adding a method for determinate the slot using a Vector, works like the same than the logic for ChiseledBookshelf
test:
javaw_2025-12-28_13-06-20.mp4