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

Fix resuming crafting recipe jobs after a world load #8043

Merged
merged 2 commits into from
Jul 20, 2024

Conversation

Mithi83
Copy link
Contributor

@Mithi83 Mithi83 commented Jul 18, 2024

The ItemStack type used in EncodedCraftingPattern provides no hashCode() function and is thus not usable in hashCode() functions of objects containing it.

This leads to an effect where a running job using an EncodedCraftingPattern does not resume after loading the world. Providing an explicit hashCode() function for EncodedCraftingPattern solves this problem.

Fix #8006.

@shartte
Copy link
Member

shartte commented Jul 20, 2024

Okay but why is it using the hashCode at all? 🤔

@62832
Copy link
Member

62832 commented Jul 20, 2024

Considering this is a record, isn't this already supposed to have a built-in hashCode implementation?

@shartte
Copy link
Member

shartte commented Jul 20, 2024

Considering this is a record, isn't this already supposed to have a built-in hashCode implementation?

Yes it does, but Mithi is right in that the record contains ItemStack children which do not correctly implement hashCode/equals

@shartte
Copy link
Member

shartte commented Jul 20, 2024

I checked Vanillas "BundleContents" data component, and they are also implementing a custom equals/hashCode.
But @Mithi83 I'll update your PR since I found that Vanilla has utilities for this thing.

ItemStack.listMatches
and
ItemStack.hashStackList

Mithi83 and others added 2 commits July 20, 2024 22:51
The ItemStack type used in EncodedCraftingPattern provides no
hashCode() function and is thus not usable in hashCode() functions
of objects containing it.

This leads to an effect where a running job using an
EncodedCraftingPattern does not resume after loading the world.
Providing an explicit hashCode() function for EncodedCraftingPattern
solves this problem.

Fix AppliedEnergistics#8006.
@shartte shartte merged commit 2013ac5 into AppliedEnergistics:main Jul 20, 2024
1 check passed
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.

Crafting jobs don't resume after loading a saved world
3 participants