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 95802b8 commit 3c6ca7c
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 @@ -48,6 +48,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 @@ -184,6 +193,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 3c6ca7c

Please sign in to comment.