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

Solve inability for items with improper NBT data to be moved out of inventories #529

Merged
merged 5 commits into from
Sep 21, 2023

Conversation

Mac898
Copy link
Contributor

@Mac898 Mac898 commented Sep 20, 2023

Hi,

Objective

I was playing around with the chest example.
After adding an item with NBT data, I noticed I was unable to remove it from the chest.
Sourced the error down to this check. All I have done is not check the NBT data for now.

Same as in last comment of #292 .

Solution

Only item kind and count checked, nbt ignored.

Kind Regards,
Mac

@dyc3 dyc3 self-requested a review September 20, 2023 12:11
Copy link
Collaborator

@dyc3 dyc3 left a comment

Choose a reason for hiding this comment

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

This needs a unit test.

crates/valence_inventory/src/validate.rs Outdated Show resolved Hide resolved
@Mac898
Copy link
Contributor Author

Mac898 commented Sep 21, 2023

I've never written a unit test in rust, but I'll give it a go and try to follow the examples alrady in validate.rs :)

@Mac898
Copy link
Contributor Author

Mac898 commented Sep 21, 2023

I have verified the unit test fails on the old version, and passes after the changes.

Assuming all else is well, should be complete now.

@dyc3 dyc3 merged commit a6439e3 into valence-rs:main Sep 21, 2023
10 checks passed
@Mac898 Mac898 deleted the pr-item-movement-incorrect-nbt branch September 21, 2023 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants