Skip to content

Add getInstrument method to BlockType - #14251

Merged
Doc94 merged 8 commits into
PaperMC:mainfrom
ItzMatick:add-instrument
Oct 3, 2026
Merged

Doc94 merged 8 commits into
PaperMC:mainfrom
ItzMatick:add-instrument

Conversation

@ItzMatick

Copy link
Copy Markdown
Contributor

I added the missing getInstrument() method to the API as requested in issue #14228.

Changes:

  • Added the interface method to BlockData.
  • Added the translation logic in CraftBlockData.

@ItzMatick
ItzMatick requested a review from a team as a code owner September 13, 2026 13:59
@github-project-automation github-project-automation Bot moved this to Awaiting review in Paper PR Queue Sep 13, 2026
Comment thread paper-server/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java Outdated
@Lulu13022002

Copy link
Copy Markdown
Contributor

This only really depends on the block type so I think BlockType is a more suitable place

@ItzMatick

ItzMatick commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor Author

That’s a fair point, but I added it to BlockData because it directly mirrors Vanilla architecture (this.state.instrument()). If I move it to BlockType, I would have to pull it from default blocks.

@ItzMatick

Copy link
Copy Markdown
Contributor Author

@Lulu13022002 What do you think? Where should I put it?

@Lulu13022002

Copy link
Copy Markdown
Contributor

I think it can be on both if you really want it on BlockData, but it's fine to use the default block state (it wouldn't be the first method here). There is no need to fully mirror vanilla, the api is a bit inconsistent on where to place things here (some case using CraftBlock too).

@ItzMatick

Copy link
Copy Markdown
Contributor Author

Sure, I added it also to BlockType.

Comment thread paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBlockType.java Outdated
Comment thread paper-api/src/main/java/org/bukkit/block/data/BlockData.java Outdated
@ItzMatick

Copy link
Copy Markdown
Contributor Author

Okay, I added anotation and removed comments. Should I do something about build failure with the previous commit, or is that ok?

@Doc94

Doc94 commented Sep 18, 2026

Copy link
Copy Markdown
Member

Okay, I added anotation and removed comments. Should I do something about build failure with the previous commit, or is that ok?

I rerun the build and all looks good by the moment.

@papermc-projects papermc-projects Bot moved this from Awaiting review to Delayed approval in Paper PR Queue Sep 18, 2026
@Doc94 Doc94 changed the title Added getInstrument method to BlockData API Add getInstrument method to BlockData/BlockType Sep 18, 2026
@Lulu13022002

Copy link
Copy Markdown
Contributor

Looking into this there's a conflict with NoteBlock#getInstrument so I'm not sure about block data.

@ItzMatick

Copy link
Copy Markdown
Contributor Author

@Lulu13022002 Sorry, but what should I do about that? Rename method? Remove it from BlockData?

@Doc94

Doc94 commented Sep 21, 2026

Copy link
Copy Markdown
Member

@Lulu13022002 Sorry, but what should I do about that? Rename method? Remove it from BlockData?

Maybe just keep in the BlockType for avoid confussion... or mess with the generator for the method in the noteblock block data... but more easy the first.

@Doc94 Doc94 linked an issue Sep 23, 2026 that may be closed by this pull request
@ItzMatick

Copy link
Copy Markdown
Contributor Author

Removed it, is it ok now?

@Doc94

Doc94 commented Sep 27, 2026

Copy link
Copy Markdown
Member

Removed it, is it ok now?

For me yes, only a rebase but i can do this when can merge.

@Warriorrrr Warriorrrr added type: feature Request for a new Feature. scope: api labels Oct 2, 2026
@Doc94 Doc94 changed the title Add getInstrument method to BlockData/BlockType Add getInstrument method to BlockType Oct 3, 2026
@Doc94
Doc94 merged commit 288d43e into PaperMC:main Oct 3, 2026
8 checks passed
@Doc94

Doc94 commented Oct 3, 2026

Copy link
Copy Markdown
Member

Merged, Thanks for your first Contribution :)

WinPlay02 added a commit to WoMa-Entertainment/Icicle that referenced this pull request Oct 5, 2026
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@288d43e1 Add getInstrument method to BlockType PaperMC/Paper#14251
PaperMC/Paper@6bc56abc Add `throws CommandSyntaxException` to BasicCommand PaperMC/Paper#14339
PaperMC/Paper@a9d03827 Fix startup crash using autoEnableOnServerStart in plugin-provided datapacks PaperMC/Paper#14238
PaperMC/Paper@ddb45eb4 Fix incorrect container setChanged() called in optimized hopper patch PaperMC/Paper#14269
PaperMC/Paper@60c8e563 Force absolute positions for item frames
PaperMC/Paper@1d254ec4 Fix adding entities with api with already valid passengers PaperMC/Paper#14336
PaperMC/Paper@371c96aa Fix username duplication in chat when defaultRenderer is explicitly set PaperMC/Paper#13868
PaperMC/Paper@6e88e469 Fix possible CME race conditions for post effects PaperMC/Paper#14335
PaperMC/Paper@1a7b6265 Bump JLine to 4.4.6, drop JNI backend as Paper compiles to Java 25 PaperMC/Paper#14323
PaperMC/Paper@1dbde610 Make test block codec conditional
PaperMC/Paper@780818ff  Clear bucket empty event result when fluid placement fails PaperMC/Paper#14345
PaperMC/Paper@2de3a930 Fix silent ignore of Block#getState(boolean) parameter PaperMC/Paper#14341
PaperMC/Paper@65c408ad Don't remove player twice when disconnected during config switch PaperMC/Paper#14346
PaperMC/Paper@4728a906 Fix bundle contents corruption with item obfuscation and shelves PaperMC/Paper#14352
granny added a commit to PurpurMC/Purpur that referenced this pull request Oct 6, 2026
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@288d43e1 Add getInstrument method to BlockType PaperMC/Paper#14251
PaperMC/Paper@6bc56abc Add `throws CommandSyntaxException` to BasicCommand PaperMC/Paper#14339
PaperMC/Paper@a9d03827 Fix startup crash using autoEnableOnServerStart in plugin-provided datapacks PaperMC/Paper#14238
PaperMC/Paper@ddb45eb4 Fix incorrect container setChanged() called in optimized hopper patch PaperMC/Paper#14269
PaperMC/Paper@60c8e563 Force absolute positions for item frames
PaperMC/Paper@1d254ec4 Fix adding entities with api with already valid passengers PaperMC/Paper#14336
PaperMC/Paper@371c96aa Fix username duplication in chat when defaultRenderer is explicitly set PaperMC/Paper#13868
PaperMC/Paper@6e88e469 Fix possible CME race conditions for post effects PaperMC/Paper#14335
PaperMC/Paper@1a7b6265 Bump JLine to 4.4.6, drop JNI backend as Paper compiles to Java 25 PaperMC/Paper#14323
PaperMC/Paper@1dbde610 Make test block codec conditional
PaperMC/Paper@780818ff  Clear bucket empty event result when fluid placement fails PaperMC/Paper#14345
PaperMC/Paper@2de3a930 Fix silent ignore of Block#getState(boolean) parameter PaperMC/Paper#14341
PaperMC/Paper@65c408ad Don't remove player twice when disconnected during config switch PaperMC/Paper#14346
PaperMC/Paper@4728a906 Fix bundle contents corruption with item obfuscation and shelves PaperMC/Paper#14352
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: api type: feature Request for a new Feature.

Projects

Status: Merged

Development

Successfully merging this pull request may close these issues.

Add API method to retrieve a Block's associated Instrument

4 participants