diff --git a/src/main/java/modtweaker2/mods/tfcraft/TerraFirmaCraft.java b/src/main/java/modtweaker2/mods/tfcraft/TerraFirmaCraft.java
index f92388a..ad053d1 100644
--- a/src/main/java/modtweaker2/mods/tfcraft/TerraFirmaCraft.java
+++ b/src/main/java/modtweaker2/mods/tfcraft/TerraFirmaCraft.java
@@ -3,7 +3,9 @@ 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 {
@@ -11,7 +13,9 @@ 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);
}
}
diff --git a/src/main/java/modtweaker2/mods/tfcraft/handlers/Anvil.java b/src/main/java/modtweaker2/mods/tfcraft/handlers/Anvil.java
index b3e216b..e5a0b66 100644
--- a/src/main/java/modtweaker2/mods/tfcraft/handlers/Anvil.java
+++ b/src/main/java/modtweaker2/mods/tfcraft/handlers/Anvil.java
@@ -1,6 +1,7 @@
package modtweaker2.mods.tfcraft.handlers;
import static modtweaker2.helpers.InputHelper.toStack;
+import static com.bioxx.tfc.api.Crafting.AnvilReq.getReqFromInt;
import java.util.ArrayList;
@@ -16,20 +17,22 @@ 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 output, IItemStack input1, IItemStack input2, String plan, int value, boolean flux, int req){
+ 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 weld recipe, flux == true
+ * For parameter req:
1==copper;
2==bronze;
3==Wrought Iron;
+ * 4==Steel;
5==Black Steel;
6==Red Steel;
7==Blue Steel;
default is stone. */ @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)))); + 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 diff --git a/src/main/java/modtweaker2/mods/tfcraft/handlers/Heat.java b/src/main/java/modtweaker2/mods/tfcraft/handlers/Heat.java new file mode 100644 index 0000000..b9a5e4c --- /dev/null +++ b/src/main/java/modtweaker2/mods/tfcraft/handlers/Heat.java @@ -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; + } + + } + +} diff --git a/src/main/java/modtweaker2/mods/tfcraft/handlers/Loom.java b/src/main/java/modtweaker2/mods/tfcraft/handlers/Loom.java new file mode 100644 index 0000000..ff791a6 --- /dev/null +++ b/src/main/java/modtweaker2/mods/tfcraft/handlers/Loom.java @@ -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; + } + + } +}