How to Use MineTweaker 2

From Feed The Beast Wiki
Jump to: navigation, search

For MineTweaker 3, see the MineTweaker 3 Guide

Prerequisite[edit | edit source]

Before you can write any MineTweaker scripts, install MineTweaker first and create a "/scripts/" directory in the "/minecraft/" directory. This should be at the same level as the "/mods/" and "/config/" directories. All scripts are written in files with the ".zs" extension. The name of these files does not matter to the scripts or MineTweaker.

Basic Functions[edit | edit source]

Defining an Item/Block[edit | edit source]

Defining an item or block before you configure is very helpful in keeping your configuration file neat and organized. It isn't required, but it makes reading it later much easier and makes writing multiple recipes with the same components much simpler. You can use the Ore Dictionary to do this. Example:

Iron=oreDict.ingotIron;

This would set anything that uses the Ore Dictionary entry of "ingotIron", to be called later as Iron. You can also use IDs. Example:

Iron=<265>;

This would set Item ID 265 to the name, Iron, to be called later in the configuration. This also works with metadata. Example:

RedstoneChip=<19373:2>;

This would set the Item ID 19373:2 to the name, RedstoneChip, to be called later in the configuration. Finally, you can simply use what the item is named within a mod. Example:

IC2Circuit=item.ControlCircuit;

This would set "item.ContolCircuit" to the name, IC2Circuit, to be called later in the configuration.

Removing Recipes[edit | edit source]

Crafting Table[edit | edit source]

Removing Crafting Table recipes is very simple with MineTweaker. This must be done before adding recipes, typically. First, you must define the item or block in which you want to remove, as shown above.

recipes.remove(IC2Circuit);

This will remove all crafting recipes for the item, IC2Circuit, which is defined above. You can also use item IDs. Item IDs must be inside of angled brackets. Example:

recipes.remove(<265>);

This will remove the recipes for item ID 265. You can also use metadata. Item IDs and metadata must be inside of angled brackets. Example:

recipes.remove(<19373:2>);

This will remove the recipes for item ID 19373:2. You can also use the Ore Dictionary. Example:

recipes.remove(oreDict.ingotIron);

This will remove all recipes that create an item or block that uses the Ore Dictionary entry of ingotIron. You can also specify whether you wish to remove all Shaped recipes, or all Shapeless recipes. Item IDs and metadata must be inside of angled brackets. Example:

recipes.removeShaped(<265>);
recipes.removeShapeless(<19373:2>);

This will remove all Shaped recipes for ID 265, and all Shapeless recipes for 19373:2. You can use the Ore Dictionary, or the defined name as shown above. You can even remove a specific recipe. Example:

nuggetIron=oreDict.nuggetIron
recipes.removeShaped(Iron, [[nuggetIron, nuggetIron, nuggetIron], [nuggetIron, nuggetIron, nuggetIron], [nuggetIron, nuggetIron, nuggetIron]]);
recipes.removeShapeless(nuggetIron*9, [Iron]);

This code first defines the Iron Nugget as oreDict entry nuggetIron. Then, it removes the Shaped recipe for 9 Iron Nuggets = 1 Iron Ingot. Then, it removes the Shapeless recipe for 1 Iron Ingot = 9 Iron Nuggets. Note the usage of "*9".

Furnace[edit | edit source]

Removing Furnace recipes is as simple as removing Crafting Table recipes. All of the same rules apply, metadata, oreDict, IDs, and names are allowed. Example:

furnace.remove(Iron);

This will remove the furnace recipe for Iron, which is defined above. You can also specify which recipe to remove. Example:

furnace.remove(Iron, tile.oreIron);

This will remove the recipe for 1 Iron Ore = 1 Iron Ingot.

Adding Recipes[edit | edit source]

Crafting Table[edit | edit source]

Adding Crafting Table recipes with MineTweaker is very simple. All of the same rules apply: metadata, oreDict, IDs, and names are allowed. You must specify whether a recipe is Shaped or Shapeless. Item IDs and metadata must be inside of angled brackets. Example:

recipes.addShaped(Iron*8, [[nuggetIron, null, nuggetIron], [<19373:2>, <19373:2>, IC2Circuit], [null, null, null]];
recipes.addShapeless(nuggetIron*2, [tile.oreGold]);

This will add the following recipes:

You can also make recipes create damaged items. Example:

recipes.addShapeless(item.pickaxeWood.withDamage(1), [tile.oreGold]);
recipes.addShaped(item.pickaxeWood.withDamage(1), [[Iron, item.ingotGold, null]];

This adds two recipes, one Shaped, and one Shapeless. The Shapeless recipe means that a Gold Ore will create a damaged Wooden Pickaxe. The Shaped recipe means that an Iron Ingot to the left of a Gold Ingot in a Crafting Table will create a damaged Wooden Pickaxe. You can also make recipes use NBT tags, for enchantments, and other things that use NBT tags. Example:

silkPick = item.pickaxeWooden*1;
silkPick.tag = {
	"RepairCost":2
	"ench": [
		{ "id": 33 as short, "lvl": 1 as short }
	]
};
recipes.addShapeless(silkPick, [item.pickaxeWooden, item.netherStar]);

This code makes a Wooden Pickaxe and a Nether Star create a Wooden Pickaxe with the enchantment ID 33, or Silk Touch. This requires 1 level. The principle is the same for Shaped recipes.

Furnace[edit | edit source]

Adding Furnace recipes with MineTweaker is as simple as Crafting Table recipes, but not quite as flexible. All of the same rules apply: metadata, oreDict, IDs, and names are allowed.

furnace.addRecipe(Iron * 2, tile.oreGold);

This code adds a Furnace recipe of 1 Gold Ore = 2 Iron Ingots. You can also make the recipe give you experience. Example:

furnace.addRecipe(Iron * 2, tile.oreGold, 2.0);

This code adds the same recipe, only it gives you experience when you take it out of the furnace. You can also add and remove fuels. Example:

tile.oreGold.fuel = 20;
item.coal.fuel = 0;

This will add a furnace fuel of Gold Ore. It will burn for 20 ticks, or 1 second. It will then remove the fuel of Coal, by setting it to have 0 ticks.


You can find more information on how to use the different functions and options on the MineTweaker wiki.