From d0e8a8119789a8274c905962e8ed2410ed101c00 Mon Sep 17 00:00:00 2001 From: Colin Wong Date: Thu, 9 Jul 2020 19:37:19 -0500 Subject: [PATCH] Add soul use recipe --- .../compat/betterwithmods/Hopper.java | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/main/java/com/blamejared/compat/betterwithmods/Hopper.java b/src/main/java/com/blamejared/compat/betterwithmods/Hopper.java index fa1c2df6..530608ca 100644 --- a/src/main/java/com/blamejared/compat/betterwithmods/Hopper.java +++ b/src/main/java/com/blamejared/compat/betterwithmods/Hopper.java @@ -49,6 +49,15 @@ public static void addFilterRecipe(String name, IIngredient input, IItemStack[] Lists.newArrayList(CraftTweakerMC.getItemStacks(outputs)), Lists.newArrayList(CraftTweakerMC.getItemStacks(secondary)))); } + + @ZenMethod + public static void addSoulUseRecipe(String name, IIngredient input, int soulAmount, IItemStack[] outputs, IItemStack[] secondary) { + ModTweaker.LATE_ADDITIONS.add(new AddSoulUseRecipe(name, + CraftTweakerMC.getIngredient(input), + soulAmount, + Lists.newArrayList(CraftTweakerMC.getItemStacks(outputs)), + Lists.newArrayList(CraftTweakerMC.getItemStacks(secondary)))); + } @ZenMethod public static void addSoulUrnRecipe(IIngredient input, IItemStack[] outputs, IItemStack[] secondary) { @@ -185,6 +194,38 @@ public void apply() { HopperInteractions.addHopperRecipe(new HopperInteractions.HopperRecipe(filterName,input,outputs,secondary)); } } + + public static class AddSoulUseRecipe extends BaseAction { + String filterName; + Ingredient input; + int soulAmount; + List outputs; + List secondary; + + public AddSoulUseRecipe(String filterName, Ingredient input, int soulAmount, List outputs, List secondary) { + super("Filtered Hopper"); + this.filterName = filterName; + this.input = input; + this.soulAmount = soulAmount; + this.outputs = outputs; + this.secondary = secondary; + } + + @Override + protected String getRecipeInfo() { + return String.format("%s -> %s,%s in %s with %s souls", + Arrays.toString(input.getMatchingStacks()), + outputs.stream().map(ItemStack::getDisplayName).collect(Collectors.joining(",")), + secondary.stream().map(ItemStack::getDisplayName).collect(Collectors.joining(",")), + filterName, + String.valueOf(soulAmount)); + } + + @Override + public void apply() { + HopperInteractions.addHopperRecipe(new HopperInteractions.SoulUseRecipe(filterName,input,soulAmount,outputs,secondary)); + } + } public static class AddSoulUrnRecipe extends BaseAction { Ingredient input;