Render the duplicating recipe to the ingredient tree

This commit is contained in:
Sollace 2022-09-11 19:25:34 +02:00
parent 53775ce34b
commit 8f7fa1ae7e
2 changed files with 9 additions and 2 deletions

View file

@ -1,6 +1,7 @@
package com.minelittlepony.unicopia.ability.magic.spell.crafting; package com.minelittlepony.unicopia.ability.magic.spell.crafting;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.minelittlepony.unicopia.ability.magic.spell.effect.SpellType;
import com.minelittlepony.unicopia.container.SpellbookScreenHandler.SpellbookInventory; import com.minelittlepony.unicopia.container.SpellbookScreenHandler.SpellbookInventory;
import com.minelittlepony.unicopia.item.*; import com.minelittlepony.unicopia.item.*;
import com.minelittlepony.unicopia.util.InventoryUtil; import com.minelittlepony.unicopia.util.InventoryUtil;
@ -26,7 +27,13 @@ public class SpellDuplicatingRecipe implements SpellbookRecipe {
@Override @Override
public void buildCraftingTree(CraftingTreeBuilder builder) { public void buildCraftingTree(CraftingTreeBuilder builder) {
ItemStack[] spells = SpellType.REGISTRY.stream()
.filter(SpellType::isObtainable)
.map(type -> GemstoneItem.enchant(UItems.GEMSTONE.getDefaultStack(), type))
.toArray(ItemStack[]::new);
builder.input(UItems.BOTCHED_GEM.getDefaultStack());
builder.input(spells);
builder.result(spells);
} }
@Override @Override

View file

@ -173,7 +173,7 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder {
public void render(MatrixStack matrices, int x, int y, float tickDelta) { public void render(MatrixStack matrices, int x, int y, float tickDelta) {
y -= 2; y -= 2;
if (ticker++ % 500 == 0) { if (ticker++ % 30 == 0) {
index = (index + 1) % stacks.length; index = (index + 1) % stacks.length;
} }