Minetweaker Support - pWn3d1337/Techguns GitHub Wiki

Minetweaker support

as of version 1.2_alphatest3 Techguns has support for minetweaker3.

Minetweaker support is not extensively tested, if you find bugs please report them. If you have questions, ask in the forum

IMPORTS: to use the short names like Fabricator.addRecipe(... instead of mods.techguns.Fabricator.addRecipe(.. you must import the classes, see the example file at the bottom LINK

Ammo Press:

Has 3 lists that state what items can be used in each input slot. Minetweaker's oredict entries work here.

Rules: Don't add the same item to two different lists, this won't work with automation

@ZenClass("mods.techguns.AmmoPress")
public class AmmoPressTweaker {

@ZenMethod
public static void addMetal1(IIngredient input){
	MineTweakerAPI.apply(new addInputAction(input, (byte)0));
}

@ZenMethod
public static void addMetal2(IIngredient input){
	MineTweakerAPI.apply(new addInputAction(input, (byte)1));
}

@ZenMethod
public static void addPowder(IIngredient input){
	MineTweakerAPI.apply(new addInputAction(input, (byte)2));
}

@ZenMethod
public static void removeMetal1(IIngredient input){
	MineTweakerAPI.apply(new removeInputAction(input, (byte)0));
}

@ZenMethod
public static void removeMetal2(IIngredient input){
	MineTweakerAPI.apply(new removeInputAction(input, (byte)1));
}

@ZenMethod
public static void removePowder(IIngredient input){
	MineTweakerAPI.apply(new removeInputAction(input, (byte)2));
}

Examples:

AmmoPress.addPowder(<ore:logWood>);
AmmoPress.removeMetal2(<ore:ingotIron>);

Metal Press

Has two inputs, that can either be an ItemStack or a String. A String is an oreDict name. The inputs do not have stacksizes, also a recipe should use both inputs. The output is an ItemStack with a stacksize. The boolean allowSwap parameter should be true except when both inputs are the same.

Recipes can be removed by just the output, or by inputs and output, only makes a difference if more than 1 recipe has the same output.

@ZenClass("mods.techguns.MetalPress")
public class MetalPressTweaker {

@ZenMethod
public static void addRecipe(IItemStack input1,IItemStack input2, IItemStack output, boolean allowSwap){
	MineTweakerAPI.apply(new addInputAction(TGMineTweakerHelper.toItemStackOreDict(input1),TGMineTweakerHelper.toItemStackOreDict(input2),allowSwap,output));
}
@ZenMethod
public static void addRecipe(String input1,IItemStack input2, IItemStack output, boolean allowSwap){
	MineTweakerAPI.apply(new addInputAction(TGMineTweakerHelper.toItemStackOreDict(input1),TGMineTweakerHelper.toItemStackOreDict(input2),allowSwap,output));
}
@ZenMethod
public static void addRecipe(IItemStack input1,String input2, IItemStack output, boolean allowSwap){
	MineTweakerAPI.apply(new addInputAction(TGMineTweakerHelper.toItemStackOreDict(input1),TGMineTweakerHelper.toItemStackOreDict(input2),allowSwap,output));
}
@ZenMethod
public static void addRecipe(String input1,String input2, IItemStack output, boolean allowSwap){
	MineTweakerAPI.apply(new addInputAction(TGMineTweakerHelper.toItemStackOreDict(input1),TGMineTweakerHelper.toItemStackOreDict(input2),allowSwap,output));
}


@ZenMethod
public static void removeRecipe(IItemStack output){
	MineTweakerAPI.apply(new removeInputAction((ItemStackOreDict)null,(ItemStackOreDict)null,output));
}

@ZenMethod
public static void removeRecipe(String input1,String input2, IItemStack output){
	MineTweakerAPI.apply(new removeInputAction(TGMineTweakerHelper.toItemStackOreDict(input1),TGMineTweakerHelper.toItemStackOreDict(input2),output));
}
@ZenMethod
public static void removeRecipe(IItemStack input1,String input2, IItemStack output){
	MineTweakerAPI.apply(new removeInputAction(TGMineTweakerHelper.toItemStackOreDict(input1),TGMineTweakerHelper.toItemStackOreDict(input2),output));
}
@ZenMethod
public static void removeRecipe(String input1,IItemStack input2, IItemStack output){
	MineTweakerAPI.apply(new removeInputAction(TGMineTweakerHelper.toItemStackOreDict(input1),TGMineTweakerHelper.toItemStackOreDict(input2),output));
}
@ZenMethod
public static void removeRecipe(IItemStack input1,IItemStack input2, IItemStack output){
	MineTweakerAPI.apply(new removeInputAction(TGMineTweakerHelper.toItemStackOreDict(input1),TGMineTweakerHelper.toItemStackOreDict(input2),output));
}

Examples:

MetalPress.addRecipe("logWood","logWood",<minecraft:planks> * 12,false);
MetalPress.addRecipe(<minecraft:gunpowder>,"blockGlass",<minecraft:planks>*3,true);

MetalPress.removeRecipe(<minecraft:gunpowder>,"blockGlass",<minecraft:planks>);

Charging Station

Very easy, just has one Input that can be String(OreDict name) or an ItemStack. Stacksize is not supported for the input. RFAmount is the total amount of RF required for charging, speed is dependant on RFAmount.

Recipe removal is per input, because input is deterministic, the same output could be produced by different inputs.

@ZenClass("mods.techguns.ChargingStation")
public class CharginStationTweaker {
	
@ZenMethod
public static void addRecipe(IItemStack input, IItemStack output, int RFAmount){
	MineTweakerAPI.apply(new addInputAction(new ItemStackOreDict(MineTweakerMC.getItemStack(input)), MineTweakerMC.getItemStack(output), RFAmount));
}

@ZenMethod
public static void addRecipe(String input, IItemStack output, int RFAmount){
	MineTweakerAPI.apply(new addInputAction(new ItemStackOreDict(input), MineTweakerMC.getItemStack(output), RFAmount));
}

@ZenMethod
public static void removeRecipe(IItemStack input){
	MineTweakerAPI.apply(new removeInputAction(new ItemStackOreDict(MineTweakerMC.getItemStack(input))));
}

@ZenMethod
public static void removeRecipe(String input){
	MineTweakerAPI.apply(new removeInputAction(new ItemStackOreDict(input)));
}

Examples:

ChargingStation.addRecipe(<minecraft:gunpowder>,<minecraft:redstone>,1000);
ChargingStation.addRecipe("logWood",<minecraft:nether_star>,100000);

//Removes recipe with input gunpowder
ChargingStation.removeRecipe("itemGunpowder");

ChemLab

Way more complex than the machines before. The chemlab supports stack sizes. They are passed as argument after the ItemStack or String. The stacksize of a passed ItemStack is ignored, the passed amount parameter overrides it. The output ItemStack may be null. The inputs don't work with null because minetweaker has problems selecting the correct method because null can't be resolved to a type. To indicate an empty (null) input, just pass an amount of 0 and any itemstack.

Rules

Input1 must not be empty (null). At least one output must exist (either liquid or ItemStack). AllowSwap should only be true if both inputs are !=null and have the same stacksize. Both inputs should also not be the same item. rfTick is the amount of RF per tick. A liquid with amount 0 (liquid:water*0) is equal to no liquid.

Recipe removal is per output Item and output Fluid. One of these two can be null.

@ZenClass("mods.techguns.ChemLab")
public class ChemLabTweaker {

@ZenMethod
public static void addRecipe(String input1,int amount1,String input2,int amount2, ILiquidStack fluidIn, boolean allowSwap, IItemStack output, ILiquidStack fluidOut, int rfTick){
	MineTweakerAPI.apply(new addInputAction(TGMineTweakerHelper.toItemStackOreDict(input1),amount1,TGMineTweakerHelper.toItemStackOreDict(input2),amount2,fluidIn,allowSwap,output, fluidOut,rfTick));
}

@ZenMethod
public static void addRecipe(IItemStack input1,int amount1,String input2,int amount2, ILiquidStack fluidIn, boolean allowSwap, IItemStack output, ILiquidStack fluidOut, int rfTick){
	MineTweakerAPI.apply(new addInputAction(TGMineTweakerHelper.toItemStackOreDict(input1),amount1,TGMineTweakerHelper.toItemStackOreDict(input2),amount2,fluidIn,allowSwap,output, fluidOut,rfTick));
}

@ZenMethod
public static void addRecipe(String input1,int amount1,IItemStack input2,int amount2, ILiquidStack fluidIn, boolean allowSwap, IItemStack output, ILiquidStack fluidOut, int rfTick){
	MineTweakerAPI.apply(new addInputAction(TGMineTweakerHelper.toItemStackOreDict(input1),amount1,TGMineTweakerHelper.toItemStackOreDict(input2),amount2,fluidIn,allowSwap,output, fluidOut,rfTick));
}

@ZenMethod
public static void addRecipe(IItemStack input1,int amount1,IItemStack input2,int amount2, ILiquidStack fluidIn, boolean allowSwap, IItemStack output, ILiquidStack fluidOut, int rfTick){
	MineTweakerAPI.apply(new addInputAction(TGMineTweakerHelper.toItemStackOreDict(input1),amount1,TGMineTweakerHelper.toItemStackOreDict(input2),amount2,fluidIn,allowSwap,output, fluidOut,rfTick));
}

@ZenMethod
public static void removeRecipe(IItemStack output, ILiquidStack fluidOut){
	MineTweakerAPI.apply(new removeInputAction(output, fluidOut));
}

Examples:

The stacksize of itemstacks for input is ignored, since stacksize is passed as seperate argument. minecraft:gunpowder*5,2, ... results in stacksize 2

When adding recipes, null is not valid, pass a stacksize of 0 of any item.

ChemLab.addRecipe(<minecraft:gunpowder>*5,2,<minecraft:planks>*3,1,<liquid:lava>*250,false,<minecraft:coal>*7,<liquid:water>*1000,17);

//pass dirt with stacksize of 0 (not the stacksize, but the amount parameter afterwards) to indicate no input, the output itemstack can be null
ChemLab.addRecipe(<minecraft:gunpowder>*5,2,<minecraft:dirt>,0,<liquid:lava>*250,false,null,<liquid:water>*1000,17);

//liquid amount of 0 indicates no output
ChemLab.addRecipe(<minecraft:redstone>*5,2,"logWood",1,<liquid:lava>*250,false,<minecraft:coal>*7,<liquid:water>*0,17);

//remove all recipe(s) producing oil and no item
ChemLab.removeRecipe(null,<liquid:oil>);

//remove all recipe(s) producing water and no item
ChemLab.removeRecipe(null,<liquid:water>);

//remove all recipe(s) producing leather and no fluid
ChemLab.removeRecipe(<minecraft:leather>,null);

Fabricator

Also very complex, it has 4 inputs that either ItemStack or String and 4 amounts. The amount parameter overrides the stacksizes of passed itemstacks.

Rules An item should only belong into one of the 4 slots. Therefore an item that is used in the wire slot should not be used in the plate slot in another recipe. This will destroy automation. There may be a warning in the minetweaker log if such a recipe is added, but not for the main input slot.

Input slots:

Main: ingots, any item

wire: wires, chipsets

powder: redstone, mechanical parts. Maybe glowstone, lapis, gunpowder would fit this slot. Also gears or screws or whatever.

plate: plates, plasticSheet

Be careful not to use an item in two different slots in different recipes.

@ZenClass("mods.techguns.Fabricator")
public class FabricatorTweaker {

@ZenMethod
public static void removeRecipe(IItemStack output){
	MineTweakerAPI.apply(new removeInputAction(output));
}

@ZenMethod
public static void addRecipe(IItemStack input,int amount,IItemStack wire,int amount_wire, IItemStack powder, int amount_powder, IItemStack plate, int amount_plate, IItemStack output){
MineTweakerAPI.apply(new addInputAction(
   TGMineTweakerHelper.toItemStackOreDict(input),amount,
   TGMineTweakerHelper.toItemStackOreDict(wire), amount_wire,
   TGMineTweakerHelper.toItemStackOreDict(powder), amount_powder,
   TGMineTweakerHelper.toItemStackOreDict(plate), amount_plate,
   output));
}
...
... Every Combination of String and IItemStack for the 4 inputs ...

Examples:

//stack size multipliers for inputs are ignored, only the passed amount counts, <minecraft:gunpowder>*5,1,... is stacksize 1
Fabricator.addRecipe(<minecraft:gunpowder>*5,1, <minecraft:planks>*5,3, <minecraft:coal:0>,1, "logWood",2, <minecraft:diamond>*2);

//causes a Warning in the log because redstone is used in a different slot.
Fabricator.addRecipe("ingotGold",1, "itemGunpowder",3, <minecraft:coal:0>,1, "dustRedstone",2, <minecraft:diamond>*2);
//remove rad emitter recipe
Fabricator.removeRecipe(<Techguns:TechgunsAmmo:108>);

Reaction Chamber

The input item is ItemStack/String and has no stacksize. The Liquid input parameter indicates the type, not the amount and should not be null. Outputs are passed as IItemStack[], up to size 4, see examples on how it's passed. (you must import IItemStack in the zenscript). The beamfocus must be a valid reaction beam focus, currently this should always be Techguns:TechgunsAmmo:98 which is the heatray.

Other parameters:

            byte ticks; //time of reaction in ReactionTicks, one ReactionTick is 3 seconds
	
	byte requiredCompletion; //Required completion level for success
	byte preferredIntensity; //[0-10]
	byte intensityMargin; //[0-10]
	byte liquidLevel; //[0-10] in Buckets

	short liquidConsumtion; // < LiquidLevel*1000; in milliBuckets
	float instability; //[0.0f-1.0f] chance to change preferredIntensity per ReactionTick

RiskType is an enum and passed as String, valid are: NONE, BREAK_ITEM, RAD_LOW, RAD_MEDIUM, RAD_HIGH, EXPLOSION_LOW, EXPLOSION_MEDIUM, EXPLOSION_HIGH, UNFORSEEN_CONSEQUENCES

For now this is not implemented and the machine will always break the item whem the recipe fails.

RFTick is the amount of RF needed for a reactionTick (every 3 seconds, so RF/gametick is 1/30 of that). The machine has a buffer of 1million RF, this is the maximum that can be used.

Recipe Removal is per input and fluid type.

@ZenClass("mods.techguns.ReactionChamber")
public class ReactionChamberTweaker {

@ZenMethod
public static void addRecipe(IItemStack input,ILiquidStack fluid, IItemStack[] outputs, IItemStack beamFocus, int ticks, int requiredCompletion,
		int preferredIntensity, int intensityMargin, int liquidLevel, int liquidConsumption, float instability, String risk, int RFTick){
	MineTweakerAPI.apply(new addInputAction(TGMineTweakerHelper.toItemStackOreDict(input),fluid,outputs,
			beamFocus,ticks,requiredCompletion,preferredIntensity,intensityMargin,
			liquidLevel, liquidConsumption, instability, risk, RFTick));
}

@ZenMethod
public static void addRecipe(String input,ILiquidStack fluid, IItemStack[] outputs, IItemStack beamFocus, int ticks, int requiredCompletion,
		int preferredIntensity, int intensityMargin, int liquidLevel, int liquidConsumption, float instability, String risk, int RFTick){
	MineTweakerAPI.apply(new addInputAction(TGMineTweakerHelper.toItemStackOreDict(input),fluid,outputs,
			beamFocus,ticks,requiredCompletion,preferredIntensity,intensityMargin,
			liquidLevel, liquidConsumption, instability, risk, RFTick));
}

@ZenMethod
public static void addRecipe(IItemStack input,ILiquidStack fluid, IItemStack output, IItemStack beamFocus, int ticks, int requiredCompletion,
		int preferredIntensity, int intensityMargin, int liquidLevel, int liquidConsumption, float instability, String risk, int RFTick){
	MineTweakerAPI.apply(new addInputAction(TGMineTweakerHelper.toItemStackOreDict(input),fluid,new IItemStack[]{output},
			beamFocus,ticks,requiredCompletion,preferredIntensity,intensityMargin,
			liquidLevel, liquidConsumption, instability, risk, RFTick));
}

@ZenMethod
public static void addRecipe(String input,ILiquidStack fluid, IItemStack output, IItemStack beamFocus, int ticks, int requiredCompletion,
		int preferredIntensity, int intensityMargin, int liquidLevel, int liquidConsumption, float instability, String risk, int RFTick){
	MineTweakerAPI.apply(new addInputAction(TGMineTweakerHelper.toItemStackOreDict(input),fluid,new IItemStack[]{output},
			beamFocus,ticks,requiredCompletion,preferredIntensity,intensityMargin,
			liquidLevel, liquidConsumption, instability, risk, RFTick));
}

@ZenMethod
public static void removeRecipe(IItemStack input, ILiquidStack fluid){
	MineTweakerAPI.apply(new removeInputAction(TGMineTweakerHelper.toItemStackOreDict(input), fluid));
}

@ZenMethod
public static void removeRecipe(String input, ILiquidStack fluid){
	MineTweakerAPI.apply(new removeInputAction(TGMineTweakerHelper.toItemStackOreDict(input), fluid));
}

Examples:

var outputs = [<minecraft:log>] as IItemStack[];
ReactionChamber.addRecipe(<minecraft:planks>,<liquid:water>,outputs,<Techguns:TechgunsAmmo:98>,5, 3, 7, 2, 4, 1000,0.0, "BREAK_ITEM", 25000);

ReactionChamber.removeRecipe(<minecraft:redstone_block>, <liquid:lava>);

Custom Ore Clusters

To be able to use custom ore clusters you must set "addCustomOreCluster" to true in the config under the general section. There are 16 available slots (metadata values) that can be set in the block type.

Id is the metadata to set the type for. MiningLevel is ore HardnessLevel between 1 and 3 currently. 0 is not valid. Common ores have 1, rare ores have 3. r,g,b is color between 0 and 1 to colorize the texture overlay. Texturetype is between 0 and 3. 0 is the IronOre cluster texure, 1 is the small parts textures (coal, lapis). 2 is shiny the gem texture (diamond). 3 is the oil texture. The multipliers are multipliers on output and power requirement for this type, the same as you can set them in the config file for the predefined types.

@ZenClass("mods.techguns.OreCluster")
public class OreClusterTweaker {

@ZenMethod
public static void addOreCluster(int id, IItemStack ore, int miningLevel, float r, float g, float b, int textureType, float multPower, float multAmount){
	MineTweakerAPI.apply(new addOreClusterType(id, ore, miningLevel, r, g, b, textureType, multPower, multAmount));
}

Example:

//Set metadata 0 to a Wood Planks ore clusters with shitty color
OreCluster.addOreCluster(0,<minecraft:planks>,1,0.4,0.4,0.0,3,0.5,2.5);

To spawn a custom ore cluster in the world use cofhcore world spawn. Wiki Page Use this block entry to indicate the block type.

"block": {"name": "Techguns:oreClusterCustom", "metadata": 0},

Example File

import mods.techguns.AmmoPress;
import mods.techguns.ChargingStation;
import mods.techguns.MetalPress;
import mods.techguns.ChemLab;
import mods.techguns.Fabricator;
import mods.techguns.ReactionChamber;
import mods.techguns.OreCluster;
import minetweaker.item.IItemStack;

AmmoPress.addPowder(<ore:logWood>);

AmmoPress.removeMetal2(<ore:ingotIron>);

ChargingStation.addRecipe(<minecraft:gunpowder>,<minecraft:redstone>,1000);
ChargingStation.addRecipe("logWood",<minecraft:nether_star>,100000);

ChargingStation.removeRecipe("itemGunpowder");

MetalPress.addRecipe("logWood","logWood",<minecraft:planks> * 12,false);
MetalPress.addRecipe(<minecraft:gunpowder>,"blockGlass",<minecraft:planks>*3,true);

MetalPress.removeRecipe(<minecraft:gunpowder>,"blockGlass",<minecraft:planks>);


ChemLab.addRecipe(<minecraft:gunpowder>*5,2,<minecraft:planks>*3,1,<liquid:lava>*250,false,<minecraft:coal>*7,<liquid:water>*1000,17);

ChemLab.addRecipe(<minecraft:gunpowder>*5,2,<minecraft:dirt>,0,<liquid:lava>*250,false,null,<liquid:water>*1000,17);

ChemLab.addRecipe(<minecraft:redstone>*5,2,"logWood",1,<liquid:lava>*250,false,<minecraft:coal>*7,<liquid:water>*0,17);

ChemLab.removeRecipe(null,<liquid:oil>);
ChemLab.removeRecipe(null,<liquid:water>);
ChemLab.removeRecipe(<minecraft:leather>,null);

Fabricator.addRecipe(<minecraft:gunpowder>*5,1, <minecraft:planks>*5,3, <minecraft:coal:0>,1, "logWood",2, <minecraft:diamond>*2);
Fabricator.addRecipe("ingotGold",1, "itemGunpowder",3, <minecraft:coal:0>,1, "dustRedstone",2, <minecraft:diamond>*2);

Fabricator.removeRecipe(<Techguns:TechgunsAmmo:108>);

var outputs = [<minecraft:log>] as IItemStack[];
ReactionChamber.addRecipe(<minecraft:planks>,<liquid:water>,outputs,<Techguns:TechgunsAmmo:98>,5, 3, 7, 2, 4, 1000,0.0, "BREAK_ITEM", 25000);

ReactionChamber.removeRecipe(<minecraft:redstone_block>, <liquid:lava>);


OreCluster.addOreCluster(0,<minecraft:planks>,1,0.4,0.4,0.0,3,0.5,2.5);
⚠️ **GitHub.com Fallback** ⚠️