Add RecipeSettings to CraftTweaker supports, allows disabling oredict checking.

Closes #1455
This commit is contained in:
modmuss50 2018-04-01 23:50:54 +01:00
parent d563ff748a
commit 087a2226d6
14 changed files with 55 additions and 21 deletions

View file

@ -34,19 +34,21 @@ import techreborn.api.recipe.machines.AlloySmelterRecipe;
/**
* mods.techreborn.alloySmelter.addRecipe(<minecraft:gold_ingot>, <minecraft:iron_ingot>, <minecraft:diamond>, 20, 100);
* mods.techreborn.alloySmelter.addRecipe(<minecraft:gold_ingot>, <minecraft:iron_ingot>, <minecraft:diamond>, 20, 100).setUseOreDict(false);
*/
@ZenClass("mods.techreborn.alloySmelter")
public class CTAlloySmelter extends CTGeneric {
@ZenMethod
public static void addRecipe(IItemStack output, IIngredient input1, IIngredient input2, int ticktime, int euTick) {
public static RecipeSettings addRecipe(IItemStack output, IIngredient input1, IIngredient input2, int ticktime, int euTick) {
Object oInput1 = CraftTweakerCompat.toObject(input1);
Object oInput2 = CraftTweakerCompat.toObject(input2);
AlloySmelterRecipe r = new AlloySmelterRecipe(oInput1, oInput2, CraftTweakerCompat.toStack(output), ticktime, euTick);
addRecipe(r);
return new RecipeSettings(r);
}
@ZenMethod

View file

@ -36,13 +36,14 @@ import techreborn.api.recipe.machines.AssemblingMachineRecipe;
public class CTAssemblingMachine extends CTGeneric {
@ZenMethod
public static void addRecipe(IItemStack output, IIngredient input1, IIngredient input2, int ticktime, int euTick) {
public static RecipeSettings addRecipe(IItemStack output, IIngredient input1, IIngredient input2, int ticktime, int euTick) {
Object oInput1 = CraftTweakerCompat.toObject(input1);
Object oInput2 = CraftTweakerCompat.toObject(input2);
AssemblingMachineRecipe r = new AssemblingMachineRecipe(oInput1, oInput2, CraftTweakerCompat.toStack(output), ticktime, euTick);
addRecipe(r);
return new RecipeSettings(r);
}
@ZenMethod

View file

@ -36,13 +36,14 @@ import techreborn.api.recipe.machines.BlastFurnaceRecipe;
public class CTBlastFurnace extends CTGeneric {
@ZenMethod
public static void addRecipe(IItemStack output1, IItemStack output2, IIngredient input1, IIngredient input2, int ticktime, int euTick, int neededHeat) {
public static RecipeSettings addRecipe(IItemStack output1, IItemStack output2, IIngredient input1, IIngredient input2, int ticktime, int euTick, int neededHeat) {
Object oInput1 = CraftTweakerCompat.toObject(input1);
Object oInput2 = CraftTweakerCompat.toObject(input2);
BlastFurnaceRecipe r = new BlastFurnaceRecipe(oInput1, oInput2, CraftTweakerCompat.toStack(output1), CraftTweakerCompat.toStack(output2), ticktime, euTick, neededHeat);
addRecipe(r);
return new RecipeSettings(r);
}
@ZenMethod

View file

@ -36,13 +36,14 @@ import techreborn.api.recipe.machines.CentrifugeRecipe;
public class CTCentrifuge extends CTGeneric {
@ZenMethod
public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack output4, IIngredient input1, IIngredient input2, int ticktime, int euTick) {
public static RecipeSettings addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack output4, IIngredient input1, IIngredient input2, int ticktime, int euTick) {
Object oInput1 = CraftTweakerCompat.toObject(input1);
Object oInput2 = CraftTweakerCompat.toObject(input2);
CentrifugeRecipe r = new CentrifugeRecipe(oInput1, oInput2, CraftTweakerCompat.toStack(output1), CraftTweakerCompat.toStack(output2), CraftTweakerCompat.toStack(output3), CraftTweakerCompat.toStack(output4), ticktime, euTick);
addRecipe(r);
return new RecipeSettings(r);
}
@ZenMethod

View file

@ -36,13 +36,14 @@ import techreborn.api.recipe.machines.ChemicalReactorRecipe;
public class CTChemicalReactor extends CTGeneric {
@ZenMethod
public static void addRecipe(IItemStack output1, IIngredient input1, IIngredient input2, int ticktime, int euTick) {
public static RecipeSettings addRecipe(IItemStack output1, IIngredient input1, IIngredient input2, int ticktime, int euTick) {
Object oInput1 = CraftTweakerCompat.toObject(input1);
Object oInput2 = CraftTweakerCompat.toObject(input2);
ChemicalReactorRecipe r = new ChemicalReactorRecipe(oInput1, oInput2, CraftTweakerCompat.toStack(output1), ticktime, euTick);
addRecipe(r);
return new RecipeSettings(r);
}
@ZenMethod

View file

@ -40,10 +40,11 @@ import techreborn.api.recipe.machines.CompressorRecipe;
public class CTCompressor extends CTGeneric {
@ZenMethod
public static void addRecipe(IItemStack output1, IIngredient input1, int ticktime, int euTick) {
public static RecipeSettings addRecipe(IItemStack output1, IIngredient input1, int ticktime, int euTick) {
Object oInput1 = CraftTweakerCompat.toObject(input1);
CompressorRecipe r = new CompressorRecipe(oInput1, CraftTweakerCompat.toStack(output1), ticktime, euTick);
addRecipe(r);
return new RecipeSettings(r);
}
@ZenMethod

View file

@ -40,13 +40,14 @@ import techreborn.api.recipe.machines.DistillationTowerRecipe;
public class CTDistillationTower extends CTGeneric {
@ZenMethod
public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack output4, IIngredient input1, IIngredient input2, int ticktime, int euTick) {
public static RecipeSettings addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack output4, IIngredient input1, IIngredient input2, int ticktime, int euTick) {
Object oInput1 = CraftTweakerCompat.toObject(input1);
Object oInput2 = CraftTweakerCompat.toObject(input2);
DistillationTowerRecipe r = new DistillationTowerRecipe(oInput1, oInput2, CraftTweakerCompat.toStack(output1), CraftTweakerCompat.toStack(output2), CraftTweakerCompat.toStack(output3), CraftTweakerCompat.toStack(output4), ticktime, euTick);
addRecipe(r);
return new RecipeSettings(r);
}
@ZenMethod

View file

@ -38,12 +38,13 @@ import techreborn.api.recipe.machines.ExtractorRecipe;
@ZenClass("mods.techreborn.extractor")
public class CTExtractor extends CTGeneric {
@ZenMethod
public static void addRecipe(IItemStack output, IIngredient input1, int ticktime, int euTick) {
public static RecipeSettings addRecipe(IItemStack output, IIngredient input1, int ticktime, int euTick) {
Object oInput1 = CraftTweakerCompat.toObject(input1);
ExtractorRecipe r = new ExtractorRecipe(oInput1, CraftTweakerCompat.toStack(output), ticktime, euTick);
addRecipe(r);
return new RecipeSettings(r);
}
@ZenMethod

View file

@ -36,13 +36,14 @@ import techreborn.api.recipe.machines.ImplosionCompressorRecipe;
public class CTImplosionCompressor extends CTGeneric {
@ZenMethod
public static void addRecipe(IItemStack output1, IItemStack output2, IIngredient input1, IIngredient input2, int ticktime, int euTick) {
public static RecipeSettings addRecipe(IItemStack output1, IItemStack output2, IIngredient input1, IIngredient input2, int ticktime, int euTick) {
Object oInput1 = CraftTweakerCompat.toObject(input1);
Object oInput2 = CraftTweakerCompat.toObject(input2);
ImplosionCompressorRecipe r = new ImplosionCompressorRecipe(oInput1, oInput2, CraftTweakerCompat.toStack(output1), CraftTweakerCompat.toStack(output2), ticktime, euTick);
addRecipe(r);
return new RecipeSettings(r);
}
@ZenMethod

View file

@ -36,13 +36,14 @@ import techreborn.api.recipe.machines.IndustrialElectrolyzerRecipe;
public class CTIndustrialElectrolyzer extends CTGeneric {
@ZenMethod
public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack output4, IIngredient cells, IIngredient input2, int ticktime, int euTick) {
public static RecipeSettings addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack output4, IIngredient cells, IIngredient input2, int ticktime, int euTick) {
Object oInput1 = CraftTweakerCompat.toObject(cells);
Object oInput2 = CraftTweakerCompat.toObject(input2);
IndustrialElectrolyzerRecipe r = new IndustrialElectrolyzerRecipe(oInput1, oInput2, CraftTweakerCompat.toStack(output1), CraftTweakerCompat.toStack(output2), CraftTweakerCompat.toStack(output3), CraftTweakerCompat.toStack(output4), ticktime, euTick);
addRecipe(r);
return new RecipeSettings(r);
}
@ZenMethod

View file

@ -52,8 +52,8 @@ public class CTIndustrialGrinder extends CTGeneric {
* @param euTick Amount of EU per tick consumed during crafting
*/
@ZenMethod
public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack output4, IIngredient input1, IIngredient input2, int ticktime, int euTick) {
addRecipe(output1, output2, output3, output4, input1, input2, null, ticktime, euTick);
public static RecipeSettings addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack output4, IIngredient input1, IIngredient input2, int ticktime, int euTick) {
return addRecipe(output1, output2, output3, output4, input1, input2, null, ticktime, euTick);
}
/**
@ -69,7 +69,7 @@ public class CTIndustrialGrinder extends CTGeneric {
* @param euTick Amount of EU per tick consumed during crafting
*/
@ZenMethod
public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack output4, IIngredient input1, IIngredient input2, ILiquidStack fluid, int ticktime, int euTick) {
public static RecipeSettings addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack output4, IIngredient input1, IIngredient input2, ILiquidStack fluid, int ticktime, int euTick) {
Object oInput1 = CraftTweakerCompat.toObject(input1);
// There is only one input slot in Industrial Grinder
@ -82,6 +82,7 @@ public class CTIndustrialGrinder extends CTGeneric {
IndustrialGrinderRecipe r = new IndustrialGrinderRecipe(oInput1, fluidStack, CraftTweakerCompat.toStack(output1), CraftTweakerCompat.toStack(output2), CraftTweakerCompat.toStack(output3), CraftTweakerCompat.toStack(output4), ticktime, euTick);
addRecipe(r);
return new RecipeSettings(r);
}
/**

View file

@ -38,22 +38,22 @@ import techreborn.api.recipe.machines.IndustrialSawmillRecipe;
public class CTIndustrialSawmill extends CTGeneric {
@ZenMethod
public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IIngredient input1, ILiquidStack fluid, int ticktime, int euTick) {
addRecipe(output1, output2, output3, input1, fluid, ticktime, euTick, true);
public static RecipeSettings addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IIngredient input1, ILiquidStack fluid, int ticktime, int euTick) {
return addRecipe(output1, output2, output3, input1, fluid, ticktime, euTick, true);
}
@ZenMethod
public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IIngredient input1, int ticktime, int euTick) {
addRecipe(output1, output2, output3, input1, null, ticktime, euTick, true);
public static RecipeSettings addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IIngredient input1, int ticktime, int euTick) {
return addRecipe(output1, output2, output3, input1, null, ticktime, euTick, true);
}
@ZenMethod
public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IIngredient input1, int ticktime, int euTick, boolean useOreDic) {
addRecipe(output1, output2, output3, input1, null, ticktime, euTick, useOreDic);
public static RecipeSettings addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IIngredient input1, int ticktime, int euTick, boolean useOreDic) {
return addRecipe(output1, output2, output3, input1, null, ticktime, euTick, useOreDic);
}
@ZenMethod
public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IIngredient input1, ILiquidStack fluid, int ticktime, int euTick, boolean useOreDic) {
public static RecipeSettings addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IIngredient input1, ILiquidStack fluid, int ticktime, int euTick, boolean useOreDic) {
Object oInput1 = CraftTweakerCompat.toObject(input1);
FluidStack fluidStack = null;
@ -64,6 +64,7 @@ public class CTIndustrialSawmill extends CTGeneric {
IndustrialSawmillRecipe r = new IndustrialSawmillRecipe(oInput1, fluidStack, CraftTweakerCompat.toStack(output1), CraftTweakerCompat.toStack(output2), CraftTweakerCompat.toStack(output3), ticktime, euTick, useOreDic);
addRecipe(r);
return new RecipeSettings(r);
}
@ZenMethod

View file

@ -36,11 +36,12 @@ import techreborn.api.recipe.machines.VacuumFreezerRecipe;
public class CTVacuumFreezer extends CTGeneric {
@ZenMethod
public static void addRecipe(IItemStack output, IIngredient input, int ticktime, int euTick) {
public static RecipeSettings addRecipe(IItemStack output, IIngredient input, int ticktime, int euTick) {
Object oInput1 = CraftTweakerCompat.toObject(input);
VacuumFreezerRecipe r = new VacuumFreezerRecipe(oInput1, CraftTweakerCompat.toStack(output), ticktime, euTick);
addRecipe(r);
return new RecipeSettings(r);
}
@ZenMethod

View file

@ -0,0 +1,20 @@
package techreborn.compat.crafttweaker;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import techreborn.api.recipe.BaseRecipe;
@ZenClass("mods.techreborn.RecipeSettings")
public class RecipeSettings {
private BaseRecipe baseRecipe;
public RecipeSettings(BaseRecipe baseRecipe) {
this.baseRecipe = baseRecipe;
}
@ZenMethod
public void setUseOreDict(boolean useOreDict){
baseRecipe.setOreDict(useOreDict);
}
}