Add loom and fire pit support

Also minor tweak
This commit is contained in:
3TUSK 2015-04-17 21:00:22 -04:00
parent a6d9ccc489
commit 726dda30c9
4 changed files with 125 additions and 4 deletions

View file

@ -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);
}
}

View file

@ -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, <code>flux == true</code>
* 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 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

View 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;
}
}
}

View 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;
}
}
}