Skip to content

Commit d0e8a81

Browse files
committed
Add soul use recipe
1 parent 55efad9 commit d0e8a81

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

  • src/main/java/com/blamejared/compat/betterwithmods

src/main/java/com/blamejared/compat/betterwithmods/Hopper.java

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ public static void addFilterRecipe(String name, IIngredient input, IItemStack[]
4949
Lists.newArrayList(CraftTweakerMC.getItemStacks(outputs)),
5050
Lists.newArrayList(CraftTweakerMC.getItemStacks(secondary))));
5151
}
52+
53+
@ZenMethod
54+
public static void addSoulUseRecipe(String name, IIngredient input, int soulAmount, IItemStack[] outputs, IItemStack[] secondary) {
55+
ModTweaker.LATE_ADDITIONS.add(new AddSoulUseRecipe(name,
56+
CraftTweakerMC.getIngredient(input),
57+
soulAmount,
58+
Lists.newArrayList(CraftTweakerMC.getItemStacks(outputs)),
59+
Lists.newArrayList(CraftTweakerMC.getItemStacks(secondary))));
60+
}
5261

5362
@ZenMethod
5463
public static void addSoulUrnRecipe(IIngredient input, IItemStack[] outputs, IItemStack[] secondary) {
@@ -185,6 +194,38 @@ public void apply() {
185194
HopperInteractions.addHopperRecipe(new HopperInteractions.HopperRecipe(filterName,input,outputs,secondary));
186195
}
187196
}
197+
198+
public static class AddSoulUseRecipe extends BaseAction {
199+
String filterName;
200+
Ingredient input;
201+
int soulAmount;
202+
List<ItemStack> outputs;
203+
List<ItemStack> secondary;
204+
205+
public AddSoulUseRecipe(String filterName, Ingredient input, int soulAmount, List<ItemStack> outputs, List<ItemStack> secondary) {
206+
super("Filtered Hopper");
207+
this.filterName = filterName;
208+
this.input = input;
209+
this.soulAmount = soulAmount;
210+
this.outputs = outputs;
211+
this.secondary = secondary;
212+
}
213+
214+
@Override
215+
protected String getRecipeInfo() {
216+
return String.format("%s -> %s,%s in %s with %s souls",
217+
Arrays.toString(input.getMatchingStacks()),
218+
outputs.stream().map(ItemStack::getDisplayName).collect(Collectors.joining(",")),
219+
secondary.stream().map(ItemStack::getDisplayName).collect(Collectors.joining(",")),
220+
filterName,
221+
String.valueOf(soulAmount));
222+
}
223+
224+
@Override
225+
public void apply() {
226+
HopperInteractions.addHopperRecipe(new HopperInteractions.SoulUseRecipe(filterName,input,soulAmount,outputs,secondary));
227+
}
228+
}
188229

189230
public static class AddSoulUrnRecipe extends BaseAction {
190231
Ingredient input;

0 commit comments

Comments
 (0)