Difference between revisions of "Tutorial:Ore Dictionary"
(Created page with "= Ore Dictionary = Now that we've gotton our feet wet (you did follow the previous tutorials, right?), let's try this recipe: (IC2 required) val copper = <IC2:itemIngotCopp...") |
|||
Line 6: | Line 6: | ||
val tin = <IC2:itemIngotTin>; | val tin = <IC2:itemIngotTin>; | ||
val iron = <minecraft:iron_ingot>; | val iron = <minecraft:iron_ingot>; | ||
− | + | ||
// actually IC2 uses bronze and not copper. but that doesn't matter since this is just for demonstration | // actually IC2 uses bronze and not copper. but that doesn't matter since this is just for demonstration | ||
recipes.addShaped(<IC2:itemPartAlloy>, [[iron, iron, iron], [copper, copper, copper], [tin, tin, tin]]); | recipes.addShaped(<IC2:itemPartAlloy>, [[iron, iron, iron], [copper, copper, copper], [tin, tin, tin]]); | ||
Line 19: | Line 19: | ||
val tin = <ore:ingotTin>; | val tin = <ore:ingotTin>; | ||
val iron = <ore:ingotIron>; | val iron = <ore:ingotIron>; | ||
− | + | ||
// actually IC2 uses bronze and not copper. but that doesn't matter since this is just for demonstration | // actually IC2 uses bronze and not copper. but that doesn't matter since this is just for demonstration | ||
recipes.addShaped(<IC2:itemPartAlloy>, [[iron, iron, iron], [copper, copper, copper], [tin, tin, tin]]); | recipes.addShaped(<IC2:itemPartAlloy>, [[iron, iron, iron], [copper, copper, copper], [tin, tin, tin]]); | ||
Line 37: | Line 37: | ||
val iron = <ore:ingotIron>; | val iron = <ore:ingotIron>; | ||
iron.add(<minecraft:coal>); | iron.add(<minecraft:coal>); | ||
− | + | ||
// actually IC2 uses bronze and not copper. but that doesn't matter since this is just for demonstration | // actually IC2 uses bronze and not copper. but that doesn't matter since this is just for demonstration | ||
recipes.addShaped(<IC2:itemPartAlloy>, [[iron, iron, iron], [copper, copper, copper], [tin, tin, tin]]); | recipes.addShaped(<IC2:itemPartAlloy>, [[iron, iron, iron], [copper, copper, copper], [tin, tin, tin]]); | ||
Line 50: | Line 50: | ||
iron.add(<minecraft:coal>); | iron.add(<minecraft:coal>); | ||
iron.remove(<minecraft:iron_ingot>); | iron.remove(<minecraft:iron_ingot>); | ||
− | + | ||
// actually IC2 uses bronze and not copper. but that doesn't matter since this is just for demonstration | // actually IC2 uses bronze and not copper. but that doesn't matter since this is just for demonstration | ||
recipes.addShaped(<IC2:itemPartAlloy>, [[iron, iron, iron], [copper, copper, copper], [tin, tin, tin]]); | recipes.addShaped(<IC2:itemPartAlloy>, [[iron, iron, iron], [copper, copper, copper], [tin, tin, tin]]); |
Revision as of 19:59, 27 June 2014
Ore Dictionary
Now that we've gotton our feet wet (you did follow the previous tutorials, right?), let's try this recipe: (IC2 required)
val copper = <IC2:itemIngotCopper>; val tin = <IC2:itemIngotTin>; val iron = <minecraft:iron_ingot>; // actually IC2 uses bronze and not copper. but that doesn't matter since this is just for demonstration recipes.addShaped(<IC2:itemPartAlloy>, [[iron, iron, iron], [copper, copper, copper], [tin, tin, tin]]);
If you try the recipe, it's going to work... but not if you use the copper ingots from, say, Thermal Expansion or Tinkers Construct! The items are different!
Luckily, this issue exists for quite a while already and has been solved through the use of the ore dictionary. In essence, the ore dictionary groups items by their meaning and allows mods to add their own items to the ore dictionary. For instance, the copper ore dictionary is named <ore:ingotCopper>
.
These ore dictionary entries can be used in recipes easily:
val copper = <ore:ingotCopper>; val tin = <ore:ingotTin>; val iron = <ore:ingotIron>; // actually IC2 uses bronze and not copper. but that doesn't matter since this is just for demonstration recipes.addShaped(<IC2:itemPartAlloy>, [[iron, iron, iron], [copper, copper, copper], [tin, tin, tin]]);
... and that should fix it! Try installing a few mods that add copper ore, and all of their ingots should now be compatible.
The ore dictionary is used for more than just ores and ingots. Many ingredients have their own ore dictionary entry, allowing multiple substitutes for a specific ingredient.
Modifying the ore dictionary
Not satisfied with the contents that mods put into the ore dictionary? Did some mod forget to add an item to the proper entry? Or do you believe a certain ingredient substitute makes recicpes too cheap? MineTweaker makes it possible to alter the contents of the ore dictionary.
Once you retrieve an ore dictionary entry, you can modify it by adding or removing ores. Let's modify our script a bit:
val copper = <ore:ingotCopper>; val tin = <ore:ingotTin>; val iron = <ore:ingotIron>; iron.add(<minecraft:coal>); // actually IC2 uses bronze and not copper. but that doesn't matter since this is just for demonstration recipes.addShaped(<IC2:itemPartAlloy>, [[iron, iron, iron], [copper, copper, copper], [tin, tin, tin]]);
If you reload the scripts and check the recipe, you will notice that iron can now be substituted with coal.
Likewise, you could even remove iron from its entry:
val copper = <ore:ingotCopper>; val tin = <ore:ingotTin>; val iron = <ore:ingotIron>; iron.add(<minecraft:coal>); iron.remove(<minecraft:iron_ingot>); // actually IC2 uses bronze and not copper. but that doesn't matter since this is just for demonstration recipes.addShaped(<IC2:itemPartAlloy>, [[iron, iron, iron], [copper, copper, copper], [tin, tin, tin]]);
Now this ore dictionary modification may not be very useful, but it does illustrate how the ore dictionary can be modified easily.
If you ever come across a mod dictionary entry of which you believe they should both actually be the same, it's now possible to mirror ore dictionary entries:
<ore:ingotIron>.mirror(<ore:ingotTin>);
Now doing that will link iron to be the same as tin. Iron will then essentially be overridden by tin, and any changes made to tin will automatically reflect in iron.
Using ore entries in recipe removal
Ore dictionary entries can also be used to remove recipes containing ore entries, or as wildcard meaning "you can match any item in the ore entry". Note that an ore dictionary entry with a single item is considered equivalent to the item. (this in contrast with MineTweaker 2)