Added minetweaker support to the alloy furnace.
I have no idea on how minetweaker works so could some one help me test? for #70
This commit is contained in:
parent
85bfa95c1c
commit
a85d917873
4 changed files with 116 additions and 0 deletions
|
@ -84,4 +84,9 @@ public abstract class BaseRecipe implements IBaseRecipeType , Cloneable {
|
|||
public boolean useOreDic() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getOutputs() {
|
||||
return outputs;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,12 @@ public interface IBaseRecipeType {
|
|||
*/
|
||||
public int getOutputsSize();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return get outputs
|
||||
*/
|
||||
public List<ItemStack> getOutputs();
|
||||
|
||||
/**
|
||||
* This is the name to check that the recipe is the one that should be used in
|
||||
* the tile entity that is set up to process this recipe.
|
||||
|
|
|
@ -2,6 +2,7 @@ package techreborn.compat;
|
|||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import techreborn.compat.ee3.EmcValues;
|
||||
import techreborn.compat.minetweaker.MinetweakerCompat;
|
||||
import techreborn.compat.recipes.RecipesBiomesOPlenty;
|
||||
import techreborn.compat.recipes.RecipesBuildcraft;
|
||||
import techreborn.compat.recipes.RecipesForestry;
|
||||
|
@ -30,6 +31,7 @@ public class CompatManager {
|
|||
registerCompact(RecipesBiomesOPlenty.class, "BiomesOPlenty");
|
||||
registerCompact(RecipesThaumcraft.class, "Thaumcraft");
|
||||
registerCompact(RecipesForestry.class, "Forestry");
|
||||
registerCompact(MinetweakerCompat.class, "MineTweaker");
|
||||
}
|
||||
|
||||
public void registerCompact(Class<?> moduleClass, String modid) {
|
||||
|
|
|
@ -1,8 +1,111 @@
|
|||
package techreborn.compat.minetweaker;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.minecraft.MineTweakerMC;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import techreborn.api.recipe.IBaseRecipeType;
|
||||
import techreborn.api.recipe.RecipeHandler;
|
||||
import techreborn.api.recipe.machines.AlloySmelterRecipe;
|
||||
import techreborn.util.ItemUtils;
|
||||
|
||||
@ZenClass("techreborn.crafting.AlloySmelter")
|
||||
public class MTAlloySmelter {
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IItemStack input1, IItemStack input2, int ticktime, int eutick) {
|
||||
MineTweakerAPI.apply(new AddRecipeAction(input1, input2, output, ticktime, eutick));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void remove(IIngredient output) {
|
||||
for(IBaseRecipeType recipeType : RecipeHandler.recipeList){
|
||||
if(recipeType.getRecipeName().equals("alloySmelterRecipe")){
|
||||
for(ItemStack outputstack : recipeType.getOutputs()){
|
||||
if(ItemUtils.isItemEqual(MineTweakerMC.getItemStack(output), outputstack, true, false, false)){
|
||||
MineTweakerAPI.apply(new RemoveRecipeAction(recipeType));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class AddRecipeAction extends AlloySmelterRecipe implements IUndoableAction{
|
||||
|
||||
public AddRecipeAction(IItemStack input1, IItemStack input2, IItemStack output1, int tickTime, int euPerTick) {
|
||||
super(MineTweakerMC.getItemStack(input1), MineTweakerMC.getItemStack(input2), MineTweakerMC.getItemStack(output1), tickTime, euPerTick);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
RecipeHandler.addRecipe(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Adding recipe to the alloy furnace";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Removing recipe to the alloy furnace";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static class RemoveRecipeAction implements IUndoableAction {
|
||||
private final IBaseRecipeType recipe;
|
||||
|
||||
public RemoveRecipeAction(IBaseRecipeType recipeType) {
|
||||
this.recipe = recipeType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
RecipeHandler.recipeList.remove(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Removing" + recipe.getUserFreindlyName() + "recipe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Restoring" + recipe.getUserFreindlyName() + "recipe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue