Revert "fixes #219 again"

This reverts commit d562e1222a.
This commit is contained in:
Modmuss50 2015-11-13 08:26:51 +00:00
parent 2331e3c35d
commit a7001bbfd7
10 changed files with 86 additions and 76 deletions

View file

@ -4,7 +4,6 @@ import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient; import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack; import minetweaker.api.item.IItemStack;
import minetweaker.api.minecraft.MineTweakerMC;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenMethod;
@ -74,14 +73,16 @@ public class MTAlloySmelter {
@ZenMethod @ZenMethod
public static void removeRecipe(IIngredient output) { public static void removeRecipe(IIngredient output) {
MineTweakerAPI.apply(new Remove(output)); for(IItemStack itemStack : output.getItems()){
MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(itemStack)));
}
} }
private static class Remove implements IUndoableAction { private static class Remove implements IUndoableAction {
private final IIngredient output; private final ItemStack output;
List<AlloySmelterRecipe> removedRecipes = new ArrayList<AlloySmelterRecipe>(); List<AlloySmelterRecipe> removedRecipes = new ArrayList<AlloySmelterRecipe>();
public Remove(IIngredient output) { public Remove(ItemStack output) {
this.output = output; this.output = output;
} }
@ -89,7 +90,7 @@ public class MTAlloySmelter {
public void apply() { public void apply() {
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)) { for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)) {
for (ItemStack stack : recipeType.getOutputs()) { for (ItemStack stack : recipeType.getOutputs()) {
if(output.matches(MineTweakerMC.getIItemStack(stack))) { if (ItemUtils.isItemEqual(stack, output, true, false)) {
removedRecipes.add((AlloySmelterRecipe) recipeType); removedRecipes.add((AlloySmelterRecipe) recipeType);
RecipeHandler.recipeList.remove(recipeType); RecipeHandler.recipeList.remove(recipeType);
break; break;
@ -112,12 +113,12 @@ public class MTAlloySmelter {
@Override @Override
public String describe() { public String describe() {
return "Removing Alloy Smelter Recipe"; return "Removing Alloy Smelter Recipe for " + output.getDisplayName();
} }
@Override @Override
public String describeUndo() { public String describeUndo() {
return "Re-Adding Alloy Smelter Recipe for "; return "Re-Adding Alloy Smelter Recipe for " + output.getDisplayName();
} }
@Override @Override

View file

@ -4,7 +4,6 @@ import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient; import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack; import minetweaker.api.item.IItemStack;
import minetweaker.api.minecraft.MineTweakerMC;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenMethod;
@ -69,14 +68,16 @@ public class MTAssemblingMachine {
@ZenMethod @ZenMethod
public static void removeRecipe(IIngredient output) { public static void removeRecipe(IIngredient output) {
MineTweakerAPI.apply(new Remove(output)); for(IItemStack itemStack : output.getItems()){
MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(itemStack)));
}
} }
private static class Remove implements IUndoableAction { private static class Remove implements IUndoableAction {
private final IIngredient output; private final ItemStack output;
List<AssemblingMachineRecipe> removedRecipes = new ArrayList<AssemblingMachineRecipe>(); List<AssemblingMachineRecipe> removedRecipes = new ArrayList<AssemblingMachineRecipe>();
public Remove(IIngredient output) { public Remove(ItemStack output) {
this.output = output; this.output = output;
} }
@ -84,7 +85,7 @@ public class MTAssemblingMachine {
public void apply() { public void apply() {
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.assemblingMachineRecipe)) { for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.assemblingMachineRecipe)) {
for (ItemStack stack : recipeType.getOutputs()) { for (ItemStack stack : recipeType.getOutputs()) {
if (output.matches(MineTweakerMC.getIItemStack(stack))) { if (ItemUtils.isItemEqual(stack, output, true, false)) {
removedRecipes.add((AssemblingMachineRecipe) recipeType); removedRecipes.add((AssemblingMachineRecipe) recipeType);
RecipeHandler.recipeList.remove(recipeType); RecipeHandler.recipeList.remove(recipeType);
break; break;
@ -107,12 +108,12 @@ public class MTAssemblingMachine {
@Override @Override
public String describe() { public String describe() {
return "Removing Assembling Machine Recipe"; return "Removing Assembling Machine Recipe for " + output.getDisplayName();
} }
@Override @Override
public String describeUndo() { public String describeUndo() {
return "Re-Adding Assembling Machine Recipe"; return "Re-Adding Assembling Machine Recipe for " + output.getDisplayName();
} }
@Override @Override

View file

@ -4,7 +4,6 @@ import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient; import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack; import minetweaker.api.item.IItemStack;
import minetweaker.api.minecraft.MineTweakerMC;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenMethod;
@ -68,14 +67,16 @@ public class MTBlastFurnace {
@ZenMethod @ZenMethod
public static void removeRecipe(IIngredient output) { public static void removeRecipe(IIngredient output) {
MineTweakerAPI.apply(new Remove(output)); for(IItemStack itemStack : output.getItems()){
MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(itemStack)));
}
} }
private static class Remove implements IUndoableAction { private static class Remove implements IUndoableAction {
private final IIngredient output; private final ItemStack output;
List<BlastFurnaceRecipe> removedRecipes = new ArrayList<BlastFurnaceRecipe>(); List<BlastFurnaceRecipe> removedRecipes = new ArrayList<BlastFurnaceRecipe>();
public Remove(IIngredient output) { public Remove(ItemStack output) {
this.output = output; this.output = output;
} }
@ -83,7 +84,7 @@ public class MTBlastFurnace {
public void apply() { public void apply() {
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.blastFurnaceRecipe)) { for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.blastFurnaceRecipe)) {
for (ItemStack stack : recipeType.getOutputs()) { for (ItemStack stack : recipeType.getOutputs()) {
if (output.matches(MineTweakerMC.getIItemStack(stack))) { if (ItemUtils.isItemEqual(stack, output, true, false)) {
removedRecipes.add((BlastFurnaceRecipe) recipeType); removedRecipes.add((BlastFurnaceRecipe) recipeType);
RecipeHandler.recipeList.remove(recipeType); RecipeHandler.recipeList.remove(recipeType);
break; break;
@ -106,12 +107,12 @@ public class MTBlastFurnace {
@Override @Override
public String describe() { public String describe() {
return "Removing Blast Furnace Recipe"; return "Removing Blast Furnace Recipe for " + output.getDisplayName();
} }
@Override @Override
public String describeUndo() { public String describeUndo() {
return "Re-Adding Blast Furnace Recipe"; return "Re-Adding Blast Furnace Recipe for " + output.getDisplayName();
} }
@Override @Override

View file

@ -4,7 +4,6 @@ import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient; import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack; import minetweaker.api.item.IItemStack;
import minetweaker.api.minecraft.MineTweakerMC;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenMethod;
@ -68,21 +67,23 @@ public class MTCentrifuge {
@ZenMethod @ZenMethod
public static void removeRecipe(IIngredient output) { public static void removeRecipe(IIngredient output) {
MineTweakerAPI.apply(new Remove(output)); for(IItemStack itemStack : output.getItems()){
MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(itemStack)));
}
} }
@ZenMethod @ZenMethod
public static void removeInputRecipe(IIngredient output) { public static void removeInputRecipe(IIngredient output) {
for(IItemStack itemStack : output.getItems()){ for(IItemStack itemStack : output.getItems()){
MineTweakerAPI.apply(new RemoveInput(output)); MineTweakerAPI.apply(new RemoveInput(MinetweakerCompat.toStack(itemStack)));
} }
} }
private static class RemoveInput implements IUndoableAction { private static class RemoveInput implements IUndoableAction {
private final IIngredient output; private final ItemStack output;
List<CentrifugeRecipe> removedRecipes = new ArrayList<CentrifugeRecipe>(); List<CentrifugeRecipe> removedRecipes = new ArrayList<CentrifugeRecipe>();
public RemoveInput(IIngredient output) { public RemoveInput(ItemStack output) {
this.output = output; this.output = output;
} }
@ -90,7 +91,7 @@ public class MTCentrifuge {
public void apply() { public void apply() {
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.centrifugeRecipe)) { for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.centrifugeRecipe)) {
for (ItemStack stack : recipeType.getInputs()) { for (ItemStack stack : recipeType.getInputs()) {
if (output.matches(MineTweakerMC.getIItemStack(stack))) { if (ItemUtils.isItemEqual(stack, output, true, false)) {
removedRecipes.add((CentrifugeRecipe) recipeType); removedRecipes.add((CentrifugeRecipe) recipeType);
RecipeHandler.recipeList.remove(recipeType); RecipeHandler.recipeList.remove(recipeType);
break; break;
@ -113,12 +114,12 @@ public class MTCentrifuge {
@Override @Override
public String describe() { public String describe() {
return "Removing Centrifuge Recipe for"; return "Removing Centrifuge Recipe for " + output.getDisplayName();
} }
@Override @Override
public String describeUndo() { public String describeUndo() {
return "Re-Adding Centrifuge Recipe"; return "Re-Adding Centrifuge Recipe for " + output.getDisplayName();
} }
@Override @Override
@ -133,10 +134,10 @@ public class MTCentrifuge {
} }
private static class Remove implements IUndoableAction { private static class Remove implements IUndoableAction {
private final IIngredient output; private final ItemStack output;
List<CentrifugeRecipe> removedRecipes = new ArrayList<CentrifugeRecipe>(); List<CentrifugeRecipe> removedRecipes = new ArrayList<CentrifugeRecipe>();
public Remove(IIngredient output) { public Remove(ItemStack output) {
this.output = output; this.output = output;
} }
@ -144,7 +145,7 @@ public class MTCentrifuge {
public void apply() { public void apply() {
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.centrifugeRecipe)) { for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.centrifugeRecipe)) {
for (ItemStack stack : recipeType.getOutputs()) { for (ItemStack stack : recipeType.getOutputs()) {
if (output.matches(MineTweakerMC.getIItemStack(stack))) { if (ItemUtils.isItemEqual(stack, output, true, false)) {
removedRecipes.add((CentrifugeRecipe) recipeType); removedRecipes.add((CentrifugeRecipe) recipeType);
RecipeHandler.recipeList.remove(recipeType); RecipeHandler.recipeList.remove(recipeType);
break; break;
@ -167,12 +168,12 @@ public class MTCentrifuge {
@Override @Override
public String describe() { public String describe() {
return "Removing Centrifuge Recipe for "; return "Removing Centrifuge Recipe for " + output.getDisplayName();
} }
@Override @Override
public String describeUndo() { public String describeUndo() {
return "Re-Adding Centrifuge Recipe for "; return "Re-Adding Centrifuge Recipe for " + output.getDisplayName();
} }
@Override @Override

View file

@ -4,7 +4,6 @@ import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient; import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack; import minetweaker.api.item.IItemStack;
import minetweaker.api.minecraft.MineTweakerMC;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenMethod;
@ -68,14 +67,16 @@ public class MTChemicalReactor {
@ZenMethod @ZenMethod
public static void removeRecipe(IIngredient output) { public static void removeRecipe(IIngredient output) {
MineTweakerAPI.apply(new Remove(output)); for(IItemStack itemStack : output.getItems()){
MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(itemStack)));
}
} }
private static class Remove implements IUndoableAction { private static class Remove implements IUndoableAction {
private final IIngredient output; private final ItemStack output;
List<ChemicalReactorRecipe> removedRecipes = new ArrayList<ChemicalReactorRecipe>(); List<ChemicalReactorRecipe> removedRecipes = new ArrayList<ChemicalReactorRecipe>();
public Remove(IIngredient output) { public Remove(ItemStack output) {
this.output = output; this.output = output;
} }
@ -83,7 +84,7 @@ public class MTChemicalReactor {
public void apply() { public void apply() {
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.chemicalReactorRecipe)) { for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.chemicalReactorRecipe)) {
for (ItemStack stack : recipeType.getOutputs()) { for (ItemStack stack : recipeType.getOutputs()) {
if (output.matches(MineTweakerMC.getIItemStack(stack))) { if (ItemUtils.isItemEqual(stack, output, true, false)) {
removedRecipes.add((ChemicalReactorRecipe) recipeType); removedRecipes.add((ChemicalReactorRecipe) recipeType);
RecipeHandler.recipeList.remove(recipeType); RecipeHandler.recipeList.remove(recipeType);
break; break;
@ -106,12 +107,12 @@ public class MTChemicalReactor {
@Override @Override
public String describe() { public String describe() {
return "Removing Chemical Recipe"; return "Removing Chemical Recipe for " + output.getDisplayName();
} }
@Override @Override
public String describeUndo() { public String describeUndo() {
return "Re-Adding Chemical Recipe"; return "Re-Adding Chemical Recipe for " + output.getDisplayName();
} }
@Override @Override

View file

@ -5,7 +5,6 @@ import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient; import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack; import minetweaker.api.item.IItemStack;
import minetweaker.api.liquid.ILiquidStack; import minetweaker.api.liquid.ILiquidStack;
import minetweaker.api.minecraft.MineTweakerMC;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
@ -81,14 +80,16 @@ public class MTGrinder {
@ZenMethod @ZenMethod
public static void removeRecipe(IIngredient output) { public static void removeRecipe(IIngredient output) {
MineTweakerAPI.apply(new Remove(output)); for(IItemStack itemStack : output.getItems()){
MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(itemStack)));
}
} }
private static class Remove implements IUndoableAction { private static class Remove implements IUndoableAction {
private final IIngredient output; private final ItemStack output;
List<GrinderRecipe> removedRecipes = new ArrayList<GrinderRecipe>(); List<GrinderRecipe> removedRecipes = new ArrayList<GrinderRecipe>();
public Remove(IIngredient output) { public Remove(ItemStack output) {
this.output = output; this.output = output;
} }
@ -96,7 +97,7 @@ public class MTGrinder {
public void apply() { public void apply() {
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.grinderRecipe)) { for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.grinderRecipe)) {
for (ItemStack stack : recipeType.getOutputs()) { for (ItemStack stack : recipeType.getOutputs()) {
if (output.matches(MineTweakerMC.getIItemStack(stack))) { if (ItemUtils.isItemEqual(stack, output, true, false)) {
removedRecipes.add((GrinderRecipe) recipeType); removedRecipes.add((GrinderRecipe) recipeType);
RecipeHandler.recipeList.remove(recipeType); RecipeHandler.recipeList.remove(recipeType);
break; break;
@ -119,12 +120,12 @@ public class MTGrinder {
@Override @Override
public String describe() { public String describe() {
return "Removing Grinder Recipe"; return "Removing Grinder Recipe for " + output.getDisplayName();
} }
@Override @Override
public String describeUndo() { public String describeUndo() {
return "Re-Adding Grinder Recipe"; return "Re-Adding Grinder Recipe for " + output.getDisplayName();
} }
@Override @Override

View file

@ -4,7 +4,6 @@ import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient; import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack; import minetweaker.api.item.IItemStack;
import minetweaker.api.minecraft.MineTweakerMC;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenMethod;
@ -69,14 +68,16 @@ public class MTImplosionCompressor {
@ZenMethod @ZenMethod
public static void removeRecipe(IIngredient output) { public static void removeRecipe(IIngredient output) {
MineTweakerAPI.apply(new Remove(output)); for(IItemStack itemStack : output.getItems()){
MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(itemStack)));
}
} }
private static class Remove implements IUndoableAction { private static class Remove implements IUndoableAction {
private final IIngredient output; private final ItemStack output;
List<ImplosionCompressorRecipe> removedRecipes = new ArrayList<ImplosionCompressorRecipe>(); List<ImplosionCompressorRecipe> removedRecipes = new ArrayList<ImplosionCompressorRecipe>();
public Remove(IIngredient output) { public Remove(ItemStack output) {
this.output = output; this.output = output;
} }
@ -84,7 +85,7 @@ public class MTImplosionCompressor {
public void apply() { public void apply() {
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.implosionCompressorRecipe)) { for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.implosionCompressorRecipe)) {
for (ItemStack stack : recipeType.getOutputs()) { for (ItemStack stack : recipeType.getOutputs()) {
if (output.matches(MineTweakerMC.getIItemStack(stack))) { if (ItemUtils.isItemEqual(stack, output, true, false)) {
removedRecipes.add((ImplosionCompressorRecipe) recipeType); removedRecipes.add((ImplosionCompressorRecipe) recipeType);
RecipeHandler.recipeList.remove(recipeType); RecipeHandler.recipeList.remove(recipeType);
break; break;
@ -107,12 +108,12 @@ public class MTImplosionCompressor {
@Override @Override
public String describe() { public String describe() {
return "Removing Implosion Recipe"; return "Removing Implosion Recipe for " + output.getDisplayName();
} }
@Override @Override
public String describeUndo() { public String describeUndo() {
return "Re-Adding Implosion Recipe"; return "Re-Adding Implosion Recipe for " + output.getDisplayName();
} }
@Override @Override

View file

@ -4,7 +4,6 @@ import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient; import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack; import minetweaker.api.item.IItemStack;
import minetweaker.api.minecraft.MineTweakerMC;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenMethod;
@ -68,14 +67,16 @@ public class MTIndustrialElectrolyzer {
@ZenMethod @ZenMethod
public static void removeRecipe(IIngredient output) { public static void removeRecipe(IIngredient output) {
MineTweakerAPI.apply(new Remove(output)); for(IItemStack itemStack : output.getItems()){
MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(itemStack)));
}
} }
private static class Remove implements IUndoableAction { private static class Remove implements IUndoableAction {
private final IIngredient output; private final ItemStack output;
List<IndustrialElectrolyzerRecipe> removedRecipes = new ArrayList<IndustrialElectrolyzerRecipe>(); List<IndustrialElectrolyzerRecipe> removedRecipes = new ArrayList<IndustrialElectrolyzerRecipe>();
public Remove(IIngredient output) { public Remove(ItemStack output) {
this.output = output; this.output = output;
} }
@ -83,7 +84,7 @@ public class MTIndustrialElectrolyzer {
public void apply() { public void apply() {
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.industrialElectrolyzerRecipe)) { for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.industrialElectrolyzerRecipe)) {
for (ItemStack stack : recipeType.getOutputs()) { for (ItemStack stack : recipeType.getOutputs()) {
if (output.matches(MineTweakerMC.getIItemStack(stack))) { if (ItemUtils.isItemEqual(stack, output, true, false)) {
removedRecipes.add((IndustrialElectrolyzerRecipe) recipeType); removedRecipes.add((IndustrialElectrolyzerRecipe) recipeType);
RecipeHandler.recipeList.remove(recipeType); RecipeHandler.recipeList.remove(recipeType);
break; break;
@ -106,12 +107,12 @@ public class MTIndustrialElectrolyzer {
@Override @Override
public String describe() { public String describe() {
return "Removing IndustrialElectrolyzerRecipe"; return "Removing IndustrialElectrolyzerRecipe for " + output.getDisplayName();
} }
@Override @Override
public String describeUndo() { public String describeUndo() {
return "Re-Adding IndustrialElectrolyzerRecipe"; return "Re-Adding IndustrialElectrolyzerRecipe for " + output.getDisplayName();
} }
@Override @Override

View file

@ -5,7 +5,6 @@ import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient; import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack; import minetweaker.api.item.IItemStack;
import minetweaker.api.liquid.ILiquidStack; import minetweaker.api.liquid.ILiquidStack;
import minetweaker.api.minecraft.MineTweakerMC;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
@ -92,14 +91,16 @@ public class MTIndustrialSawmill {
@ZenMethod @ZenMethod
public static void removeRecipe(IIngredient output) { public static void removeRecipe(IIngredient output) {
MineTweakerAPI.apply(new Remove(output)); for(IItemStack itemStack : output.getItems()){
MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(itemStack)));
}
} }
private static class Remove implements IUndoableAction { private static class Remove implements IUndoableAction {
private final IIngredient output; private final ItemStack output;
List<IndustrialSawmillRecipe> removedRecipes = new ArrayList<IndustrialSawmillRecipe>(); List<IndustrialSawmillRecipe> removedRecipes = new ArrayList<IndustrialSawmillRecipe>();
public Remove(IIngredient output) { public Remove(ItemStack output) {
this.output = output; this.output = output;
} }
@ -107,7 +108,7 @@ public class MTIndustrialSawmill {
public void apply() { public void apply() {
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.industrialSawmillRecipe)) { for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.industrialSawmillRecipe)) {
for (ItemStack stack : recipeType.getOutputs()) { for (ItemStack stack : recipeType.getOutputs()) {
if (output.matches(MineTweakerMC.getIItemStack(stack))) { if (ItemUtils.isItemEqual(stack, output, true, false)) {
removedRecipes.add((IndustrialSawmillRecipe) recipeType); removedRecipes.add((IndustrialSawmillRecipe) recipeType);
RecipeHandler.recipeList.remove(recipeType); RecipeHandler.recipeList.remove(recipeType);
break; break;
@ -130,12 +131,12 @@ public class MTIndustrialSawmill {
@Override @Override
public String describe() { public String describe() {
return "Removing Sawmill Recipe"; return "Removing Sawmill Recipe for " + output.getDisplayName();
} }
@Override @Override
public String describeUndo() { public String describeUndo() {
return "Re-Adding Sawmill Recipe"; return "Re-Adding Sawmill Recipe for " + output.getDisplayName();
} }
@Override @Override

View file

@ -4,7 +4,6 @@ import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient; import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack; import minetweaker.api.item.IItemStack;
import minetweaker.api.minecraft.MineTweakerMC;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenMethod;
@ -67,14 +66,16 @@ public class MTPlateCuttingMachine {
@ZenMethod @ZenMethod
public static void removeRecipe(IIngredient output) { public static void removeRecipe(IIngredient output) {
MineTweakerAPI.apply(new Remove(output)); for(IItemStack itemStack : output.getItems()){
MineTweakerAPI.apply(new Remove(MinetweakerCompat.toStack(itemStack)));
}
} }
private static class Remove implements IUndoableAction { private static class Remove implements IUndoableAction {
private final IIngredient output; private final ItemStack output;
List<PlateCuttingMachineRecipe> removedRecipes = new ArrayList<PlateCuttingMachineRecipe>(); List<PlateCuttingMachineRecipe> removedRecipes = new ArrayList<PlateCuttingMachineRecipe>();
public Remove(IIngredient output) { public Remove(ItemStack output) {
this.output = output; this.output = output;
} }
@ -82,7 +83,7 @@ public class MTPlateCuttingMachine {
public void apply() { public void apply() {
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.plateCuttingMachineRecipe)) { for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.plateCuttingMachineRecipe)) {
for (ItemStack stack : recipeType.getOutputs()) { for (ItemStack stack : recipeType.getOutputs()) {
if (output.matches(MineTweakerMC.getIItemStack(stack))) { if (ItemUtils.isItemEqual(stack, output, true, false)) {
removedRecipes.add((PlateCuttingMachineRecipe) recipeType); removedRecipes.add((PlateCuttingMachineRecipe) recipeType);
RecipeHandler.recipeList.remove(recipeType); RecipeHandler.recipeList.remove(recipeType);
break; break;
@ -105,12 +106,12 @@ public class MTPlateCuttingMachine {
@Override @Override
public String describe() { public String describe() {
return "Removing PlateCuttingMachineRecipe"; return "Removing PlateCuttingMachineRecipe for " + output.getDisplayName();
} }
@Override @Override
public String describeUndo() { public String describeUndo() {
return "Re-Adding PlateCuttingMachineRecipe"; return "Re-Adding PlateCuttingMachineRecipe for " + output.getDisplayName();
} }
@Override @Override