Implement getSlot method for Shelf block
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 12.7k
- Forks
- 3.5k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 11
Description
Is your feature request related to a problem?
There is no convenient way to detect which shelf slot a player has interacted with.
Describe the solution you'd like.
Like ChiseledBookshelf, I assumed Shelf blocks would have a getSlot method.
I need to be able to detect when a player has clicked on a specific shelf slot, so I can know which item, if any, is already present.
For example, I use this for chiseled bookshelves:
chiseledBookshelf.getInventory().getItem(chiseledBookshelf.getSlot(event.getClickedPosition()))
The 1.21.10 update tracking issue mentioned sharing this code between these blocks but nothing has come out of that.
Describe alternatives you've considered.
Only other way would be to calculate the slot from a vector myself which I'm not sure I can do purely from the API.
Other
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Compare the linked ChiseledBookshelf.java getSlot API with the Shelf block API and its inventory or event entry points. Trace how clicked positions and shelf contents are exposed, then verify that the Shelf API provides matching slot behavior through the relevant Paper build or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100