Merge pull request #115 from 3TUSK/master
Add basic support for TerraFirmaCraft
This commit is contained in:
commit
c757841e06
BIN
libs/[1.7.10]TerraFirmaCraft-deobf-0.79.17.jar
Normal file
BIN
libs/[1.7.10]TerraFirmaCraft-deobf-0.79.17.jar
Normal file
Binary file not shown.
|
@ -16,6 +16,7 @@ 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.utils.TweakerPlugin;
|
||||
|
@ -63,6 +64,7 @@ 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);
|
||||
|
|
27
src/main/java/modtweaker2/mods/tfcraft/TFCHelper.java
Normal file
27
src/main/java/modtweaker2/mods/tfcraft/TFCHelper.java
Normal file
|
@ -0,0 +1,27 @@
|
|||
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();
|
||||
|
||||
}
|
21
src/main/java/modtweaker2/mods/tfcraft/TerraFirmaCraft.java
Normal file
21
src/main/java/modtweaker2/mods/tfcraft/TerraFirmaCraft.java
Normal file
|
@ -0,0 +1,21 @@
|
|||
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);
|
||||
}
|
||||
}
|
99
src/main/java/modtweaker2/mods/tfcraft/handlers/Anvil.java
Normal file
99
src/main/java/modtweaker2/mods/tfcraft/handlers/Anvil.java
Normal file
|
@ -0,0 +1,99 @@
|
|||
package modtweaker2.mods.tfcraft.handlers;
|
||||
|
||||
import static modtweaker2.helpers.StackHelper.areEqual;
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
import static com.bioxx.tfc.api.Crafting.AnvilReq.getReqFromInt;
|
||||
|
||||
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")
|
||||
public class Anvil {
|
||||
|
||||
@ZenMethod
|
||||
public static void add(IItemStack input1, IItemStack input2, String plan, int value, boolean flux, int req, IItemStack output){
|
||||
MineTweakerAPI.apply(new Add(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){
|
||||
MineTweakerAPI.apply(new AddWeld(new AnvilRecipe(toStack(input1), toStack(input2), true, getReqFromInt(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 && areEqual(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
99
src/main/java/modtweaker2/mods/tfcraft/handlers/Barrel.java
Normal file
99
src/main/java/modtweaker2/mods/tfcraft/handlers/Barrel.java
Normal file
|
@ -0,0 +1,99 @@
|
|||
package modtweaker2.mods.tfcraft.handlers;
|
||||
|
||||
import static modtweaker2.helpers.InputHelper.toFluid;
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
import static modtweaker2.helpers.StackHelper.areEqual;
|
||||
|
||||
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.BarrelLiquidToLiquidRecipe;
|
||||
import com.bioxx.tfc.api.Crafting.BarrelManager;
|
||||
import com.bioxx.tfc.api.Crafting.BarrelRecipe;
|
||||
|
||||
@ZenClass("mods.tfcraft.Barrel")
|
||||
public class 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))));
|
||||
}
|
||||
|
||||
@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", 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.getRecipeOutIS() != null && areEqual(recipe.getRecipeOutIS(), stack)){
|
||||
toRemove.add(recipe);
|
||||
}
|
||||
}
|
||||
for (BarrelRecipe recipe : BarrelManager.getInstance().getRecipes()){
|
||||
if (recipe.getRecipeOutFluid() != null && recipe.getRecipeOutFluid().isFluidEqual(fluid)){
|
||||
toRemove.add(recipe);
|
||||
}
|
||||
}
|
||||
for (BarrelRecipe aRecipe : toRemove){
|
||||
TFCHelper.barrelRecipes.remove(aRecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
61
src/main/java/modtweaker2/mods/tfcraft/handlers/Heat.java
Normal file
61
src/main/java/modtweaker2/mods/tfcraft/handlers/Heat.java
Normal file
|
@ -0,0 +1,61 @@
|
|||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
62
src/main/java/modtweaker2/mods/tfcraft/handlers/Kiln.java
Normal file
62
src/main/java/modtweaker2/mods/tfcraft/handlers/Kiln.java
Normal file
|
@ -0,0 +1,62 @@
|
|||
package modtweaker2.mods.tfcraft.handlers;
|
||||
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
import static modtweaker2.helpers.StackHelper.areEqual;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import modtweaker2.mods.tfcraft.TFCHelper;
|
||||
import modtweaker2.utils.BaseListAddition;
|
||||
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 {
|
||||
|
||||
/** 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))));
|
||||
}
|
||||
|
||||
@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 && areEqual(recipe.getCraftingResult(), stack)){
|
||||
toRemove.add(recipe);
|
||||
}
|
||||
}
|
||||
for (KilnRecipe aRecipe : toRemove){
|
||||
TFCHelper.kilnRecipes.remove(aRecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
53
src/main/java/modtweaker2/mods/tfcraft/handlers/Loom.java
Normal file
53
src/main/java/modtweaker2/mods/tfcraft/handlers/Loom.java
Normal file
|
@ -0,0 +1,53 @@
|
|||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
60
src/main/java/modtweaker2/mods/tfcraft/handlers/Quern.java
Normal file
60
src/main/java/modtweaker2/mods/tfcraft/handlers/Quern.java
Normal file
|
@ -0,0 +1,60 @@
|
|||
package modtweaker2.mods.tfcraft.handlers;
|
||||
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
import static modtweaker2.helpers.StackHelper.areEqual;
|
||||
|
||||
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 input, IItemStack output) {
|
||||
MineTweakerAPI.apply(new AddRecipe(new QuernRecipe(toStack(input), toStack(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 && areEqual(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