diff --git a/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/IngredientTree.java b/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/IngredientTree.java index 96a983b5..6af276d5 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/IngredientTree.java +++ b/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/IngredientTree.java @@ -33,6 +33,7 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder { private final int width; private boolean addLabels = true; + private boolean obfuscateResult; public IngredientTree(int x, int y, int width) { this.x = x + 4; @@ -45,6 +46,11 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder { return this; } + public IngredientTree obfuscateResult(boolean obfuscateResult) { + this.obfuscateResult = obfuscateResult; + return this; + } + @Override public void input(ItemStack... stacks) { if (stacks.length > 0) { @@ -96,11 +102,11 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder { int left = x + column * colWidth + 3 + (addLabels && row > 0 ? colWidth : 0); int top = y + row * rowHeight + 3; - container.addButton(new IngredientButton(left, top, colWidth, rowHeight, entry, !addLabels || ii == 0 ? "" : "+")); + container.addButton(new IngredientButton(left, top, colWidth, rowHeight, entry, !addLabels || ii == 0 ? "" : "+", false)); ii++; } result.ifPresent(result -> { - container.addButton(new IngredientButton(x + width - 17, y + totalHeight / 3 - 2, colWidth, totalHeight, result, addLabels ? "=" : "")); + container.addButton(new IngredientButton(x + width - 17, y + totalHeight / 3 - 2, colWidth, totalHeight, result, addLabels ? "=" : "", obfuscateResult)); }); return totalHeight + 7; @@ -110,13 +116,13 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder { private final IngredientTree.Entry entry; private String label; - public IngredientButton(int x, int y, int width, int height, IngredientTree.Entry entry, String label) { + public IngredientButton(int x, int y, int width, int height, IngredientTree.Entry entry, String label, boolean obfuscated) { super(x, y, width, height); this.entry = entry; this.label = label; Tooltip tooltip = entry.getTooltip(); if (tooltip != null) { - this.getStyle().setTooltip(tooltip); + this.getStyle().setTooltip(obfuscated ? Tooltip.of("???") : tooltip); } } diff --git a/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/PageElement.java b/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/PageElement.java index 9694812e..6b7a82fb 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/PageElement.java +++ b/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/PageElement.java @@ -129,11 +129,14 @@ interface PageElement extends Drawable { } MinecraftClient.getInstance().world.getRecipeManager().get(id).ifPresent(recipe -> { if (recipe instanceof SpellbookRecipe spellRecipe) { + + boolean needsMoreXp = page.getLevel() < 0 || Pony.of(MinecraftClient.getInstance().player).getLevel().get() < page.getLevel(); + IngredientTree tree = new IngredientTree( bounds().left + page().getBounds().left, bounds().top + page().getBounds().top + y + 10, page().getBounds().width - 20 - ); + ).obfuscateResult(needsMoreXp); spellRecipe.buildCraftingTree(tree); bounds.height = tree.build(container) - 10; }