fixes #219 again
This commit is contained in:
parent
c2dcaf1902
commit
d562e1222a
10 changed files with 76 additions and 86 deletions
|
@ -4,6 +4,7 @@ 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 reborncore.common.util.ItemUtils;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
|
@ -74,16 +75,14 @@ public class MTAlloySmelter {
|
|||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output) {
|
||||
for(IItemStack itemStack : output.getItems()){
|
||||
MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(itemStack)));
|
||||
}
|
||||
MineTweakerAPI.apply(new Remove(output));
|
||||
}
|
||||
|
||||
private static class Remove implements IUndoableAction {
|
||||
private final ItemStack output;
|
||||
private final IIngredient output;
|
||||
List<AlloySmelterRecipe> removedRecipes = new ArrayList<AlloySmelterRecipe>();
|
||||
|
||||
public Remove(ItemStack output) {
|
||||
public Remove(IIngredient output) {
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
|
@ -91,7 +90,7 @@ public class MTAlloySmelter {
|
|||
public void apply() {
|
||||
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)) {
|
||||
for (ItemStack stack : recipeType.getOutputs()) {
|
||||
if (ItemUtils.isItemEqual(stack, output, true, false)) {
|
||||
if(output.matches(MineTweakerMC.getIItemStack(stack))) {
|
||||
removedRecipes.add((AlloySmelterRecipe) recipeType);
|
||||
RecipeHandler.recipeList.remove(recipeType);
|
||||
break;
|
||||
|
@ -114,12 +113,12 @@ public class MTAlloySmelter {
|
|||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Removing Alloy Smelter Recipe for " + output.getDisplayName();
|
||||
return "Removing Alloy Smelter Recipe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Re-Adding Alloy Smelter Recipe for " + output.getDisplayName();
|
||||
return "Re-Adding Alloy Smelter Recipe for ";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue