Enhance Value#of Method for Improved Item Data Retrieval (Components compatibility)#1996
Open
Gnottero wants to merge 8 commits into
Open
Enhance Value#of Method for Improved Item Data Retrieval (Components compatibility)#1996Gnottero wants to merge 8 commits into
Gnottero wants to merge 8 commits into
Conversation
ch-yx
reviewed
Sep 13, 2024
| }; | ||
| })); | ||
|
|
||
| MapValue mapValue = MapValue.wrap(Map.of(StringValue.of("components"), MapValue.wrap(lst), StringValue.of("id"), StringValue.of(stack.getItem().toString()), StringValue.of("count"), NumericValue.of(stack.getCount()))); |
Contributor
There was a problem hiding this comment.
if you pack all of those k-v pairs to a NBT tag again, why you left the switch there?
you can let Number&Boolean use the default case too.
and you no longer need to use a NBTSerializableValue to warp the res tag.
Contributor
Author
There was a problem hiding this comment.
I've changed that to your implementation, removing the part that took the item from the main hand in case of no values passed to the function. I also removed unedited files. It should be fine now, I guess
Contributor
There was a problem hiding this comment.
then you please edit your Overview, Reason and Request for Review......
ch-yx
reviewed
Sep 13, 2024
BisUmTo
approved these changes
Nov 19, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview:
This pull request introduces a new function,
item_components, which accepts an item tuple as an argument and returns a list of all components within the tuple, including default components that are typically hidden.Reason:
The primary purpose of this function is to provide access to default components, enabling users to leverage them for internal calculations, such as determining custom block breaking speeds based on the
toolcomponent.