mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-25 14:24:35 +00:00
Add support for adding recipes via Compound Ingredients/OreDict
Note: This just automatically adds all the entries for now, rather than requiring you to loop over it yourself.
This commit is contained in:
16 files changed
+206
-112
No files matched your search
+2
-1
@@ -3,6 +3,7 @@ package mekanism.common.integration.crafttweaker.handlers;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.minecraft.CraftTweakerMC;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.gas.IGasStack;
|
||||
@@ -29,7 +30,7 @@ public class ChemicalCrystallizer {
|
||||
if (IngredientHelper.checkNotNull(NAME, gasInput, itemOutput)) {
|
||||
CrafttweakerIntegration.LATE_ADDITIONS
|
||||
.add(new AddMekanismRecipe<>(NAME, Recipe.CHEMICAL_CRYSTALLIZER,
|
||||
new CrystallizerRecipe(GasHelper.toGas(gasInput), IngredientHelper.toStack(itemOutput))));
|
||||
new CrystallizerRecipe(GasHelper.toGas(gasInput), CraftTweakerMC.getItemStack(itemOutput))));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+13
-5
@@ -2,7 +2,10 @@ package mekanism.common.integration.crafttweaker.handlers;
|
||||
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.minecraft.CraftTweakerMC;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.gas.IGasStack;
|
||||
@@ -14,6 +17,7 @@ import mekanism.common.integration.crafttweaker.util.RemoveAllMekanismRecipe;
|
||||
import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe;
|
||||
import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||
import mekanism.common.recipe.machines.DissolutionRecipe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
@@ -25,11 +29,15 @@ public class ChemicalDissolution {
|
||||
public static final String NAME = Mekanism.MOD_NAME + " Chemical Dissolution Chamber";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack itemInput, IGasStack gasOutput) {
|
||||
if (IngredientHelper.checkNotNull(NAME, itemInput, gasOutput)) {
|
||||
public static void addRecipe(IIngredient ingredientInput, IGasStack gasOutput) {
|
||||
if (IngredientHelper.checkNotNull(NAME, ingredientInput, gasOutput)) {
|
||||
GasStack output = GasHelper.toGas(gasOutput);
|
||||
List<DissolutionRecipe> recipes = new ArrayList<>();
|
||||
for (ItemStack stack : CraftTweakerMC.getIngredient(ingredientInput).getMatchingStacks()) {
|
||||
recipes.add(new DissolutionRecipe(stack, output));
|
||||
}
|
||||
CrafttweakerIntegration.LATE_ADDITIONS
|
||||
.add(new AddMekanismRecipe<>(NAME, Recipe.CHEMICAL_DISSOLUTION_CHAMBER,
|
||||
new DissolutionRecipe(IngredientHelper.toStack(itemInput), GasHelper.toGas(gasOutput))));
|
||||
.add(new AddMekanismRecipe<>(NAME, Recipe.CHEMICAL_DISSOLUTION_CHAMBER, recipes));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+14
-6
@@ -3,6 +3,10 @@ package mekanism.common.integration.crafttweaker.handlers;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.minecraft.CraftTweakerMC;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.gas.IGasStack;
|
||||
@@ -16,6 +20,7 @@ import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||
import mekanism.common.recipe.inputs.AdvancedMachineInput;
|
||||
import mekanism.common.recipe.machines.InjectionRecipe;
|
||||
import mekanism.common.recipe.outputs.ItemStackOutput;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
@@ -27,13 +32,16 @@ public class ChemicalInjection {
|
||||
public static final String NAME = Mekanism.MOD_NAME + " Chemical Injection Chamber";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack itemInput, IGasStack gasInput, IItemStack itemOutput) {
|
||||
if (IngredientHelper.checkNotNull(NAME, itemInput, gasInput, itemOutput)) {
|
||||
public static void addRecipe(IIngredient ingredientInput, IGasStack gasInput, IItemStack itemOutput) {
|
||||
if (IngredientHelper.checkNotNull(NAME, ingredientInput, gasInput, itemOutput)) {
|
||||
ItemStackOutput output = new ItemStackOutput(CraftTweakerMC.getItemStack(itemOutput));
|
||||
Gas gas = GasHelper.toGas(gasInput).getGas();
|
||||
List<InjectionRecipe> recipes = new ArrayList<>();
|
||||
for (ItemStack stack : CraftTweakerMC.getIngredient(ingredientInput).getMatchingStacks()) {
|
||||
recipes.add(new InjectionRecipe(new AdvancedMachineInput(stack, gas), output));
|
||||
}
|
||||
CrafttweakerIntegration.LATE_ADDITIONS
|
||||
.add(new AddMekanismRecipe<>(NAME, Recipe.CHEMICAL_INJECTION_CHAMBER,
|
||||
new InjectionRecipe(new AdvancedMachineInput(IngredientHelper.toStack(itemInput),
|
||||
GasHelper.toGas(gasInput).getGas()),
|
||||
new ItemStackOutput(IngredientHelper.toStack(itemOutput)))));
|
||||
.add(new AddMekanismRecipe<>(NAME, Recipe.CHEMICAL_INJECTION_CHAMBER, recipes));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+13
-5
@@ -2,7 +2,10 @@ package mekanism.common.integration.crafttweaker.handlers;
|
||||
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.minecraft.CraftTweakerMC;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.gas.IGasStack;
|
||||
@@ -14,6 +17,7 @@ import mekanism.common.integration.crafttweaker.util.RemoveAllMekanismRecipe;
|
||||
import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe;
|
||||
import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||
import mekanism.common.recipe.machines.OxidationRecipe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
@@ -25,11 +29,15 @@ public class ChemicalOxidizer {
|
||||
public static final String NAME = Mekanism.MOD_NAME + " Chemical Oxidizer";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack itemInput, IGasStack gasOutput) {
|
||||
if (IngredientHelper.checkNotNull(NAME, itemInput, gasOutput)) {
|
||||
public static void addRecipe(IIngredient ingredientInput, IGasStack gasOutput) {
|
||||
if (IngredientHelper.checkNotNull(NAME, ingredientInput, gasOutput)) {
|
||||
GasStack output = GasHelper.toGas(gasOutput);
|
||||
List<OxidationRecipe> recipes = new ArrayList<>();
|
||||
for (ItemStack stack : CraftTweakerMC.getIngredient(ingredientInput).getMatchingStacks()) {
|
||||
recipes.add(new OxidationRecipe(stack, output));
|
||||
}
|
||||
CrafttweakerIntegration.LATE_ADDITIONS
|
||||
.add(new AddMekanismRecipe<>(NAME, Recipe.CHEMICAL_OXIDIZER,
|
||||
new OxidationRecipe(IngredientHelper.toStack(itemInput), GasHelper.toGas(gasOutput))));
|
||||
.add(new AddMekanismRecipe<>(NAME, Recipe.CHEMICAL_OXIDIZER, recipes));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@ package mekanism.common.integration.crafttweaker.handlers;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.minecraft.CraftTweakerMC;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.helpers.IngredientHelper;
|
||||
@@ -14,6 +17,7 @@ import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||
import mekanism.common.recipe.inputs.DoubleMachineInput;
|
||||
import mekanism.common.recipe.machines.CombinerRecipe;
|
||||
import mekanism.common.recipe.outputs.ItemStackOutput;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
@@ -25,26 +29,34 @@ public class Combiner {
|
||||
public static final String NAME = Mekanism.MOD_NAME + " Combiner";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack itemInput, IItemStack extraInput, IItemStack itemOutput) {
|
||||
if (IngredientHelper.checkNotNull(NAME, itemInput, extraInput, itemOutput)) {
|
||||
CrafttweakerIntegration.LATE_ADDITIONS
|
||||
.add(new AddMekanismRecipe<>(NAME, Recipe.COMBINER, new CombinerRecipe(
|
||||
new DoubleMachineInput(IngredientHelper.toStack(itemInput),
|
||||
IngredientHelper.toStack(extraInput)),
|
||||
new ItemStackOutput(IngredientHelper.toStack(itemOutput)))));
|
||||
public static void addRecipe(IIngredient ingredientInput, IIngredient ingredientExtra, IItemStack itemOutput) {
|
||||
if (IngredientHelper.checkNotNull(NAME, ingredientInput, ingredientExtra, itemOutput)) {
|
||||
ItemStackOutput output = new ItemStackOutput(CraftTweakerMC.getItemStack(itemOutput));
|
||||
List<CombinerRecipe> recipes = new ArrayList<>();
|
||||
ItemStack[] extraInputs = CraftTweakerMC.getIngredient(ingredientExtra).getMatchingStacks();
|
||||
for (ItemStack stack : CraftTweakerMC.getIngredient(ingredientInput).getMatchingStacks()) {
|
||||
for (ItemStack extra : extraInputs) {
|
||||
recipes.add(new CombinerRecipe(new DoubleMachineInput(stack, extra), output));
|
||||
}
|
||||
}
|
||||
CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe<>(NAME, Recipe.COMBINER, recipes));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Replaced by {@link #addRecipe(IItemStack, IItemStack, IItemStack)}. May be removed with Minecraft
|
||||
* @deprecated Replaced by {@link #addRecipe(IIngredient, IIngredient, IItemStack)}. May be removed with Minecraft
|
||||
* 1.13.
|
||||
*/
|
||||
@ZenMethod
|
||||
@Deprecated
|
||||
public static void addRecipe(IItemStack itemInput, IItemStack itemOutput) {
|
||||
if (IngredientHelper.checkNotNull(NAME, itemInput, itemOutput)) {
|
||||
CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe<>(NAME, Recipe.COMBINER,
|
||||
new CombinerRecipe(IngredientHelper.toStack(itemInput), IngredientHelper.toStack(itemOutput))));
|
||||
public static void addRecipe(IIngredient ingredientInput, IItemStack itemOutput) {
|
||||
if (IngredientHelper.checkNotNull(NAME, ingredientInput, itemOutput)) {
|
||||
ItemStack output = CraftTweakerMC.getItemStack(itemOutput);
|
||||
List<CombinerRecipe> recipes = new ArrayList<>();
|
||||
for (ItemStack stack : CraftTweakerMC.getIngredient(ingredientInput).getMatchingStacks()) {
|
||||
recipes.add(new CombinerRecipe(stack, output));
|
||||
}
|
||||
CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe<>(NAME, Recipe.COMBINER, recipes));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,10 @@ package mekanism.common.integration.crafttweaker.handlers;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.minecraft.CraftTweakerMC;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.gas.IGasStack;
|
||||
@@ -16,6 +20,7 @@ import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||
import mekanism.common.recipe.inputs.AdvancedMachineInput;
|
||||
import mekanism.common.recipe.machines.OsmiumCompressorRecipe;
|
||||
import mekanism.common.recipe.outputs.ItemStackOutput;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
@@ -27,23 +32,29 @@ public class Compressor {
|
||||
public static final String NAME = Mekanism.MOD_NAME + " Compressor";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack itemInput, IItemStack itemOutput) {
|
||||
if (IngredientHelper.checkNotNull(NAME, itemInput, itemOutput)) {
|
||||
public static void addRecipe(IIngredient ingredientInput, IItemStack itemOutput) {
|
||||
if (IngredientHelper.checkNotNull(NAME, ingredientInput, itemOutput)) {
|
||||
ItemStack output = CraftTweakerMC.getItemStack(itemOutput);
|
||||
List<OsmiumCompressorRecipe> recipes = new ArrayList<>();
|
||||
for (ItemStack stack : CraftTweakerMC.getIngredient(ingredientInput).getMatchingStacks()) {
|
||||
recipes.add(new OsmiumCompressorRecipe(stack, output));
|
||||
}
|
||||
CrafttweakerIntegration.LATE_ADDITIONS
|
||||
.add(new AddMekanismRecipe<>(NAME, Recipe.OSMIUM_COMPRESSOR,
|
||||
new OsmiumCompressorRecipe(IngredientHelper.toStack(itemInput),
|
||||
IngredientHelper.toStack(itemOutput))));
|
||||
.add(new AddMekanismRecipe<>(NAME, Recipe.OSMIUM_COMPRESSOR, recipes));
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack itemInput, IGasStack gasInput, IItemStack itemOutput) {
|
||||
if (IngredientHelper.checkNotNull(NAME, itemInput, gasInput, itemOutput)) {
|
||||
public static void addRecipe(IIngredient ingredientInput, IGasStack gasInput, IItemStack itemOutput) {
|
||||
if (IngredientHelper.checkNotNull(NAME, ingredientInput, gasInput, itemOutput)) {
|
||||
ItemStackOutput output = new ItemStackOutput(CraftTweakerMC.getItemStack(itemOutput));
|
||||
Gas gas = GasHelper.toGas(gasInput).getGas();
|
||||
List<OsmiumCompressorRecipe> recipes = new ArrayList<>();
|
||||
for (ItemStack stack : CraftTweakerMC.getIngredient(ingredientInput).getMatchingStacks()) {
|
||||
recipes.add(new OsmiumCompressorRecipe(new AdvancedMachineInput(stack, gas), output));
|
||||
}
|
||||
CrafttweakerIntegration.LATE_ADDITIONS
|
||||
.add(new AddMekanismRecipe<>(NAME, Recipe.OSMIUM_COMPRESSOR,
|
||||
new OsmiumCompressorRecipe(new AdvancedMachineInput(IngredientHelper.toStack(itemInput),
|
||||
GasHelper.toGas(gasInput).getGas()),
|
||||
new ItemStackOutput(IngredientHelper.toStack(itemOutput)))));
|
||||
.add(new AddMekanismRecipe<>(NAME, Recipe.OSMIUM_COMPRESSOR, recipes));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@ package mekanism.common.integration.crafttweaker.handlers;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.minecraft.CraftTweakerMC;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.helpers.IngredientHelper;
|
||||
@@ -12,6 +15,7 @@ import mekanism.common.integration.crafttweaker.util.RemoveAllMekanismRecipe;
|
||||
import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe;
|
||||
import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||
import mekanism.common.recipe.machines.CrusherRecipe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
@@ -23,10 +27,14 @@ public class Crusher {
|
||||
public static final String NAME = Mekanism.MOD_NAME + " Crusher";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack itemInput, IItemStack itemOutput) {
|
||||
if (IngredientHelper.checkNotNull(NAME, itemInput, itemOutput)) {
|
||||
CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe<>(NAME, Recipe.CRUSHER,
|
||||
new CrusherRecipe(IngredientHelper.toStack(itemInput), IngredientHelper.toStack(itemOutput))));
|
||||
public static void addRecipe(IIngredient ingredientInput, IItemStack itemOutput) {
|
||||
if (IngredientHelper.checkNotNull(NAME, ingredientInput, itemOutput)) {
|
||||
ItemStack output = CraftTweakerMC.getItemStack(itemOutput);
|
||||
List<CrusherRecipe> recipes = new ArrayList<>();
|
||||
for (ItemStack stack : CraftTweakerMC.getIngredient(ingredientInput).getMatchingStacks()) {
|
||||
recipes.add(new CrusherRecipe(stack, output));
|
||||
}
|
||||
CrafttweakerIntegration.LATE_ADDITIONS.add(new AddMekanismRecipe<>(NAME, Recipe.CRUSHER, recipes));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+12
-4
@@ -3,6 +3,9 @@ package mekanism.common.integration.crafttweaker.handlers;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.minecraft.CraftTweakerMC;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.helpers.IngredientHelper;
|
||||
@@ -12,6 +15,7 @@ import mekanism.common.integration.crafttweaker.util.RemoveAllMekanismRecipe;
|
||||
import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe;
|
||||
import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||
import mekanism.common.recipe.machines.SmeltingRecipe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
@@ -33,11 +37,15 @@ public class EnergizedSmelter {
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack itemInput, IItemStack itemOutput) {
|
||||
if (IngredientHelper.checkNotNull(NAME, itemInput, itemOutput)) {
|
||||
public static void addRecipe(IIngredient ingredientInput, IItemStack itemOutput) {
|
||||
if (IngredientHelper.checkNotNull(NAME, ingredientInput, itemOutput)) {
|
||||
ItemStack output = CraftTweakerMC.getItemStack(itemOutput);
|
||||
List<SmeltingRecipe> recipes = new ArrayList<>();
|
||||
for (ItemStack stack : CraftTweakerMC.getIngredient(ingredientInput).getMatchingStacks()) {
|
||||
recipes.add(new SmeltingRecipe(stack, output));
|
||||
}
|
||||
CrafttweakerIntegration.LATE_ADDITIONS
|
||||
.add(new AddMekanismRecipe<>(NAME, Recipe.ENERGIZED_SMELTER,
|
||||
new SmeltingRecipe(IngredientHelper.toStack(itemInput), IngredientHelper.toStack(itemOutput))));
|
||||
.add(new AddMekanismRecipe<>(NAME, Recipe.ENERGIZED_SMELTER, recipes));
|
||||
addedRecipe = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,9 @@ package mekanism.common.integration.crafttweaker.handlers;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.minecraft.CraftTweakerMC;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.helpers.IngredientHelper;
|
||||
@@ -12,6 +15,7 @@ import mekanism.common.integration.crafttweaker.util.RemoveAllMekanismRecipe;
|
||||
import mekanism.common.integration.crafttweaker.util.RemoveMekanismRecipe;
|
||||
import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||
import mekanism.common.recipe.machines.EnrichmentRecipe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
@@ -23,12 +27,15 @@ public class Enrichment {
|
||||
public static final String NAME = Mekanism.MOD_NAME + " Enrichment Chamber";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack itemInput, IItemStack itemOutput) {
|
||||
if (IngredientHelper.checkNotNull(NAME, itemInput, itemOutput)) {
|
||||
public static void addRecipe(IIngredient ingredientInput, IItemStack itemOutput) {
|
||||
if (IngredientHelper.checkNotNull(NAME, ingredientInput, itemOutput)) {
|
||||
ItemStack output = CraftTweakerMC.getItemStack(itemOutput);
|
||||
List<EnrichmentRecipe> recipes = new ArrayList<>();
|
||||
for (ItemStack stack : CraftTweakerMC.getIngredient(ingredientInput).getMatchingStacks()) {
|
||||
recipes.add(new EnrichmentRecipe(stack, output));
|
||||
}
|
||||
CrafttweakerIntegration.LATE_ADDITIONS
|
||||
.add(new AddMekanismRecipe<>(NAME, Recipe.ENRICHMENT_CHAMBER,
|
||||
new EnrichmentRecipe(IngredientHelper.toStack(itemInput),
|
||||
IngredientHelper.toStack(itemOutput))));
|
||||
.add(new AddMekanismRecipe<>(NAME, Recipe.ENRICHMENT_CHAMBER, recipes));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,11 @@ import crafttweaker.CraftTweakerAPI;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.minecraft.CraftTweakerMC;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import mekanism.api.infuse.InfuseRegistry;
|
||||
import mekanism.api.infuse.InfuseType;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.helpers.IngredientHelper;
|
||||
@@ -16,6 +20,7 @@ import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||
import mekanism.common.recipe.inputs.InfusionInput;
|
||||
import mekanism.common.recipe.machines.MetallurgicInfuserRecipe;
|
||||
import mekanism.common.recipe.outputs.ItemStackOutput;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
@@ -27,17 +32,21 @@ public class Infuser {
|
||||
public static final String NAME = Mekanism.MOD_NAME + " Metallurgic Infuser";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(String infuseType, int infuseAmount, IItemStack itemInput, IItemStack itemOutput) {
|
||||
public static void addRecipe(String infuseType, int infuseAmount, IIngredient ingredientInput,
|
||||
IItemStack itemOutput) {
|
||||
if (infuseType == null || infuseType.isEmpty()) {
|
||||
CraftTweakerAPI.logError(String.format("Required parameters missing for %s Recipe.", NAME));
|
||||
return;
|
||||
}
|
||||
if (IngredientHelper.checkNotNull(NAME, itemInput, itemOutput)) {
|
||||
if (IngredientHelper.checkNotNull(NAME, ingredientInput, itemOutput)) {
|
||||
InfuseType type = InfuseRegistry.get(infuseType);
|
||||
ItemStackOutput output = new ItemStackOutput(CraftTweakerMC.getItemStack(itemOutput));
|
||||
List<MetallurgicInfuserRecipe> recipes = new ArrayList<>();
|
||||
for (ItemStack stack : CraftTweakerMC.getIngredient(ingredientInput).getMatchingStacks()) {
|
||||
recipes.add(new MetallurgicInfuserRecipe(new InfusionInput(type, infuseAmount, stack), output));
|
||||
}
|
||||
CrafttweakerIntegration.LATE_ADDITIONS
|
||||
.add(new AddMekanismRecipe<>(NAME, Recipe.METALLURGIC_INFUSER,
|
||||
new MetallurgicInfuserRecipe(new InfusionInput(InfuseRegistry.get(infuseType), infuseAmount,
|
||||
IngredientHelper.toStack(itemInput)),
|
||||
new ItemStackOutput(IngredientHelper.toStack(itemOutput)))));
|
||||
.add(new AddMekanismRecipe<>(NAME, Recipe.METALLURGIC_INFUSER, recipes));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,10 @@ package mekanism.common.integration.crafttweaker.handlers;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.minecraft.CraftTweakerMC;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.gas.IGasStack;
|
||||
@@ -16,6 +20,7 @@ import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||
import mekanism.common.recipe.inputs.AdvancedMachineInput;
|
||||
import mekanism.common.recipe.machines.PurificationRecipe;
|
||||
import mekanism.common.recipe.outputs.ItemStackOutput;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
@@ -27,23 +32,29 @@ public class Purification {
|
||||
public static final String NAME = Mekanism.MOD_NAME + " Purification";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack itemInput, IItemStack itemOutput) {
|
||||
if (IngredientHelper.checkNotNull(NAME, itemInput, itemOutput)) {
|
||||
public static void addRecipe(IIngredient ingredientInput, IItemStack itemOutput) {
|
||||
if (IngredientHelper.checkNotNull(NAME, ingredientInput, itemOutput)) {
|
||||
ItemStack output = CraftTweakerMC.getItemStack(itemOutput);
|
||||
List<PurificationRecipe> recipes = new ArrayList<>();
|
||||
for (ItemStack stack : CraftTweakerMC.getIngredient(ingredientInput).getMatchingStacks()) {
|
||||
recipes.add(new PurificationRecipe(stack, output));
|
||||
}
|
||||
CrafttweakerIntegration.LATE_ADDITIONS
|
||||
.add(new AddMekanismRecipe<>(NAME, Recipe.PURIFICATION_CHAMBER,
|
||||
new PurificationRecipe(IngredientHelper.toStack(itemInput),
|
||||
IngredientHelper.toStack(itemOutput))));
|
||||
.add(new AddMekanismRecipe<>(NAME, Recipe.PURIFICATION_CHAMBER, recipes));
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack itemInput, IGasStack gasInput, IItemStack itemOutput) {
|
||||
if (IngredientHelper.checkNotNull(NAME, itemInput, gasInput, itemOutput)) {
|
||||
public static void addRecipe(IIngredient ingredientInput, IGasStack gasInput, IItemStack itemOutput) {
|
||||
if (IngredientHelper.checkNotNull(NAME, ingredientInput, gasInput, itemOutput)) {
|
||||
Gas gas = GasHelper.toGas(gasInput).getGas();
|
||||
ItemStackOutput output = new ItemStackOutput(CraftTweakerMC.getItemStack(itemOutput));
|
||||
List<PurificationRecipe> recipes = new ArrayList<>();
|
||||
for (ItemStack stack : CraftTweakerMC.getIngredient(ingredientInput).getMatchingStacks()) {
|
||||
recipes.add(new PurificationRecipe(new AdvancedMachineInput(stack, gas), output));
|
||||
}
|
||||
CrafttweakerIntegration.LATE_ADDITIONS
|
||||
.add(new AddMekanismRecipe<>(NAME, Recipe.PURIFICATION_CHAMBER,
|
||||
new PurificationRecipe(new AdvancedMachineInput(IngredientHelper.toStack(itemInput),
|
||||
GasHelper.toGas(gasInput).getGas()),
|
||||
new ItemStackOutput(IngredientHelper.toStack(itemOutput)))));
|
||||
.add(new AddMekanismRecipe<>(NAME, Recipe.PURIFICATION_CHAMBER, recipes));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,10 @@ import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.liquid.ILiquidStack;
|
||||
import crafttweaker.api.minecraft.CraftTweakerMC;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.gas.IGasStack;
|
||||
@@ -17,6 +21,8 @@ import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||
import mekanism.common.recipe.inputs.PressurizedInput;
|
||||
import mekanism.common.recipe.machines.PressurizedRecipe;
|
||||
import mekanism.common.recipe.outputs.PressurizedOutput;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
@@ -28,16 +34,20 @@ public class Reaction {
|
||||
public static final String NAME = Mekanism.MOD_NAME + " Reaction";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack itemInput, ILiquidStack liquidInput, IGasStack gasInput,
|
||||
public static void addRecipe(IIngredient ingredientInput, ILiquidStack liquidInput, IGasStack gasInput,
|
||||
IItemStack itemOutput, IGasStack gasOutput, double energy, int duration) {
|
||||
if (IngredientHelper.checkNotNull(NAME, itemInput, liquidInput, gasInput, itemOutput, gasOutput)) {
|
||||
if (IngredientHelper.checkNotNull(NAME, ingredientInput, liquidInput, gasInput, itemOutput, gasOutput)) {
|
||||
FluidStack fluidInput = IngredientHelper.toFluid(liquidInput);
|
||||
GasStack gas = GasHelper.toGas(gasInput);
|
||||
PressurizedOutput output = new PressurizedOutput(CraftTweakerMC.getItemStack(itemOutput),
|
||||
GasHelper.toGas(gasOutput));
|
||||
List<PressurizedRecipe> recipes = new ArrayList<>();
|
||||
for (ItemStack stack : CraftTweakerMC.getIngredient(ingredientInput).getMatchingStacks()) {
|
||||
recipes.add(new PressurizedRecipe(
|
||||
new PressurizedInput(stack, fluidInput, gas), output, energy, duration));
|
||||
}
|
||||
CrafttweakerIntegration.LATE_ADDITIONS
|
||||
.add(new AddMekanismRecipe<>(NAME, Recipe.PRESSURIZED_REACTION_CHAMBER,
|
||||
new PressurizedRecipe(
|
||||
new PressurizedInput(IngredientHelper.toStack(itemInput),
|
||||
IngredientHelper.toFluid(liquidInput), GasHelper.toGas(gasInput)),
|
||||
new PressurizedOutput(IngredientHelper.toStack(itemOutput), GasHelper.toGas(gasOutput)),
|
||||
energy, duration)));
|
||||
.add(new AddMekanismRecipe<>(NAME, Recipe.PRESSURIZED_REACTION_CHAMBER, recipes));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@ package mekanism.common.integration.crafttweaker.handlers;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.minecraft.CraftTweakerMC;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.integration.crafttweaker.CrafttweakerIntegration;
|
||||
import mekanism.common.integration.crafttweaker.helpers.IngredientHelper;
|
||||
@@ -14,6 +17,7 @@ import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||
import mekanism.common.recipe.inputs.ItemStackInput;
|
||||
import mekanism.common.recipe.machines.SawmillRecipe;
|
||||
import mekanism.common.recipe.outputs.ChanceOutput;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
@@ -25,15 +29,18 @@ public class Sawmill {
|
||||
public static final String NAME = Mekanism.MOD_NAME + " Sawmill";
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack itemInput, IItemStack itemOutput, @Optional IItemStack optionalItemOutput,
|
||||
@Optional double optionalChance) {
|
||||
if (IngredientHelper.checkNotNull(NAME, itemInput, itemOutput)) {
|
||||
public static void addRecipe(IIngredient ingredientInput, IItemStack itemOutput,
|
||||
@Optional IItemStack optionalItemOutput, @Optional double optionalChance) {
|
||||
if (IngredientHelper.checkNotNull(NAME, ingredientInput, itemOutput)) {
|
||||
ChanceOutput output = optionalItemOutput == null ? new ChanceOutput(CraftTweakerMC.getItemStack(itemOutput))
|
||||
: new ChanceOutput(CraftTweakerMC.getItemStack(itemOutput),
|
||||
CraftTweakerMC.getItemStack(optionalItemOutput), optionalChance);
|
||||
List<SawmillRecipe> recipes = new ArrayList<>();
|
||||
for (ItemStack stack : CraftTweakerMC.getIngredient(ingredientInput).getMatchingStacks()) {
|
||||
recipes.add(new SawmillRecipe(new ItemStackInput(stack), output));
|
||||
}
|
||||
CrafttweakerIntegration.LATE_ADDITIONS
|
||||
.add(new AddMekanismRecipe<>(NAME, Recipe.PRECISION_SAWMILL,
|
||||
new SawmillRecipe(new ItemStackInput(IngredientHelper.toStack(itemInput)),
|
||||
optionalItemOutput == null ? new ChanceOutput(IngredientHelper.toStack(itemOutput))
|
||||
: new ChanceOutput(IngredientHelper.toStack(itemOutput),
|
||||
IngredientHelper.toStack(optionalItemOutput), optionalChance))));
|
||||
.add(new AddMekanismRecipe<>(NAME, Recipe.PRECISION_SAWMILL, recipes));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-25
@@ -5,8 +5,7 @@ import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.item.IngredientAny;
|
||||
import crafttweaker.api.liquid.ILiquidStack;
|
||||
import crafttweaker.mc1120.item.MCItemStack;
|
||||
import crafttweaker.mc1120.liquid.MCLiquidStack;
|
||||
import crafttweaker.api.minecraft.CraftTweakerMC;
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.common.integration.crafttweaker.gas.CraftTweakerGasStack;
|
||||
@@ -55,15 +54,15 @@ public class IngredientHelper {
|
||||
|
||||
private static IIngredient getIngredient(Object ingredient) {
|
||||
if (ingredient instanceof ItemStack) {
|
||||
return toIItemStack((ItemStack) ingredient);
|
||||
return CraftTweakerMC.getIItemStack((ItemStack) ingredient);
|
||||
} else if (ingredient instanceof GasStack) {
|
||||
return new CraftTweakerGasStack((GasStack) ingredient);
|
||||
} else if (ingredient instanceof Gas) {
|
||||
return new CraftTweakerGasStack(new GasStack((Gas) ingredient, 1));
|
||||
} else if (ingredient instanceof FluidStack) {
|
||||
return toILiquidStack((FluidStack) ingredient);
|
||||
return CraftTweakerMC.getILiquidStack((FluidStack) ingredient);
|
||||
} else if (ingredient instanceof Fluid) {
|
||||
return toILiquidStack(new FluidStack((Fluid) ingredient, 1));
|
||||
return CraftTweakerMC.getILiquidStack(new FluidStack((Fluid) ingredient, 1));
|
||||
}
|
||||
//TODO: Support other types of things like ore dict
|
||||
return IngredientAny.INSTANCE;
|
||||
@@ -144,26 +143,6 @@ public class IngredientHelper {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ILiquidStack toILiquidStack(FluidStack stack) {
|
||||
return stack == null ? null : new MCLiquidStack(stack);
|
||||
}
|
||||
|
||||
public static IItemStack toIItemStack(ItemStack stack) {
|
||||
return stack.isEmpty() ? null : new MCItemStack(stack);
|
||||
}
|
||||
|
||||
public static ItemStack toStack(IItemStack stack) {
|
||||
if (stack != null) {
|
||||
Object internal = stack.getInternal();
|
||||
if (internal instanceof ItemStack) {
|
||||
return (ItemStack) internal;
|
||||
} else {
|
||||
CraftTweakerAPI.logError("Not a valid item stack: " + stack);
|
||||
}
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
public static FluidStack toFluid(ILiquidStack fluid) {
|
||||
return fluid == null ? null : FluidRegistry.getFluidStack(fluid.getName(), fluid.getAmount());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package mekanism.common.integration.crafttweaker.util;
|
||||
|
||||
import java.util.List;
|
||||
import mekanism.common.recipe.RecipeHandler.Recipe;
|
||||
import mekanism.common.recipe.inputs.MachineInput;
|
||||
import mekanism.common.recipe.machines.MachineRecipe;
|
||||
@@ -12,4 +13,9 @@ public class AddMekanismRecipe<INPUT extends MachineInput<INPUT>, OUTPUT extends
|
||||
super(name, true, recipeType);
|
||||
recipes.put(recipe.getInput(), recipe);
|
||||
}
|
||||
|
||||
public AddMekanismRecipe(String name, Recipe<INPUT, OUTPUT, RECIPE> recipeType, List<RECIPE> newRecipes) {
|
||||
super(name, true, recipeType);
|
||||
newRecipes.forEach(recipe -> recipes.put(recipe.getInput(), recipe));
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -60,6 +60,7 @@ public abstract class RecipeMapModification<INPUT extends MachineInput<INPUT>, R
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return String.format("Removing %d %s Recipe(s) for %s", recipes.size(), name, getRecipeInfo());
|
||||
return String
|
||||
.format("%s %d %s Recipe(s) for %s", add ? "Adding" : "Removing", recipes.size(), name, getRecipeInfo());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user