wisp-forest / owo-lib

Open ωorthωhile Operations, yes the acronym was "totally accidental"
https://modrinth.com/mod/owo-lib
MIT License
188 stars 34 forks source link

Components on an ItemStack should be immutable - DerivedComponentMap #310

Open someaddons opened 1 week ago

someaddons commented 1 week ago

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.

https://github.com/wisp-forest/owo-lib/blob/5c5709f3146d721b9b9c81e0b94f55d44fc9a15c/src/main/java/io/wispforest/owo/ext/DerivedComponentMap.java#L15

BasiqueEvangelist commented 1 week ago

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)