-
Notifications
You must be signed in to change notification settings - Fork 275
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
Enhance Value#of Method for Improved Item Data Retrieval (Components compatibility) #1996
base: master
Are you sure you want to change the base?
Conversation
}; | ||
})); | ||
|
||
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()))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then you please edit your Overview, Reason and Request for Review......
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
tool
component.