mirror of
https://github.com/GTNewHorizons/ModTweaker.git
synced 2026-11-18 19:49:08 +00:00
Smeltery fix and various others
This commit is contained in:
1 parent
570e4f8607
commit
25feee0162
101 files changed
+2292
-1019
No files matched your search
@@ -0,0 +1,81 @@
|
||||
package modtweaker2.utils;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class BaseListRemoval implements IUndoableAction {
|
||||
protected final String description;
|
||||
protected final List list;
|
||||
|
||||
protected final FluidStack fluid;
|
||||
protected final ItemStack stack;
|
||||
protected Object recipe;
|
||||
|
||||
public BaseListRemoval(String description, List list, ItemStack stack, FluidStack fluid) {
|
||||
this.list = list;
|
||||
this.stack = stack;
|
||||
this.description = description;
|
||||
this.fluid = fluid;
|
||||
}
|
||||
|
||||
public BaseListRemoval(String description, List list, ItemStack stack) {
|
||||
this(description, list, stack, null);
|
||||
}
|
||||
|
||||
public BaseListRemoval(String description, List list, FluidStack fluid) {
|
||||
this(description, list, null, fluid);
|
||||
}
|
||||
|
||||
public BaseListRemoval(List list, ItemStack stack) {
|
||||
this(null, list, stack);
|
||||
}
|
||||
|
||||
public BaseListRemoval(List list, FluidStack stack) {
|
||||
this(null, list, stack);
|
||||
}
|
||||
|
||||
public BaseListRemoval(String description, List list) {
|
||||
this(description, list, null, null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return list != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
list.add(recipe);
|
||||
}
|
||||
|
||||
public String getRecipeInfo() {
|
||||
return "Unknown Item";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
if (recipe instanceof ItemStack)
|
||||
return "Removing " + description + " Recipe for :" + ((ItemStack) recipe).getDisplayName();
|
||||
else if (recipe instanceof FluidStack)
|
||||
return "Removing " + description + " Recipe for :" + ((FluidStack) recipe).getFluid().getLocalizedName();
|
||||
else return "Removing " + description + " Recipe for :" + getRecipeInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
if (recipe instanceof ItemStack)
|
||||
return "Restoring " + description + " Recipe for :" + ((ItemStack) recipe).getDisplayName();
|
||||
else if (recipe instanceof FluidStack)
|
||||
return "Restoring " + description + " Recipe for :" + ((FluidStack) recipe).getFluid().getLocalizedName();
|
||||
else return "Restoring " + description + " Recipe for :" + getRecipeInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user