Smeltery fix and various others

This commit is contained in:
jaredlll08 committed 2015-03-17 23:07:19 +02:00
1 parent 570e4f8607
commit 25feee0162
101 files changed
+2292 -1019

No files matched your search

@@ -0,0 +1,56 @@
package modtweaker2.utils;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import java.util.List;
import static modtweaker2.helpers.StackHelper.areEqual;
public abstract class BaseCraftingAddition extends BaseDescriptionAddition {
protected final List<IRecipe> list;
protected final boolean shapeless;
protected final ItemStack output;
protected final Object[] recipe;
public BaseCraftingAddition(String name, boolean shapeless, List list, ItemStack output, Object... recipe) {
super(name);
this.shapeless = shapeless;
this.output = output;
this.recipe = recipe;
this.list = list;
}
@Override
public void apply() {
if (shapeless) applyShapeless();
else applyShaped();
}
public abstract void applyShaped();
public abstract void applyShapeless();
@Override
public boolean canUndo() {
return list != null;
}
@Override
public void undo() {
IRecipe remove = null;
for (IRecipe recipe : list) {
if (recipe.getRecipeOutput() != null && areEqual(recipe.getRecipeOutput(), output)) {
remove = recipe;
break;
}
}
list.remove(remove);
}
@Override
public String getRecipeInfo() {
return output.getDisplayName();
}
}