Skip to content

Implement getSlot method for Shelf blockΒ #13398

@viveleroi

Description

@viveleroi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: acceptedDisputed bug is accepted as valid or Feature accepted as desired to be added.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions