Skip to content

Commit

Permalink
Add soul use recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
democat3457 committed Jan 13, 2021
1 parent 55efad9 commit d0e8a81
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/main/java/com/blamejared/compat/betterwithmods/Hopper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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<ItemStack> outputs;
List<ItemStack> secondary;

public AddSoulUseRecipe(String filterName, Ingredient input, int soulAmount, List<ItemStack> outputs, List<ItemStack> 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;
Expand Down

0 comments on commit d0e8a81

Please sign in to comment.