Skip to content

Commit

Permalink
fix: fixed typo in recipe error message + Fixed book not loading when…
Browse files Browse the repository at this point in the history
… an entry has an invalid parent (#190)

* Fixed typo in recipe error message

* Added error message when entries have invalid parents
  • Loading branch information
DaFuqs authored Mar 30, 2024
1 parent a950a4a commit a089e2b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

package com.klikli_dev.modonomicon.book;

import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.*;
import com.klikli_dev.modonomicon.book.conditions.BookCondition;
import com.klikli_dev.modonomicon.book.conditions.BookNoneCondition;
import com.klikli_dev.modonomicon.book.error.BookErrorManager;
Expand Down Expand Up @@ -198,7 +197,11 @@ public void build(Level level, BookCategory category) {
var newParents = new ArrayList<BookEntryParent>();
for (var parent : this.getParents()) {
var parentEntry = this.book.getEntry(parent.getEntryId());
newParents.add(new ResolvedBookEntryParent(parent, parentEntry));
if(parentEntry == null) {
BookErrorManager.get().error("Entry \"" + this.getId() + "\" has a parent that does not exist in this book: \"" + parent.getEntryId() + "\". This parent will be ignored");
} else {
newParents.add(new ResolvedBookEntryParent(parent, parentEntry));
}
}
this.parents = newParents;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private void addMisc() {
this.add(Gui.OPEN_SEARCH, "Open Search");


this.add(Gui.RECIPE_PAGE_RECIPE_MISSING, "Recipe %s is was not found! This may be an issue with the mod, or the modpack may have disabled it.");
this.add(Gui.RECIPE_PAGE_RECIPE_MISSING, "Recipe %s was not found! This may be an issue with the mod, or the modpack may have disabled it.");

//Tooltip
this.add(Tooltips.CONDITION_ADVANCEMENT, "Requires Advancement: %s");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
"modonomicon.gui.hover.item_link_info_line2": "Will not do anything, if no recipe/usage is found.",
"modonomicon.gui.no_errors_found": "No errors found. You should not see this page!",
"modonomicon.gui.open_search": "Open Search",
"modonomicon.gui.recipe_page.recipe_missing": "Recipe %s is was not found! This may be an issue with the mod, or the modpack may have disabled it.",
"modonomicon.gui.recipe_page.recipe_missing": "Recipe %s was not found! This may be an issue with the mod, or the modpack may have disabled it.",
"modonomicon.gui.search.entry.locked": "(Locked)",
"modonomicon.gui.search.entry_list_title": "Entries",
"modonomicon.gui.search.info": "To search for entries, simply start typing what you are looking for.\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
"modonomicon.gui.hover.item_link_info_line2": "Will not do anything, if no recipe/usage is found.",
"modonomicon.gui.no_errors_found": "No errors found. You should not see this page!",
"modonomicon.gui.open_search": "Open Search",
"modonomicon.gui.recipe_page.recipe_missing": "Recipe %s is was not found! This may be an issue with the mod, or the modpack may have disabled it.",
"modonomicon.gui.recipe_page.recipe_missing": "Recipe %s was not found! This may be an issue with the mod, or the modpack may have disabled it.",
"modonomicon.gui.search.entry.locked": "(Locked)",
"modonomicon.gui.search.entry_list_title": "Entries",
"modonomicon.gui.search.info": "To search for entries, simply start typing what you are looking for.\n",
Expand Down

0 comments on commit a089e2b

Please sign in to comment.