Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BlockStateMeta#clearBlockState #10160

Conversation

Machine-Maker
Copy link
Member

Resolves #10159


An alternative would be to make BlockStateMeta#setBlockState nullable. I don't know if we want to make that change, especially since the interface is already setup so the getter is nonnull and there is a has boolean method.

@Machine-Maker Machine-Maker requested a review from a team as a code owner January 11, 2024 20:43
@tal5
Copy link
Contributor

tal5 commented Jan 11, 2024

Not sure how big of a PR do you want to make this/maybe split it up into multiple, but as mentioned in the original issue there's a few other places with a similar problem:

  • ArmorStandMeta's values are all boolean (i.e. can't be cleared)
  • AxolotlBucketMeta's variant can't be cleared
  • CompassMeta's LodestoneTracked is a boolean and will always remain in NBT, etc.

Either way thank you very much for adding this!

@electronicboy
Copy link
Member

All those 3 boil down into the fundamental flaw of ItemMeta, which is why the property API is coming to be a thing

@Machine-Maker
Copy link
Member Author

Yeah, I agree with @electronicboy here. Those point to specific properties that can be reset. The property API is the way to handle that. Other similar clear methods pertain to whole groups of data, like PotionMeta#clearCustomEffects, FireworkMeta#clearEffects, and more, all exist and I think this falls into that category.

@Machine-Maker Machine-Maker force-pushed the feature/BlockStateMeta#clearBlockState branch from 0780648 to a77fac6 Compare January 13, 2024 00:57
@Owen1212055 Owen1212055 force-pushed the feature/BlockStateMeta#clearBlockState branch from a77fac6 to e4fb1a9 Compare January 23, 2024 20:24
@Owen1212055 Owen1212055 merged commit 24dc2bf into PaperMC:master Jan 23, 2024
3 checks passed
@Machine-Maker Machine-Maker deleted the feature/BlockStateMeta#clearBlockState branch January 23, 2024 21:03
lynxplay pushed a commit to lynxplay/paper that referenced this pull request Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

ItemMeta keeping default NBT values
4 participants