-
-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathBlockRecipeRemoveInput.java
More file actions
39 lines (32 loc) · 1.38 KB
/
BlockRecipeRemoveInput.java
File metadata and controls
39 lines (32 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package com.blamejared.compat.betterwithmods.base.blockrecipes;
import betterwithmods.common.registry.block.managers.CraftingManagerBlock;
import betterwithmods.common.registry.block.recipe.BlockRecipe;
import com.blamejared.mtlib.helpers.InputHelper;
import com.blamejared.mtlib.helpers.LogHelper;
import com.blamejared.mtlib.utils.BaseAction;
import crafttweaker.api.item.IItemStack;
import net.minecraft.item.ItemStack;
public class BlockRecipeRemoveInput<T extends BlockRecipe> extends BaseAction {
private final ItemStack input;
private CraftingManagerBlock<T> manager;
public BlockRecipeRemoveInput(String name, CraftingManagerBlock<T> manager, IItemStack input) {
this(name, manager, InputHelper.toStack(input));
}
private BlockRecipeRemoveInput(String name, CraftingManagerBlock<T> manager, ItemStack input) {
super(name);
this.manager = manager;
this.input = input;
}
@Override
public void apply() {
if (!manager.removeByInput(input)) {
LogHelper.logWarning(String.format("No recipes were removed for input %s", getRecipeInfo()));
} else {
LogHelper.logInfo(String.format("Successfully removed all recipes with %s as input", getRecipeInfo()));
}
}
@Override
protected String getRecipeInfo() {
return String.format("%s - %s", name, input.getDisplayName());
}
}