- Updated Mekanism jar
- Small fix for coke oven recipe adding
This commit is contained in:
parent
80f03ba32b
commit
9cda6d7450
Binary file not shown.
Binary file not shown.
|
@ -2,63 +2,108 @@ package modtweaker2.mods.railcraft.handlers;
|
|||
|
||||
import static modtweaker2.helpers.InputHelper.toFluid;
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
import static modtweaker2.helpers.StackHelper.areEqual;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import mods.railcraft.api.crafting.ICokeOvenRecipe;
|
||||
import mods.railcraft.common.util.crafting.CokeOvenCraftingManager;
|
||||
import mods.railcraft.common.util.crafting.CokeOvenCraftingManager.CokeOvenRecipe;
|
||||
import modtweaker2.mods.railcraft.RailcraftHelper;
|
||||
import modtweaker2.utils.BaseListAddition;
|
||||
import modtweaker2.utils.BaseListRemoval;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
@ZenClass("mods.railcraft.CokeOven")
|
||||
public class CokeOven {
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack input, boolean matchDamage, boolean matchNBT, IItemStack output, ILiquidStack fluidOutput, int cookTime) {
|
||||
MineTweakerAPI.apply(new Add(RailcraftHelper.getCokeOvenRecipe(toStack(input), matchDamage, matchNBT, toStack(output), toFluid(fluidOutput), cookTime)));
|
||||
}
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack input, boolean matchDamage, boolean matchNBT, IItemStack output, ILiquidStack fluidOutput, int cookTime) {
|
||||
MineTweakerAPI.apply(new Add(toStack(input), matchDamage, matchNBT, toStack(output), toFluid(fluidOutput), cookTime));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition {
|
||||
public Add(ICokeOvenRecipe recipe) {
|
||||
super("Coke Oven", RailcraftHelper.oven, recipe);
|
||||
}
|
||||
private static class Add implements IUndoableAction {
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return ((ICokeOvenRecipe) recipe).getOutput().getDisplayName();
|
||||
}
|
||||
}
|
||||
private ItemStack stack;
|
||||
private boolean matchDamage;
|
||||
private boolean matchNBT;
|
||||
private ItemStack stack2;
|
||||
private FluidStack fluid;
|
||||
private int cookTime;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
public Add(ItemStack stack, boolean matchDamage, boolean matchNBT, ItemStack stack2, FluidStack fluid, int cookTime) {
|
||||
this.stack = stack;
|
||||
this.matchDamage = matchDamage;
|
||||
this.matchNBT = matchNBT;
|
||||
this.stack2 = stack2;
|
||||
this.fluid = fluid;
|
||||
this.cookTime = cookTime;
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
MineTweakerAPI.apply(new Remove(toStack(output)));
|
||||
}
|
||||
@Override
|
||||
public void apply() {
|
||||
CokeOvenCraftingManager.getInstance().addRecipe(stack, matchDamage, matchNBT, stack2, fluid, cookTime);
|
||||
|
||||
private static class Remove extends BaseListRemoval {
|
||||
public Remove(ItemStack stack) {
|
||||
super("Coke Oven", RailcraftHelper.oven, stack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
for (ICokeOvenRecipe r : RailcraftHelper.oven) {
|
||||
if (r.getOutput() != null && areEqual(r.getOutput(), stack)) {
|
||||
recipe = r;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return false;
|
||||
}
|
||||
|
||||
RailcraftHelper.oven.remove(recipe);
|
||||
}
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Adding a Railcraft CokeOven recipie for " + stack.getUnlocalizedName() + " and " + stack2.getUnlocalizedName() + "to get " + fluid.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return stack.getDisplayName();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
MineTweakerAPI.apply(new Remove(toStack(output)));
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval {
|
||||
public Remove(ItemStack stack) {
|
||||
super("Coke Oven", RailcraftHelper.oven, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
for (ICokeOvenRecipe r : RailcraftHelper.oven) {
|
||||
if (r.getOutput() != null && r.getOutput().getItem().equals(stack)) {
|
||||
recipe = r;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
RailcraftHelper.oven.remove(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return stack.getDisplayName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue