diff --git a/common/src/main/java/dev/latvian/mods/kubejs/recipe/RecipeJS.java b/common/src/main/java/dev/latvian/mods/kubejs/recipe/RecipeJS.java index 0e0c1260b..9a790f7d4 100644 --- a/common/src/main/java/dev/latvian/mods/kubejs/recipe/RecipeJS.java +++ b/common/src/main/java/dev/latvian/mods/kubejs/recipe/RecipeJS.java @@ -16,6 +16,7 @@ import dev.latvian.mods.kubejs.recipe.component.MissingComponentException; import dev.latvian.mods.kubejs.recipe.component.RecipeComponentBuilderMap; import dev.latvian.mods.kubejs.recipe.component.RecipeComponentValue; +import dev.latvian.mods.kubejs.recipe.ingredientaction.ConsumeAction; import dev.latvian.mods.kubejs.recipe.ingredientaction.CustomIngredientAction; import dev.latvian.mods.kubejs.recipe.ingredientaction.DamageAction; import dev.latvian.mods.kubejs.recipe.ingredientaction.IngredientAction; @@ -589,6 +590,10 @@ public final RecipeJS keepIngredient(IngredientActionFilter filter) { return ingredientAction(filter, new KeepAction()); } + public final RecipeJS consumeIngredient(IngredientActionFilter filter) { + return ingredientAction(filter, new ConsumeAction()); + } + public final RecipeJS modifyResult(ModifyRecipeResultCallback callback) { modifyResult = callback; save(); diff --git a/common/src/main/java/dev/latvian/mods/kubejs/recipe/ingredientaction/ConsumeAction.java b/common/src/main/java/dev/latvian/mods/kubejs/recipe/ingredientaction/ConsumeAction.java new file mode 100644 index 000000000..807b92c1a --- /dev/null +++ b/common/src/main/java/dev/latvian/mods/kubejs/recipe/ingredientaction/ConsumeAction.java @@ -0,0 +1,16 @@ +package dev.latvian.mods.kubejs.recipe.ingredientaction; + +import net.minecraft.world.inventory.CraftingContainer; +import net.minecraft.world.item.ItemStack; + +public class ConsumeAction extends IngredientAction { + @Override + public ItemStack transform(ItemStack old, int index, CraftingContainer container) { + return ItemStack.EMPTY; + } + + @Override + public String getType() { + return "consume"; + } +} diff --git a/common/src/main/java/dev/latvian/mods/kubejs/recipe/ingredientaction/IngredientAction.java b/common/src/main/java/dev/latvian/mods/kubejs/recipe/ingredientaction/IngredientAction.java index 6153374aa..98795c17e 100644 --- a/common/src/main/java/dev/latvian/mods/kubejs/recipe/ingredientaction/IngredientAction.java +++ b/common/src/main/java/dev/latvian/mods/kubejs/recipe/ingredientaction/IngredientAction.java @@ -27,6 +27,7 @@ public abstract class IngredientAction extends IngredientActionFilter { FACTORY_MAP.put("damage", json -> new DamageAction(json.get("damage").getAsInt())); FACTORY_MAP.put("replace", json -> new ReplaceAction(ItemStackJS.resultFromRecipeJson(json.get("item")))); FACTORY_MAP.put("keep", json -> new KeepAction()); + FACTORY_MAP.put("consume", json -> new ConsumeAction()); } public static List parseList(JsonElement json) {