Skip to content

Add Material#getPlacedMaterial#6680

Closed
Machine-Maker wants to merge 1 commit into
PaperMC:masterfrom
Machine-Maker:feature/get-placed-material
Closed

Add Material#getPlacedMaterial#6680
Machine-Maker wants to merge 1 commit into
PaperMC:masterfrom
Machine-Maker:feature/get-placed-material

Conversation

@Machine-Maker
Copy link
Copy Markdown
Member

No description provided.

@Machine-Maker Machine-Maker requested review from a team as code owners September 29, 2021 20:26
@imDaniX
Copy link
Copy Markdown

imDaniX commented Sep 29, 2021

Just curious - as for signs, will it return the normal one or its wall variation?

Comment thread patches/server/0809-Add-Material-getPlacedMaterial.patch
@Machine-Maker
Copy link
Copy Markdown
Member Author

Just curious - as for signs, will it return the normal one or its wall variation?

I don’t recall for sure. Most of the time, if it returns a not null value, it is itself. There are only 12 materials for which it doesn’t return itself (and is not null)

@stale
Copy link
Copy Markdown

stale Bot commented Nov 29, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@Machine-Maker Machine-Maker added status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. status: rebase required labels Dec 3, 2021
@stale stale Bot removed the resolution: stale label Dec 3, 2021
@Machine-Maker
Copy link
Copy Markdown
Member Author

Just curious - as for signs, will it return the normal one or its wall variation?

I have an answer for you, for any standing + wall variants (signs, heads, banners), its going to give you the standing one. This isn't smth that can really be addressed well until the Material enum is gone.

@Machine-Maker Machine-Maker force-pushed the feature/get-placed-material branch from 50dc85a to 0c49d93 Compare December 25, 2021 07:59
@Machine-Maker
Copy link
Copy Markdown
Member Author

Rebased for 1.18.1

@Machine-Maker
Copy link
Copy Markdown
Member Author

Rebased for 1.18.2. Adds two methods to Material, getPlacedMaterial() and getPlacedMaterial(boolean onWall). The second returns the wall mounted block if it exists for that material and onWall is true.

@Machine-Maker Machine-Maker force-pushed the feature/get-placed-material branch from 54091fa to 685adc9 Compare August 16, 2023 16:18
+ * @return the placed material or null
+ * @throws IllegalArgumentException if this is not an item
+ */
+ public @Nullable Material getPlacedMaterial(boolean onWall) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For readability's sake I think it would be nice to give this method a different name instead of a more arbitrary looking boolean parameter

Comment on lines +28 to +30
+ * For items that create blocks that could be standing or
+ * wall-mounted like skulls, torches, coral, signs, banners, etc.,
+ * this returns the standing version.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other method could be linked here

@Owen1212055
Copy link
Copy Markdown
Member

Superseded by #9607

@Machine-Maker Machine-Maker deleted the feature/get-placed-material branch April 20, 2024 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

6 participants