Make the fallback material the repair kit instead of a ? icon
@@ -9,12 +9,11 @@ import slimeknights.mantle.client.book.data.BookData;
import slimeknights.mantle.client.book.data.PageData;
import slimeknights.mantle.client.book.data.SectionData;
import slimeknights.mantle.client.book.data.content.PageContent;
-import slimeknights.mantle.client.book.data.element.ImageData;
import slimeknights.mantle.client.book.repository.BookRepository;
-import slimeknights.mantle.client.screen.book.element.ImageElement;
import slimeknights.mantle.client.screen.book.element.ItemElement;
import slimeknights.mantle.client.screen.book.element.SizedBookElement;
import slimeknights.mantle.recipe.RecipeHelper;
+import slimeknights.tconstruct.TConstruct;
import slimeknights.tconstruct.library.MaterialRegistry;
import slimeknights.tconstruct.library.book.content.ContentMaterial;
import slimeknights.tconstruct.library.book.content.ContentPageIconList;
@@ -22,6 +21,7 @@ import slimeknights.tconstruct.library.book.sectiontransformer.SectionTransforme
import slimeknights.tconstruct.library.materials.IMaterial;
import slimeknights.tconstruct.library.recipe.RecipeTypes;
import slimeknights.tconstruct.library.recipe.material.MaterialRecipe;
+import slimeknights.tconstruct.tools.TinkerToolParts;
import java.util.ArrayList;
import java.util.List;
@@ -66,17 +66,15 @@ public abstract class AbstractMaterialSectionTransformer extends SectionTransfor
for (MaterialRecipe recipe : recipes) {
displayStacks.addAll(recipe.getDisplayItems());
}
+ if (displayStacks.isEmpty()) {
+ TConstruct.log.debug("Material with id " + material.getIdentifier() + " has no representation items associated with it, using repair kit");
+ // bypass the valid check, because we need to show something
+ displayStacks.add(TinkerToolParts.repairKit.get().withMaterialForDisplay(material.getIdentifier()));
+ }
PageData page = this.addPage(sectionData, material.getIdentifier().toString(), ContentMaterial.ID, this.getPageContent(material, displayStacks));
- SizedBookElement icon;
- if (!displayStacks.isEmpty())
- icon = new ItemElement(0, 0, 1f, displayStacks);
- else {
- icon = new ImageElement(0, 0, 32, 32, ImageData.MISSING);
- System.out.println("Material with id " + material.getIdentifier() + " has no representation items associated with it");
- }
-
+ SizedBookElement icon = new ItemElement(0, 0, 1f, displayStacks);
while (!overview.addLink(icon, new TranslationTextComponent(material.getTranslationKey()).modifyStyle(style -> style.setColor(material.getColor())), page)) {
overview = iter.next();
}
