-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Recipe book #113
Recipe book #113
Conversation
Actually, it might be better to find the index of the previous group. Something like this: //Insert better code here.
for (int i = 0; i < categories.size(); i++) {
RecipeBookCategories c = categories.get(i);
if (eventCategories.contains(c)) continue;
int realIndex = i;
if (i > 0) {
RecipeBookCategories prev = categories.get(i - 1);
int prevIndex = eventCategories.indexOf(prev);
if (prevIndex != -1) realIndex = prevIndex + 1;
}
if (realIndex >= eventCategories.size()) eventCategories.add(c);
else eventCategories.add(realIndex, c);
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested this and it works as expected. Just needs some minor style/structure changes, but otherwise it's good to go.
Hello, this PR is related to #103, but I completely changed the implementation due to a little issue.
I tested it with RBIP (Forge and Fabric) and it works correctly.
The patch is pretty simple, and I also added comments, but as a gist:
RecipeBookCategories.AGGREGATE_CATEGORIES
to vanilla values.TAIL
ofRecipeBookManager.init()
to merge any categories that may have been added by fabric mods.RecipeBookCategories.AGGREGATE_CATEGORIES
toRecipeBookManager.AGGREGATE_CATEGORIES
.This should account for most additions. Everything else works as is.