mirror of
https://github.com/GTNewHorizons/ModTweaker.git
synced 2026-11-12 16:27:27 +00:00
Remove Terra Firma Craft Support
This commit is contained in:
1 parent
91498597cc
commit
05b7da8a7b
10 files changed
+6
-571
No files matched your search
@@ -22,7 +22,6 @@ import modtweaker2.mods.metallurgy.Metallurgy;
|
||||
import modtweaker2.mods.pneumaticcraft.PneumaticCraft;
|
||||
import modtweaker2.mods.railcraft.Railcraft;
|
||||
import modtweaker2.mods.tconstruct.TConstruct;
|
||||
import modtweaker2.mods.tfcraft.TerraFirmaCraft;
|
||||
import modtweaker2.mods.thaumcraft.Thaumcraft;
|
||||
import modtweaker2.mods.thermalexpansion.ThermalExpansion;
|
||||
import modtweaker2.proxy.CommonProxy;
|
||||
@@ -79,7 +78,6 @@ public class ModTweaker2 {
|
||||
TweakerPlugin.register("Railcraft", Railcraft.class);
|
||||
TweakerPlugin.register("Steamcraft", Steamcraft.class);
|
||||
TweakerPlugin.register("TConstruct", TConstruct.class);
|
||||
TweakerPlugin.register("terrafirmacraft", TerraFirmaCraft.class);
|
||||
TweakerPlugin.register("Thaumcraft", Thaumcraft.class);
|
||||
TweakerPlugin.register("ThermalExpansion", ThermalExpansion.class);
|
||||
TweakerPlugin.register("Forestry", Forestry.class);
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
package modtweaker2.mods.tfcraft;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.bioxx.tfc.api.Crafting.AnvilManager;
|
||||
import com.bioxx.tfc.api.Crafting.AnvilRecipe;
|
||||
import com.bioxx.tfc.api.Crafting.BarrelManager;
|
||||
import com.bioxx.tfc.api.Crafting.BarrelRecipe;
|
||||
import com.bioxx.tfc.api.Crafting.KilnCraftingManager;
|
||||
import com.bioxx.tfc.api.Crafting.KilnRecipe;
|
||||
import com.bioxx.tfc.api.Crafting.QuernManager;
|
||||
import com.bioxx.tfc.api.Crafting.QuernRecipe;
|
||||
|
||||
public class TFCHelper {
|
||||
|
||||
private TFCHelper(){}
|
||||
|
||||
public static List<AnvilRecipe> anvilRecipes = AnvilManager.getInstance().getRecipeList();
|
||||
public static List<AnvilRecipe> anvilWeldRecipes = AnvilManager.getInstance().getWeldRecipeList();
|
||||
public static List<BarrelRecipe> barrelRecipes = BarrelManager.getInstance().getRecipes();
|
||||
public static List<KilnRecipe> kilnRecipes = KilnCraftingManager.getInstance().getRecipeList();
|
||||
public static List<QuernRecipe> quernRecipes = QuernManager.getInstance().getRecipes();
|
||||
public static List<ItemStack> quernVaildItems = QuernManager.getInstance().getValidItems();
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package modtweaker2.mods.tfcraft;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import modtweaker2.mods.tfcraft.handlers.Anvil;
|
||||
import modtweaker2.mods.tfcraft.handlers.Barrel;
|
||||
import modtweaker2.mods.tfcraft.handlers.Heat;
|
||||
import modtweaker2.mods.tfcraft.handlers.Kiln;
|
||||
import modtweaker2.mods.tfcraft.handlers.Loom;
|
||||
import modtweaker2.mods.tfcraft.handlers.Quern;
|
||||
|
||||
public class TerraFirmaCraft {
|
||||
|
||||
public TerraFirmaCraft(){
|
||||
MineTweakerAPI.registerClass(Anvil.class);
|
||||
MineTweakerAPI.registerClass(Barrel.class);
|
||||
MineTweakerAPI.registerClass(Heat.class);
|
||||
MineTweakerAPI.registerClass(Kiln.class);
|
||||
MineTweakerAPI.registerClass(Loom.class);
|
||||
MineTweakerAPI.registerClass(Quern.class);
|
||||
}
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
package modtweaker2.mods.tfcraft.handlers;
|
||||
|
||||
import static com.bioxx.tfc.api.Crafting.AnvilReq.getReqFromInt;
|
||||
import static modtweaker2.helpers.InputHelper.toIItemStack;
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
import static modtweaker2.helpers.StackHelper.matches;
|
||||
|
||||
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.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")
|
||||
public class Anvil {
|
||||
|
||||
public static final String nameRegular = "TFC Anvil-Regular";
|
||||
public static final String nameWeld = "TFC Anvil-Weld";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void add(IItemStack input1, IItemStack input2, String plan, int value, boolean flux, int req, IItemStack output){
|
||||
addRecipe(nameRegular, TFCHelper.anvilRecipes, new AnvilRecipe(toStack(input1), toStack(input2), plan, value, flux, req, toStack(output)));
|
||||
}
|
||||
|
||||
/**
|
||||
* For parameter <code>req</code>:<p> 1==copper;<p> 2==bronze;<p> 3==Wrought Iron;<p>
|
||||
* 4==Steel;<p> 5==Black Steel;<p> 6==Red Steel;<p> 7==Blue Steel;<p> default is stone.
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addWeld(IItemStack input1, IItemStack input2, int req, IItemStack output){
|
||||
addRecipe(nameWeld, TFCHelper.anvilWeldRecipes, new AnvilRecipe(toStack(input1), toStack(input2), true, getReqFromInt(req), toStack(output)));
|
||||
}
|
||||
|
||||
public static void addRecipe(String name, List<AnvilRecipe> list, AnvilRecipe recipe) {
|
||||
List<AnvilRecipe> recipes = new LinkedList<AnvilRecipe>();
|
||||
recipes.add(recipe);
|
||||
MineTweakerAPI.apply(new Add(name, list, recipes));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<AnvilRecipe> {
|
||||
public Add(String name, List<AnvilRecipe> list, List<AnvilRecipe> recipes) {
|
||||
super(name, list, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(AnvilRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getCraftingResult());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void remove(IIngredient ingredient) {
|
||||
removeRecipe(nameRegular, TFCHelper.anvilRecipes, ingredient);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeWeld(IIngredient ingredient) {
|
||||
removeRecipe(nameWeld, TFCHelper.anvilWeldRecipes, ingredient);
|
||||
}
|
||||
|
||||
|
||||
public static void removeRecipe(String name, List<AnvilRecipe> list, IIngredient ingredient) {
|
||||
List<AnvilRecipe> recipes = new LinkedList<AnvilRecipe>();
|
||||
|
||||
for (AnvilRecipe recipe : AnvilManager.getInstance().getRecipeList()){
|
||||
if (recipe.getCraftingResult() != null && matches(ingredient, toIItemStack(recipe.getCraftingResult()))) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(name, list, recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipes found for %s. Command ignored.", name, ingredient.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<AnvilRecipe> {
|
||||
public Remove(String name, List<AnvilRecipe> list, List<AnvilRecipe> recipes){
|
||||
super(name, list, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(AnvilRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getCraftingResult());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
package modtweaker2.mods.tfcraft.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.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import modtweaker2.helpers.LogHelper;
|
||||
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.BarrelLiquidToLiquidRecipe;
|
||||
import com.bioxx.tfc.api.Crafting.BarrelManager;
|
||||
import com.bioxx.tfc.api.Crafting.BarrelRecipe;
|
||||
|
||||
@ZenClass("mods.tfcraft.Barrel")
|
||||
public class Barrel {
|
||||
|
||||
public static final String name = "TFC Barrel";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* @param outputFluid If you want this recipe consume fluid, <code>outputFluid=inputFluid</code>
|
||||
* @param time How long the recipe finished. Unit is TFC hour.
|
||||
* @param techLv Set to 0 if you want vessel to be able to use your new recipe, otherwise you will set to 1
|
||||
* @param removeFluid Set false if there is special need
|
||||
* @param allowAny By default it is <code>true</code>
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addSealed(IItemStack inputItem, ILiquidStack inputFluid, IItemStack outputItem, ILiquidStack outputFluid, int time, int techLv, boolean removeFluid, boolean allowAny){
|
||||
MineTweakerAPI.apply(new AddRecipe(new BarrelRecipe(toStack(inputItem), toFluid(inputFluid), toStack(outputItem), toFluid(outputFluid), time).setMinTechLevel(techLv).setRemovesLiquid(removeFluid).setAllowAnyStack(allowAny)));
|
||||
}
|
||||
|
||||
|
||||
@ZenMethod
|
||||
public static void addUnsealed(IItemStack inputItem, ILiquidStack inputFluid, IItemStack outputItem, ILiquidStack outputFluid, int techLv, boolean removeFluid, boolean allowAny){
|
||||
MineTweakerAPI.apply(new AddRecipe(new BarrelRecipe(toStack(inputItem), toFluid(inputFluid), toStack(outputItem), toFluid(outputFluid)).setSealedRecipe(false).setMinTechLevel(techLv).setRemovesLiquid(removeFluid).setAllowAnyStack(allowAny)));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param inputInBarrel The input fluid which is in barrel
|
||||
* @param input The input fluid which is in a fluid container, like a water bucket
|
||||
* @param output The output fluid
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void addFluidToFluid(ILiquidStack inputInBarrel, ILiquidStack input, ILiquidStack output){
|
||||
MineTweakerAPI.apply(new AddRecipe(new BarrelLiquidToLiquidRecipe(toFluid(inputInBarrel), toFluid(input), toFluid(output))));
|
||||
}
|
||||
|
||||
private static class AddRecipe extends BaseListAddition<BarrelRecipe> {
|
||||
public AddRecipe(BarrelRecipe recipe){
|
||||
super(Barrel.name, TFCHelper.barrelRecipes);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(BarrelRecipe recipe) {
|
||||
if(recipe.getRecipeOutIS() != null)
|
||||
return LogHelper.getStackDescription(recipe.getRecipeOutIS());
|
||||
else if(recipe.getRecipeOutFluid() != null)
|
||||
return LogHelper.getStackDescription(recipe.getRecipeOutFluid());
|
||||
else
|
||||
return "Unknown output";
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void remove(IIngredient output){
|
||||
List<BarrelRecipe> recipes = new LinkedList<BarrelRecipe>();
|
||||
|
||||
// Test for item outputs
|
||||
for (BarrelRecipe recipe : BarrelManager.getInstance().getRecipes()){
|
||||
if (recipe.getRecipeOutIS() != null && matches(output, toIItemStack(recipe.getRecipeOutIS()))) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
// Test for liquid outputs
|
||||
for (BarrelRecipe recipe : BarrelManager.getInstance().getRecipes()){
|
||||
if (recipe.getRecipeOutFluid() != null && matches(output, toILiquidStack(recipe.getRecipeOutFluid()))) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new RemoveRecipe(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Barrel.name, output.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class RemoveRecipe extends BaseListRemoval<BarrelRecipe> {
|
||||
public RemoveRecipe(List<BarrelRecipe> recipes){
|
||||
super(Barrel.name, TFCHelper.barrelRecipes, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(BarrelRecipe recipe) {
|
||||
if(recipe.getRecipeOutIS() != null)
|
||||
return LogHelper.getStackDescription(recipe.getRecipeOutIS());
|
||||
else if(recipe.getRecipeOutFluid() != null)
|
||||
return LogHelper.getStackDescription(recipe.getRecipeOutFluid());
|
||||
else
|
||||
return "Unknown output";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package modtweaker2.mods.tfcraft.handlers;
|
||||
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.OneWayAction;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import com.bioxx.tfc.api.HeatIndex;
|
||||
import com.bioxx.tfc.api.HeatRegistry;
|
||||
|
||||
@ZenClass("mods.tfcraft.Heat")
|
||||
public class Heat {
|
||||
|
||||
/**
|
||||
* To add custom recipe in firepit, use this.
|
||||
* @param input The input itemstack
|
||||
* @param sh "Specific Heat", which means the multiplier of increasing speed of temp (by default the speed is 1C/gametick)
|
||||
* @param mt "melt temperature"
|
||||
* @param output The output itemstack when the item reach the certain temperature
|
||||
* @see com.bioxx.tfc.Core.ItemHeat
|
||||
*/
|
||||
@ZenMethod
|
||||
public static void add(IItemStack input, double sh, double mt, IItemStack output){
|
||||
MineTweakerAPI.apply(new AddHeatIndex(toStack(input), sh, mt, toStack(output)));
|
||||
}
|
||||
|
||||
private static class AddHeatIndex extends OneWayAction{
|
||||
|
||||
ItemStack in, out;
|
||||
double sh, mt;
|
||||
|
||||
public AddHeatIndex(ItemStack in, double sh, double mt, ItemStack out){
|
||||
this.in = in;
|
||||
this.sh = sh;
|
||||
this.mt = mt;
|
||||
this.out = out;
|
||||
|
||||
this.apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
HeatRegistry.getInstance().addIndex(new HeatIndex(in, sh, mt, out));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Add custom heat index for firepit";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
package modtweaker2.mods.tfcraft.handlers;
|
||||
|
||||
import static modtweaker2.helpers.InputHelper.toIItemStack;
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
import static modtweaker2.helpers.StackHelper.matches;
|
||||
|
||||
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.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.KilnCraftingManager;
|
||||
import com.bioxx.tfc.api.Crafting.KilnRecipe;
|
||||
|
||||
@ZenClass("mods.tfcraft.Kiln")
|
||||
public class Kiln {
|
||||
|
||||
public static final String name = "TFC Kiln";
|
||||
|
||||
/** Deprecated, since pottery kiln will check <code>x instanceof ItemPotteryBase</code>
|
||||
* <p>If you have a such item, you might consider to use it
|
||||
*/
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
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<KilnRecipe> {
|
||||
public AddRecipe(KilnRecipe recipe) {
|
||||
super(Kiln.name, TFCHelper.kilnRecipes);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(KilnRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getCraftingResult());
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void remove(IIngredient output){
|
||||
List<KilnRecipe> recipes = new LinkedList<KilnRecipe>();
|
||||
|
||||
for (KilnRecipe recipe : KilnCraftingManager.getInstance().getRecipeList()){
|
||||
if (recipe.getCraftingResult() != null && matches(output, toIItemStack(recipe.getCraftingResult()))) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
MineTweakerAPI.apply(new RemoveRecipe(recipes));
|
||||
}
|
||||
|
||||
private static class RemoveRecipe extends BaseListRemoval<KilnRecipe> {
|
||||
public RemoveRecipe(List<KilnRecipe> recipes) {
|
||||
super(Kiln.name, TFCHelper.kilnRecipes, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(KilnRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getCraftingResult());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package modtweaker2.mods.tfcraft.handlers;
|
||||
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.OneWayAction;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import com.bioxx.tfc.api.Crafting.LoomManager;
|
||||
import com.bioxx.tfc.api.Crafting.LoomRecipe;
|
||||
|
||||
@ZenClass("mods.tfcraft.Loom")
|
||||
public class Loom {
|
||||
|
||||
//rl==resource location
|
||||
@ZenMethod
|
||||
public static void add(IItemStack input, IItemStack output, String rl){
|
||||
MineTweakerAPI.apply(new Add(toStack(input), toStack(output), new ResourceLocation(rl)));
|
||||
}
|
||||
|
||||
private static class Add extends OneWayAction{
|
||||
|
||||
ItemStack input, output;
|
||||
ResourceLocation location;
|
||||
|
||||
public Add(ItemStack input2, ItemStack output2, ResourceLocation location){
|
||||
this.input = input2;
|
||||
this.output = output2;
|
||||
this.location = location;
|
||||
|
||||
this.apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
LoomManager.getInstance().addRecipe(new LoomRecipe(input, output), location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Add loom recipe for " + output.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
package modtweaker2.mods.tfcraft.handlers;
|
||||
|
||||
import static modtweaker2.helpers.InputHelper.toIItemStack;
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
import static modtweaker2.helpers.StackHelper.matches;
|
||||
|
||||
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.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 {
|
||||
|
||||
public static final String name = "TFC Quern";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void add(IItemStack input, IItemStack output) {
|
||||
MineTweakerAPI.apply(new AddRecipe(new QuernRecipe(toStack(input), toStack(output))));
|
||||
}
|
||||
|
||||
private static class AddRecipe extends BaseListAddition<QuernRecipe> {
|
||||
public AddRecipe(QuernRecipe recipe) {
|
||||
super(Quern.name, TFCHelper.quernRecipes);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
super.apply();
|
||||
|
||||
for (QuernRecipe recipe : successful){
|
||||
TFCHelper.quernVaildItems.add(recipe.getInItem());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
for (QuernRecipe recipe : successful){
|
||||
TFCHelper.quernVaildItems.remove(recipe.getInItem());
|
||||
}
|
||||
|
||||
super.undo();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(QuernRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getResult());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void remove(IIngredient output) {
|
||||
List<QuernRecipe> recipes = new LinkedList<QuernRecipe>();
|
||||
|
||||
for (QuernRecipe recipe : QuernManager.getInstance().getRecipes()) {
|
||||
if (recipe != null && recipe.getResult() != null && matches(output, toIItemStack(recipe.getResult()))){
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
MineTweakerAPI.apply(new RemoveRecipe(recipes));
|
||||
}
|
||||
|
||||
private static class RemoveRecipe extends BaseListRemoval<QuernRecipe> {
|
||||
public RemoveRecipe(List<QuernRecipe> recipes) {
|
||||
super(Quern.name, TFCHelper.quernRecipes, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
for (QuernRecipe recipe : recipes) {
|
||||
TFCHelper.quernVaildItems.remove(recipe.getInItem());
|
||||
}
|
||||
|
||||
super.apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
super.undo();
|
||||
|
||||
for (QuernRecipe recipe : successful){
|
||||
TFCHelper.quernVaildItems.add(recipe.getInItem());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(QuernRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getResult());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user