Tutorial:Basic Recipes

From MineTweaker 3
Revision as of 15:53, 21 June 2014 by Stan (Talk) (Created page with "= Basic Recipes = The most basic modifications you can perform in MineTweaker are recipe addition and removal. As a little introduction, let's consider the recipe for sticks...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Basic Recipes

The most basic modifications you can perform in MineTweaker are recipe addition and removal.

As a little introduction, let's consider the recipe for sticks. In vanilla minecraft, it takes 2 wood planks to make 4 sticks, and they have to put above each other. But what if we want to change that? What if, say, we find it more logical to put the two wood block diagonally instead? (this stick is diagonal, right?)

Modifying the sticks recipe is wonderfully easy. Make a script with the following contents:

recipes.remove(<minecraft:stick>);
recipes.addShaped(<minecraft:stick> * 4, [[<minecraft:planks>, null], [null, <minecraft:planks>]]);

Open a new game (or reload scripts, if you are already in a game). Now take 2 oak wood planks and test your recipe.

It works? Great! But now you may have noticed a flaw in the recipe: if you put birch or spruce wood, it doesn't work!

Why doesn't it work? The "planks" item has subitems that are distinguished by not only the item name, but also by its meta value. By default, if you retrieve an item with the bracket syntax, MineTweaker assumes you want the item with meta value 0. And that's what it returned - the "oak planks" item. But we want an ingredient which essentially means "any kind of wood".

Luckily, this is easy to fix. When using the bracket syntax, besides the name, we can also define a meta value. For instance, <minecraft:planks:1> refers to spruce wood. We can also use the wildcard (*) to get an item meaning "any meta value is good": <minecraft:planks:*>.

Thus, change your recipe and reload:

recipes.remove(<minecraft:stick>);
recipes.addShaped(<minecraft:stick> * 4, [[<minecraft:planks:*>, null], [null, <minecraft:planks:*>]]);