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

Document ItemStack returning functions #18

Open
appgurueu opened this issue Jan 4, 2022 · 1 comment
Open

Document ItemStack returning functions #18

appgurueu opened this issue Jan 4, 2022 · 1 comment

Comments

@appgurueu
Copy link
Contributor

on_use etc. Include a note that prevents people from making the common mistake of trying to modify the inventory before/instead of returning the itemstack they want to be set.

@appgurueu
Copy link
Contributor Author

The confusion here is likely to stem from the fact that ItemStack is a mutable reference type, yet all functions & callbacks using ItemStacks pass them "by value", copying them (constrast this with e.g. vectors which are mutable but only provide methods that return copies, thus making it apparent that you have to feed the vector back in using some setter). I wonder whether such a note would suit the ItemStack doc well?

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

No branches or pull requests

2 participants