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

Avoid creating duplicate ResourceLocation objects for anvil enchantment recipes #3737

Open
wants to merge 1 commit into
base: 1.21.x
Choose a base branch
from

Conversation

embeddedt
Copy link
Contributor

This saves a couple more megabytes in ATM9NF.

Note: I found it strange that the UID does not include the specific enchantment and level (which would make it truly unique between the recipes). However, I opted to exploit that for further memory savings, rather than fix it to be unique, because I assume it was done this way for a reason, or has been like this for a while, and therefore no one is relying on it being unique among enchantment/level combos (only among unique input ingredients).

If the intent is for the UID to actually be unique for that exact recipe, this optimization can't be made. However, do note that on 1.20.1, the input ingredient's NBT is often stringified and used as part of the name - so this will again cause exponential growth if items with large NBT get enchanted.

@mezz
Copy link
Owner

mezz commented Sep 4, 2024

Ah unfortunately instead of an optimization opportunity, you have uncovered a bug.
If I try to bookmark the fortune recipe (top) it also treats the mending recipe (bottom) as being bookmarked because the id matches.

Screenshot 2024-09-04 at 10 40 48 AM

Screenshot 2024-09-04 at 10 41 44 AM

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