mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-22 04:52:25 +00:00
add recipe adding methods to the API, and a handler to get the internal class.
This commit is contained in:
1 parent
26a28c13db
commit
64b2e421f7
3 files changed
+257
No files matched your search
@@ -7,11 +7,14 @@ import mekanism.api.util.BlockInfo;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
public class MekanismAPI
|
||||
{
|
||||
//Add a BlockInfo value here if you don't want a certain block to be picked up by cardboard boxes
|
||||
private static Set<BlockInfo> cardboardBoxIgnore = new HashSet<>();
|
||||
|
||||
private static MekanismRecipeHelper helper = null;
|
||||
|
||||
/** Mekanism debug mode */
|
||||
public static boolean debug = false;
|
||||
@@ -45,4 +48,22 @@ public class MekanismAPI
|
||||
}
|
||||
|
||||
public static class BoxBlacklistEvent extends Event {}
|
||||
|
||||
/**
|
||||
* Get the instance of the recipe helper to directly add recipes.
|
||||
*
|
||||
* Do NOT copy/repackage this method into your package, nor use the class directly as it may change.
|
||||
*
|
||||
* @return {@link MekanismRecipeHelper} The handler.
|
||||
*/
|
||||
public static MekanismRecipeHelper recipeHelper(){
|
||||
if (helper == null){
|
||||
try {
|
||||
helper = (MekanismRecipeHelper)Class.forName("mekanism.common.recipe.APIHandler").newInstance();
|
||||
} catch (ClassNotFoundException|InstantiationException|IllegalAccessException e) {
|
||||
LogManager.getLogger("MekanismAPI").error("Could not find API Handler", e);
|
||||
}
|
||||
}
|
||||
return helper;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package mekanism.api;
|
||||
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.infuse.InfuseType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public interface MekanismRecipeHelper {
|
||||
/**
|
||||
* Add an Enrichment Chamber recipe.
|
||||
* @param input - input ItemStack
|
||||
* @param output - output ItemStack
|
||||
*/
|
||||
void addEnrichmentChamberRecipe(ItemStack input, ItemStack output);
|
||||
|
||||
/**
|
||||
* Add an Osmium Compressor recipe.
|
||||
* @param input - input ItemStack
|
||||
* @param output - output ItemStack
|
||||
*/
|
||||
void addOsmiumCompressorRecipe(ItemStack input, ItemStack output);
|
||||
|
||||
/**
|
||||
* Add a Combiner recipe.
|
||||
* @param input - input ItemStack
|
||||
* @param output - output ItemStack
|
||||
*/
|
||||
void addCombinerRecipe(ItemStack input, ItemStack output);
|
||||
|
||||
/**
|
||||
* Add a Crusher recipe.
|
||||
* @param input - input ItemStack
|
||||
* @param output - output ItemStack
|
||||
*/
|
||||
void addCrusherRecipe(ItemStack input, ItemStack output);
|
||||
|
||||
/**
|
||||
* Add a Purification Chamber recipe.
|
||||
* @param input - input ItemStack
|
||||
* @param output - output ItemStack
|
||||
*/
|
||||
void addPurificationChamberRecipe(ItemStack input, ItemStack output);
|
||||
|
||||
/**
|
||||
* Add a Metallurgic Infuser recipe.
|
||||
* @param infuse - which Infuse to use
|
||||
* @param amount - how much of the Infuse to use
|
||||
* @param input - input ItemStack
|
||||
* @param output - output ItemStack
|
||||
*/
|
||||
void addMetallurgicInfuserRecipe(InfuseType infuse, int amount, ItemStack input, ItemStack output);
|
||||
|
||||
/**
|
||||
* Add a Chemical Infuser recipe.
|
||||
* @param leftInput - left GasStack to input
|
||||
* @param rightInput - right GasStack to input
|
||||
* @param output - output GasStack
|
||||
*/
|
||||
void addChemicalInfuserRecipe(GasStack leftInput, GasStack rightInput, GasStack output);
|
||||
|
||||
/**
|
||||
* Add a Chemical Oxidizer recipe.
|
||||
* @param input - input ItemStack
|
||||
* @param output - output GasStack
|
||||
*/
|
||||
void addChemicalOxidizerRecipe(ItemStack input, GasStack output);
|
||||
|
||||
/**
|
||||
* Add a Chemical Injection Chamber recipe.
|
||||
* @param input - input ItemStack
|
||||
* @param output - output ItemStack
|
||||
*/
|
||||
void addChemicalInjectionChamberRecipe(ItemStack input, Gas gas, ItemStack output);
|
||||
|
||||
/**
|
||||
* Add an Electrolytic Separator recipe.
|
||||
* @param fluid - FluidStack to electrolyze
|
||||
* @param leftOutput - left gas to produce when the fluid is electrolyzed
|
||||
* @param rightOutput - right gas to produce when the fluid is electrolyzed
|
||||
*/
|
||||
void addElectrolyticSeparatorRecipe(FluidStack fluid, double energy, GasStack leftOutput, GasStack rightOutput);
|
||||
|
||||
/**
|
||||
* Add a Precision Sawmill recipe.
|
||||
* @param input - input ItemStack
|
||||
* @param primaryOutput - guaranteed output
|
||||
* @param secondaryOutput - possible extra output
|
||||
* @param chance - probability of obtaining extra output
|
||||
*/
|
||||
void addPrecisionSawmillRecipe(ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput, double chance);
|
||||
|
||||
/**
|
||||
* Add a Precision Sawmill recipe with no chance output
|
||||
* @param input - input ItemStack
|
||||
* @param primaryOutput - guaranteed output
|
||||
*/
|
||||
void addPrecisionSawmillRecipe(ItemStack input, ItemStack primaryOutput);
|
||||
|
||||
/**
|
||||
* Add a Chemical Dissolution Chamber recipe.
|
||||
* @param input - input ItemStack
|
||||
* @param output - output GasStack
|
||||
*/
|
||||
void addChemicalDissolutionChamberRecipe(ItemStack input, GasStack output);
|
||||
|
||||
/**
|
||||
* Add a Chemical Washer recipe.
|
||||
* @param input - input GasStack
|
||||
* @param output - output GasStack
|
||||
*/
|
||||
void addChemicalWasherRecipe(GasStack input, GasStack output);
|
||||
|
||||
/**
|
||||
* Add a Chemical Crystallizer recipe.
|
||||
* @param input - input GasStack
|
||||
* @param output - output ItemStack
|
||||
*/
|
||||
void addChemicalCrystallizerRecipe(GasStack input, ItemStack output);
|
||||
|
||||
/**
|
||||
* Add a Pressurized Reaction Chamber recipe.
|
||||
* @param inputSolid - input ItemStack
|
||||
* @param inputFluid - input FluidStack
|
||||
* @param inputGas - input GasStack
|
||||
* @param outputSolid - output ItemStack
|
||||
* @param outputGas - output GasStack
|
||||
* @param extraEnergy - extra energy needed by the recipe
|
||||
* @param ticks - amount of ticks it takes for this recipe to complete
|
||||
*/
|
||||
void addPRCRecipe(ItemStack inputSolid, FluidStack inputFluid, GasStack inputGas, ItemStack outputSolid, GasStack outputGas, double extraEnergy, int ticks);
|
||||
|
||||
void addThermalEvaporationRecipe(FluidStack inputFluid, FluidStack outputFluid);
|
||||
|
||||
void addSolarNeutronRecipe(GasStack inputGas, GasStack outputGas);
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package mekanism.common.recipe;
|
||||
|
||||
import mekanism.api.MekanismRecipeHelper;
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.infuse.InfuseType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class APIHandler implements MekanismRecipeHelper {
|
||||
@Override
|
||||
public void addEnrichmentChamberRecipe(ItemStack input, ItemStack output) {
|
||||
RecipeHandler.addEnrichmentChamberRecipe(input, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addOsmiumCompressorRecipe(ItemStack input, ItemStack output) {
|
||||
RecipeHandler.addOsmiumCompressorRecipe(input, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCombinerRecipe(ItemStack input, ItemStack output) {
|
||||
RecipeHandler.addCombinerRecipe(input, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCrusherRecipe(ItemStack input, ItemStack output) {
|
||||
RecipeHandler.addCrusherRecipe(input, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPurificationChamberRecipe(ItemStack input, ItemStack output) {
|
||||
RecipeHandler.addPurificationChamberRecipe(input, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMetallurgicInfuserRecipe(InfuseType infuse, int amount, ItemStack input, ItemStack output) {
|
||||
RecipeHandler.addMetallurgicInfuserRecipe(infuse, amount, input, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addChemicalInfuserRecipe(GasStack leftInput, GasStack rightInput, GasStack output) {
|
||||
RecipeHandler.addChemicalInfuserRecipe(leftInput, rightInput, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addChemicalOxidizerRecipe(ItemStack input, GasStack output) {
|
||||
RecipeHandler.addChemicalOxidizerRecipe(input, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addChemicalInjectionChamberRecipe(ItemStack input, Gas gas, ItemStack output) {
|
||||
RecipeHandler.addChemicalInjectionChamberRecipe(input, gas, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addElectrolyticSeparatorRecipe(FluidStack fluid, double energy, GasStack leftOutput, GasStack rightOutput) {
|
||||
RecipeHandler.addElectrolyticSeparatorRecipe(fluid, energy, leftOutput, rightOutput);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPrecisionSawmillRecipe(ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput, double chance) {
|
||||
RecipeHandler.addPrecisionSawmillRecipe(input, primaryOutput, secondaryOutput, chance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPrecisionSawmillRecipe(ItemStack input, ItemStack primaryOutput) {
|
||||
RecipeHandler.addPrecisionSawmillRecipe(input, primaryOutput);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addChemicalDissolutionChamberRecipe(ItemStack input, GasStack output) {
|
||||
RecipeHandler.addChemicalDissolutionChamberRecipe(input, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addChemicalWasherRecipe(GasStack input, GasStack output) {
|
||||
RecipeHandler.addChemicalWasherRecipe(input, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addChemicalCrystallizerRecipe(GasStack input, ItemStack output) {
|
||||
RecipeHandler.addChemicalCrystallizerRecipe(input, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPRCRecipe(ItemStack inputSolid, FluidStack inputFluid, GasStack inputGas, ItemStack outputSolid, GasStack outputGas, double extraEnergy, int ticks) {
|
||||
RecipeHandler.addPRCRecipe(inputSolid, inputFluid, inputGas, outputSolid, outputGas, extraEnergy, ticks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addThermalEvaporationRecipe(FluidStack inputFluid, FluidStack outputFluid) {
|
||||
RecipeHandler.addThermalEvaporationRecipe(inputFluid, outputFluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSolarNeutronRecipe(GasStack inputGas, GasStack outputGas) {
|
||||
RecipeHandler.addSolarNeutronRecipe(inputGas, outputGas);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user