Add API method to retrieve a Block's associated Instrument
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?
Well, a problem when creating my plugin but there is some workarounds.
Describe the solution you'd like.
Expose a method on BlockData, BlockState, or Block:
public interface BlockData {
/**
* Gets the {@link Instrument} associated with this block data,
* as used by note blocks placed above or below it.
*/
@NotNull
Instrument getInstrument();
}
public interface BlockState {
/**
* Gets the {@link Instrument} associated with this block state,
* as used by note blocks placed above or below it.
*/
@NotNull
Instrument getInstrument();
}
public interface Block {
/**
* Gets the {@link Instrument} associated with this block,
* as used by note blocks placed above or below it.
*/
@NotNull
Instrument getInstrument();
}
Describe alternatives you've considered.
Currently, there is no API to retrieve the Instrument associated with a block or block state (e.g., sand producing SNARE, wood producing BASS, or mob heads producing their respective sound).
When implementing custom block logic, note block emulators, or custom music systems, you'd either:
- Maintain an extensive, manual mapping of
Material/Tags that breaks or requires updates across Minecraft releases. - Cast to internal implementation classes (
CraftBlock) and call NMS methods (getNMS().instrument()).
Since Minecraft's BlockState natively holds an instrument() property, exposing this through the Paper API would be a clean and non-breaking solution ig.
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
Start with the BlockData, BlockState, and Block interfaces named in the request, then trace their existing implementations and the current internal instrument lookup. Confirm the API's Instrument type and representative cases such as sand, wood, and mob heads. Done means callers can retrieve the associated Instrument without manual mappings or internal casts.
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
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 70/100