Misc
This commit is contained in:
parent
97d3ee6b62
commit
7dc059e92f
Binary file not shown.
|
@ -1,133 +1,133 @@
|
|||
//package modtweaker2.mods.tconstruct.handlers;
|
||||
//
|
||||
//import static modtweaker2.helpers.InputHelper.toFluid;
|
||||
//import static modtweaker2.helpers.InputHelper.toIItemStack;
|
||||
//import static modtweaker2.helpers.InputHelper.toILiquidStack;
|
||||
//import static modtweaker2.helpers.InputHelper.toStack;
|
||||
//import static modtweaker2.helpers.StackHelper.matches;
|
||||
//
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.LinkedList;
|
||||
//import java.util.List;
|
||||
//
|
||||
//import minetweaker.MineTweakerAPI;
|
||||
//import minetweaker.api.item.IIngredient;
|
||||
//import minetweaker.api.item.IItemStack;
|
||||
//import minetweaker.api.item.IngredientAny;
|
||||
//import minetweaker.api.liquid.ILiquidStack;
|
||||
//import modtweaker2.helpers.LogHelper;
|
||||
//import modtweaker2.mods.tconstruct.TConstructHelper;
|
||||
//import modtweaker2.utils.BaseListAddition;
|
||||
//import modtweaker2.utils.BaseListRemoval;
|
||||
//import stanhebben.zenscript.annotations.Optional;
|
||||
//import stanhebben.zenscript.annotations.ZenClass;
|
||||
//import stanhebben.zenscript.annotations.ZenMethod;
|
||||
//import tconstruct.library.crafting.CastingRecipe;
|
||||
//
|
||||
//@ZenClass("mods.tconstruct.Casting")
|
||||
//public class Casting {
|
||||
//
|
||||
// protected static final String name = "TConstruct Casting";
|
||||
//
|
||||
// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// @ZenMethod
|
||||
// public static void addBasinRecipe(IItemStack output, ILiquidStack metal, @Optional IItemStack cast, @Optional boolean consume, int delay) {
|
||||
// if(metal == null || output == null) {
|
||||
// LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// MineTweakerAPI.apply(new Add(new CastingRecipe(toStack(output), toFluid(metal), toStack(cast), consume, delay, null), TConstructHelper.basinCasting));
|
||||
// }
|
||||
//
|
||||
// @ZenMethod
|
||||
// public static void addTableRecipe(IItemStack output, ILiquidStack metal, @Optional IItemStack cast, @Optional boolean consume, int delay) {
|
||||
// if(metal == null || output == null) {
|
||||
// LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// MineTweakerAPI.apply(new Add(new CastingRecipe(toStack(output), toFluid(metal), toStack(cast), consume, delay, null), TConstructHelper.tableCasting));
|
||||
// }
|
||||
//
|
||||
// //Passes the list to the base list implementation, and adds the recipe
|
||||
// private static class Add extends BaseListAddition<CastingRecipe> {
|
||||
// public Add(CastingRecipe recipe, ArrayList<CastingRecipe> list) {
|
||||
// super(Casting.name, list);
|
||||
//
|
||||
// this.recipes.add(recipe);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected String getRecipeInfo(CastingRecipe recipe) {
|
||||
// return LogHelper.getStackDescription(recipe.output);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// @ZenMethod
|
||||
// public static void removeTableRecipe(IIngredient output, @Optional IIngredient material, @Optional IIngredient cast) {
|
||||
// removeRecipe(output, material, cast, TConstructHelper.tableCasting);
|
||||
// }
|
||||
//
|
||||
// @ZenMethod
|
||||
// public static void removeBasinRecipe(IIngredient output, @Optional IIngredient material, @Optional IIngredient cast) {
|
||||
//
|
||||
// removeRecipe(output, material, cast, TConstructHelper.basinCasting);
|
||||
// }
|
||||
//
|
||||
// public static void removeRecipe(IIngredient output, IIngredient material, IIngredient cast, List<CastingRecipe> list) {
|
||||
// if(output == null) {
|
||||
// LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if(material == null) {
|
||||
// material = IngredientAny.INSTANCE;
|
||||
// }
|
||||
//
|
||||
// if(cast == null) {
|
||||
// cast = IngredientAny.INSTANCE;
|
||||
// }
|
||||
//
|
||||
// List<CastingRecipe> recipes = new LinkedList<CastingRecipe>();
|
||||
//
|
||||
// for(CastingRecipe recipe : list) {
|
||||
// if(recipe != null) {
|
||||
// if (!matches(output, toIItemStack(recipe.output))) {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// if (!matches(material, toILiquidStack(recipe.castingMetal))) {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// if(!matches(cast, toIItemStack(recipe.cast))) {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// recipes.add(recipe);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if(!recipes.isEmpty()) {
|
||||
// MineTweakerAPI.apply(new Remove(list, recipes));
|
||||
// } else {
|
||||
// LogHelper.logWarning(String.format("No %s Recipe found for output %s, material %s and cast %s. Command ignored!", Casting.name, output.toString(), material.toString(), cast.toString()));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Removes all matching recipes, apply is never the same for anything, so will always need to override it
|
||||
// private static class Remove extends BaseListRemoval<CastingRecipe> {
|
||||
// public Remove(List<CastingRecipe> list, List<CastingRecipe> recipes) {
|
||||
// super(Casting.name, list, recipes);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected String getRecipeInfo(CastingRecipe recipe) {
|
||||
// return LogHelper.getStackDescription(recipe.output);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
package modtweaker2.mods.tconstruct.handlers;
|
||||
|
||||
import static modtweaker2.helpers.InputHelper.toFluid;
|
||||
import static modtweaker2.helpers.InputHelper.toIItemStack;
|
||||
import static modtweaker2.helpers.InputHelper.toILiquidStack;
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
import static modtweaker2.helpers.StackHelper.matches;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.item.IngredientAny;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import modtweaker2.helpers.LogHelper;
|
||||
import modtweaker2.mods.tconstruct.TConstructHelper;
|
||||
import modtweaker2.utils.BaseListAddition;
|
||||
import modtweaker2.utils.BaseListRemoval;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import slimeknights.tconstruct.library.smeltery.CastingRecipe;
|
||||
|
||||
@ZenClass("mods.tconstruct.Casting")
|
||||
public class Casting {
|
||||
|
||||
protected static final String name = "TConstruct Casting";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void addBasinRecipe(IItemStack output, ILiquidStack metal, @Optional IItemStack cast, @Optional boolean consume, int delay) {
|
||||
if(metal == null || output == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
MineTweakerAPI.apply(new Add(new CastingRecipe(toStack(output), toFluid(metal), toStack(cast), consume, delay, null), TConstructHelper.basinCasting));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addTableRecipe(IItemStack output, ILiquidStack metal, @Optional IItemStack cast, @Optional boolean consume, int delay) {
|
||||
if(metal == null || output == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
MineTweakerAPI.apply(new Add(new CastingRecipe(toStack(output), toFluid(metal), toStack(cast), consume, delay, null), TConstructHelper.tableCasting));
|
||||
}
|
||||
|
||||
//Passes the list to the base list implementation, and adds the recipe
|
||||
private static class Add extends BaseListAddition<CastingRecipe> {
|
||||
public Add(CastingRecipe recipe, ArrayList<CastingRecipe> list) {
|
||||
super(Casting.name, list);
|
||||
|
||||
this.recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(CastingRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.output);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void removeTableRecipe(IIngredient output, @Optional IIngredient material, @Optional IIngredient cast) {
|
||||
removeRecipe(output, material, cast, TConstructHelper.tableCasting);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeBasinRecipe(IIngredient output, @Optional IIngredient material, @Optional IIngredient cast) {
|
||||
|
||||
removeRecipe(output, material, cast, TConstructHelper.basinCasting);
|
||||
}
|
||||
|
||||
public static void removeRecipe(IIngredient output, IIngredient material, IIngredient cast, List<CastingRecipe> list) {
|
||||
if(output == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
if(material == null) {
|
||||
material = IngredientAny.INSTANCE;
|
||||
}
|
||||
|
||||
if(cast == null) {
|
||||
cast = IngredientAny.INSTANCE;
|
||||
}
|
||||
|
||||
List<CastingRecipe> recipes = new LinkedList<CastingRecipe>();
|
||||
|
||||
for(CastingRecipe recipe : list) {
|
||||
if(recipe != null) {
|
||||
if (!matches(output, toIItemStack(recipe.output))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!matches(material, toILiquidStack(recipe.castingMetal))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!matches(cast, toIItemStack(recipe.cast))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(list, recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for output %s, material %s and cast %s. Command ignored!", Casting.name, output.toString(), material.toString(), cast.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
// Removes all matching recipes, apply is never the same for anything, so will always need to override it
|
||||
private static class Remove extends BaseListRemoval<CastingRecipe> {
|
||||
public Remove(List<CastingRecipe> list, List<CastingRecipe> recipes) {
|
||||
super(Casting.name, list, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(CastingRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.output);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,82 +1,81 @@
|
|||
//package modtweaker2.mods.tconstruct.handlers;
|
||||
//
|
||||
//import static modtweaker2.helpers.InputHelper.toIItemStack;
|
||||
//import static modtweaker2.helpers.InputHelper.toStack;
|
||||
//
|
||||
//import java.util.LinkedList;
|
||||
//import java.util.List;
|
||||
//
|
||||
//import minetweaker.MineTweakerAPI;
|
||||
//import minetweaker.api.item.IIngredient;
|
||||
//import minetweaker.api.item.IItemStack;
|
||||
//import modtweaker2.helpers.LogHelper;
|
||||
//import modtweaker2.mods.tconstruct.TConstructHelper;
|
||||
//import modtweaker2.utils.BaseListAddition;
|
||||
//import modtweaker2.utils.BaseListRemoval;
|
||||
//import stanhebben.zenscript.annotations.ZenClass;
|
||||
//import stanhebben.zenscript.annotations.ZenMethod;
|
||||
//import tconstruct.library.crafting.DryingRackRecipes;
|
||||
//import tconstruct.library.crafting.DryingRackRecipes.DryingRecipe;
|
||||
//
|
||||
//@ZenClass("mods.tconstruct.Drying")
|
||||
//public class Drying {
|
||||
//
|
||||
// protected static final String name = "TConstruct Drying Rack";
|
||||
//
|
||||
// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// @ZenMethod
|
||||
// public static void addRecipe(IItemStack input, IItemStack output, int time) {
|
||||
// if(input == null || output == null) {
|
||||
// LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// MineTweakerAPI.apply(new Add(TConstructHelper.getDryingRecipe(toStack(input), time, toStack(output))));
|
||||
// }
|
||||
//
|
||||
// //Passes the list to the base list implementation, and adds the recipe
|
||||
// private static class Add extends BaseListAddition<DryingRecipe> {
|
||||
// public Add(DryingRecipe recipe) {
|
||||
// super(Drying.name, DryingRackRecipes.recipes);
|
||||
// this.recipes.add(recipe);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected String getRecipeInfo(DryingRecipe recipe) {
|
||||
// return LogHelper.getStackDescription(recipe.result);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// //Removing a TConstruct Drying Rack recipe
|
||||
// @ZenMethod
|
||||
// public static void removeRecipe(IIngredient ingredient) {
|
||||
// List<DryingRecipe> recipes = new LinkedList<DryingRecipe>();
|
||||
//
|
||||
// for (DryingRecipe recipe : DryingRackRecipes.recipes) {
|
||||
// if (recipe != null && recipe.result != null && ingredient.matches(toIItemStack(recipe.result))) {
|
||||
// recipes.add(recipe);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if(!recipes.isEmpty()) {
|
||||
// MineTweakerAPI.apply(new Remove(recipes));
|
||||
// } else {
|
||||
// LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Drying.name, ingredient.toString()));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //Removes a recipe, apply is never the same for anything, so will always need to override it
|
||||
// private static class Remove extends BaseListRemoval<DryingRecipe> {
|
||||
// public Remove(List<DryingRecipe> list) {
|
||||
// super(Drying.name, DryingRackRecipes.recipes, list);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected String getRecipeInfo(DryingRecipe recipe) {
|
||||
// return LogHelper.getStackDescription(recipe.result);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
package modtweaker2.mods.tconstruct.handlers;
|
||||
|
||||
import static modtweaker2.helpers.InputHelper.toIItemStack;
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import modtweaker2.helpers.LogHelper;
|
||||
import modtweaker2.mods.tconstruct.TConstructHelper;
|
||||
import modtweaker2.utils.BaseListAddition;
|
||||
import modtweaker2.utils.BaseListRemoval;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import slimeknights.tconstruct.library.DryingRecipe;
|
||||
|
||||
@ZenClass("mods.tconstruct.Drying")
|
||||
public class Drying {
|
||||
|
||||
protected static final String name = "TConstruct Drying Rack";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack input, IItemStack output, int time) {
|
||||
if(input == null || output == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
MineTweakerAPI.apply(new Add(TConstructHelper.getDryingRecipe(toStack(input), time, toStack(output))));
|
||||
}
|
||||
|
||||
//Passes the list to the base list implementation, and adds the recipe
|
||||
private static class Add extends BaseListAddition<DryingRecipe> {
|
||||
public Add(DryingRecipe recipe) {
|
||||
super(Drying.name, DryingRackRecipes.recipes);
|
||||
this.recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(DryingRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.result);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//Removing a TConstruct Drying Rack recipe
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient ingredient) {
|
||||
List<DryingRecipe> recipes = new LinkedList<DryingRecipe>();
|
||||
|
||||
for (DryingRecipe recipe : DryingRackRecipes.recipes) {
|
||||
if (recipe != null && recipe.result != null && ingredient.matches(toIItemStack(recipe.result))) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Drying.name, ingredient.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
//Removes a recipe, apply is never the same for anything, so will always need to override it
|
||||
private static class Remove extends BaseListRemoval<DryingRecipe> {
|
||||
public Remove(List<DryingRecipe> list) {
|
||||
super(Drying.name, DryingRackRecipes.recipes, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(DryingRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue