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

Components on an ItemStack should be immutable - DerivedComponentMap #310

Open
someaddons opened this issue Sep 22, 2024 · 1 comment
Open

Comments

@someaddons
Copy link

The components on an itemstack should be immutable and should be not exchanged on the fly as you're trying to do with your wrapper. This does and will cause issues with other mods, e.g. when putting stacks into a set or other uses for the immutability.

public class DerivedComponentMap implements ComponentMap {

@BasiqueEvangelist
Copy link
Contributor

Okay?
Derived components explicitly only depend on the components the stack actually carries and the item's default components, and are only recalculated whenever Item#postProcessComponents is called by the ItemStack.
If you are talking about the fact that the DerivedComponentMap's equality and hash code depend on the derived components, that was fixed by making it just pass through to the actual default component map of the item.

I would prefer if you actually specified what the specific bug/crash is instead of saying 'you are doing this, don't do that' and vaguely pointing to some issue. (and also please test whether it still breaks with the latest version of owo-lib)

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