Initial finishing remove function
Untested.
This commit is contained in:
parent
1729312f5c
commit
c993642aab
|
@ -2,13 +2,18 @@ package modtweaker2.mods.tfcraft.handlers;
|
|||
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import modtweaker2.mods.tfcraft.TFCHelper;
|
||||
import modtweaker2.utils.BaseListAddition;
|
||||
import modtweaker2.utils.BaseListRemoval;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import com.bioxx.tfc.api.Crafting.AnvilManager;
|
||||
import com.bioxx.tfc.api.Crafting.AnvilRecipe;
|
||||
|
||||
@ZenClass("mods.tfcraft.Anvil")
|
||||
|
@ -20,26 +25,71 @@ public class Anvil {
|
|||
}
|
||||
|
||||
/**
|
||||
* For weld recipe, flux == true, definitely.
|
||||
* For weld recipe, <code>flux == true</code>
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addWeld(IItemStack output, IItemStack input1, IItemStack input2, String plan, int value, int req){
|
||||
MineTweakerAPI.apply(new AddWeld(new AnvilRecipe(toStack(input1), toStack(input2), plan, value, true, req, toStack(output))));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void remove(IItemStack stack){
|
||||
MineTweakerAPI.apply(new Remove(toStack(stack)));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeWeld(IItemStack stack){
|
||||
MineTweakerAPI.apply(new RemoveWeld(toStack(stack)));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition{
|
||||
|
||||
public Add(AnvilRecipe recipe) {
|
||||
super("Anvil-Regular", TFCHelper.anvilRecipes, recipe);
|
||||
}
|
||||
}
|
||||
|
||||
private static class AddWeld extends BaseListAddition{
|
||||
|
||||
public AddWeld(AnvilRecipe recipe) {
|
||||
super("Anvil-Weld", TFCHelper.anvilWeldRecipes, recipe);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval{
|
||||
public Remove(ItemStack out){
|
||||
super("Anvil-Remove-Regular", TFCHelper.anvilRecipes, out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
ArrayList<AnvilRecipe> toRemove = new ArrayList<AnvilRecipe>();
|
||||
for (AnvilRecipe recipe : AnvilManager.getInstance().getRecipeList()){
|
||||
if (recipe.getCraftingResult() != null && recipe.getCraftingResult() == stack){
|
||||
toRemove.add(recipe);
|
||||
}
|
||||
}
|
||||
for (AnvilRecipe aRecipe : toRemove){
|
||||
TFCHelper.anvilRecipes.remove(aRecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class RemoveWeld extends BaseListRemoval{
|
||||
public RemoveWeld(ItemStack out){
|
||||
super("Anvil-Remove-Weld", TFCHelper.anvilWeldRecipes, out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
ArrayList<AnvilRecipe> toRemove = new ArrayList<AnvilRecipe>();
|
||||
for (AnvilRecipe recipe : AnvilManager.getInstance().getRecipeList()){
|
||||
if (recipe.getCraftingResult() != null && recipe.getCraftingResult() == stack){
|
||||
toRemove.add(recipe);
|
||||
}
|
||||
}
|
||||
for (AnvilRecipe aRecipe : toRemove){
|
||||
TFCHelper.anvilWeldRecipes.remove(aRecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,30 +1,78 @@
|
|||
package modtweaker2.mods.tfcraft.handlers;
|
||||
|
||||
import static modtweaker2.helpers.InputHelper.*;
|
||||
import static modtweaker2.helpers.InputHelper.toFluid;
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import modtweaker2.mods.tfcraft.TFCHelper;
|
||||
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;
|
||||
|
||||
import com.bioxx.tfc.api.Crafting.BarrelManager;
|
||||
import com.bioxx.tfc.api.Crafting.BarrelRecipe;
|
||||
|
||||
@ZenClass("mods.tfcraft.Barrel")
|
||||
public class Barrel {
|
||||
|
||||
/**
|
||||
* Note: by default the parameter <code>sealed</code> should be <code>true</code>, which is used by all TFCraft recipe.
|
||||
* <p>And, the parameter <code>time</code> uses the unit of "hour" in TFCraft.
|
||||
* @param techLv Set to 1 if you want vessel to be able to use your new recipe, otherwise you will set to 0.
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void add(IItemStack inputItem, ILiquidStack inputFluid, IItemStack outputItem, ILiquidStack outputFluid){
|
||||
BarrelRecipe aRecipe = new BarrelRecipe(toStack(inputItem), toFluid(inputFluid), toStack(outputItem), toFluid(outputFluid));
|
||||
MineTweakerAPI.apply(new AddRecipe(aRecipe));
|
||||
public static void add(IItemStack inputItem, ILiquidStack inputFluid, IItemStack outputItem, ILiquidStack outputFluid, int time, int techLv, boolean sealed){
|
||||
MineTweakerAPI.apply(new AddRecipe(new BarrelRecipe(toStack(inputItem), toFluid(inputFluid), toStack(outputItem), toFluid(outputFluid), time).setSealedRecipe(sealed).setMinTechLevel(techLv)));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void remove(IItemStack output){
|
||||
MineTweakerAPI.apply(new RemoveRecipe(toStack(output)));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void remove(ILiquidStack output){
|
||||
MineTweakerAPI.apply(new RemoveRecipe(toFluid(output)));
|
||||
}
|
||||
|
||||
private static class AddRecipe extends BaseListAddition{
|
||||
|
||||
public AddRecipe(BarrelRecipe recipe){
|
||||
super("Barrel-Basic", TFCHelper.barrelRecipes, recipe);
|
||||
super("Barrel", TFCHelper.barrelRecipes, recipe);
|
||||
}
|
||||
}
|
||||
|
||||
private static class RemoveRecipe extends BaseListRemoval{
|
||||
public RemoveRecipe(ItemStack stack){
|
||||
super("Barrel-Remove", TFCHelper.barrelRecipes, stack);
|
||||
}
|
||||
|
||||
public RemoveRecipe(FluidStack fluid){
|
||||
super("Barrel-Remove", TFCHelper.barrelRecipes, fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
ArrayList<BarrelRecipe> toRemove = new ArrayList<BarrelRecipe>();
|
||||
for (BarrelRecipe recipe : BarrelManager.getInstance().getRecipes()){
|
||||
if (recipe.getInItem() != null && recipe.getRecipeOutIS() == stack){
|
||||
toRemove.add(recipe);
|
||||
}
|
||||
}
|
||||
for (BarrelRecipe recipe : BarrelManager.getInstance().getRecipes()){
|
||||
if (recipe.getRecipeOutFluid() != null && recipe.getRecipeOutFluid() == fluid){
|
||||
toRemove.add(recipe);
|
||||
}
|
||||
}
|
||||
for (BarrelRecipe aRecipe : toRemove){
|
||||
TFCHelper.barrelRecipes.remove(aRecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,28 +1,57 @@
|
|||
package modtweaker2.mods.tfcraft.handlers;
|
||||
|
||||
import com.bioxx.tfc.api.Crafting.KilnRecipe;
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import modtweaker2.mods.tfcraft.TFCHelper;
|
||||
import modtweaker2.utils.BaseListAddition;
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
import modtweaker2.utils.BaseListRemoval;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import com.bioxx.tfc.api.Crafting.KilnCraftingManager;
|
||||
import com.bioxx.tfc.api.Crafting.KilnRecipe;
|
||||
|
||||
@ZenClass("mods.tfcraft.Kiln")
|
||||
public class Kiln {
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack input, int lv, IItemStack output){
|
||||
public static void add(IItemStack input, int lv, IItemStack output){
|
||||
MineTweakerAPI.apply(new AddRecipe(new KilnRecipe(toStack(input), lv, toStack(output))));
|
||||
}
|
||||
|
||||
private static class AddRecipe extends BaseListAddition{
|
||||
|
||||
@ZenMethod
|
||||
public static void remove(IItemStack stack){
|
||||
MineTweakerAPI.apply(new RemoveRecipe(toStack(stack)));
|
||||
}
|
||||
|
||||
private static class AddRecipe extends BaseListAddition{
|
||||
public AddRecipe(KilnRecipe recipe) {
|
||||
super("Kiln", TFCHelper.kilnRecipes, recipe);
|
||||
}
|
||||
}
|
||||
|
||||
private static class RemoveRecipe extends BaseListRemoval{
|
||||
public RemoveRecipe(ItemStack out){
|
||||
super("Kiln-Remove", TFCHelper.kilnRecipes, out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
ArrayList<KilnRecipe> toRemove = new ArrayList<KilnRecipe>();
|
||||
for (KilnRecipe recipe : KilnCraftingManager.getInstance().getRecipeList()){
|
||||
if (recipe.getCraftingResult() != null && recipe.getCraftingResult() == stack){
|
||||
toRemove.add(recipe);
|
||||
}
|
||||
}
|
||||
for (KilnRecipe aRecipe : toRemove){
|
||||
TFCHelper.kilnRecipes.remove(aRecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,35 +1,59 @@
|
|||
package modtweaker2.mods.tfcraft.handlers;
|
||||
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import modtweaker2.mods.tfcraft.TFCHelper;
|
||||
import modtweaker2.utils.BaseListAddition;
|
||||
import modtweaker2.utils.BaseListRemoval;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import com.bioxx.tfc.api.Crafting.QuernManager;
|
||||
import com.bioxx.tfc.api.Crafting.QuernRecipe;
|
||||
|
||||
@ZenClass("mods.tfcraft.Quern")
|
||||
public class Quern {
|
||||
|
||||
@ZenMethod
|
||||
public static void add(IItemStack output, IItemStack input) {
|
||||
public static void add(IItemStack input, IItemStack output) {
|
||||
MineTweakerAPI.apply(new AddRecipe(new QuernRecipe(toStack(input), toStack(output))));
|
||||
}
|
||||
|
||||
//@ZenMethod
|
||||
//public static void remove(IItemStack output, IItemStack input){
|
||||
// MineTweakerAPI.apply(new RemoveRecipe(input, output));
|
||||
//}
|
||||
@ZenMethod
|
||||
public static void remove(IItemStack input){
|
||||
MineTweakerAPI.apply(new RemoveRecipe(toStack(input)));
|
||||
}
|
||||
|
||||
private static class AddRecipe extends BaseListAddition{
|
||||
|
||||
public AddRecipe(QuernRecipe recipe) {
|
||||
super("Quern", TFCHelper.quernRecipes, recipe);
|
||||
TFCHelper.quernVaildItems.add(recipe.getInItem());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class RemoveRecipe extends BaseListRemoval{
|
||||
public RemoveRecipe(ItemStack stack) {
|
||||
super("Quern-Remove", TFCHelper.quernRecipes, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
ArrayList<QuernRecipe> toRemove = new ArrayList<QuernRecipe>();
|
||||
for (QuernRecipe recipe : QuernManager.getInstance().getRecipes()){
|
||||
if (recipe.getResult() !=null && recipe.getResult() == stack){
|
||||
toRemove.add(recipe);
|
||||
}
|
||||
}
|
||||
for (QuernRecipe aRecipe : toRemove){
|
||||
TFCHelper.quernRecipes.remove(aRecipe);
|
||||
TFCHelper.quernVaildItems.remove(aRecipe.getInItem());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue