Difference between revisions of "ModTweaker:Thaumcraft 4 Support:Research"

From MineTweaker 3
Jump to: navigation, search
Line 90: Line 90:
 
  #                  <IMG>thaumcraft:textures/gui/gui_researchbook.png:24:184:96:4:1.0</IMG>  <-- line break image as used in <LINE> above
 
  #                  <IMG>thaumcraft:textures/gui/gui_researchbook.png:24:184:96:4:1.0</IMG>  <-- line break image as used in <LINE> above
 
  #                  <IMG>thaumcraft:textures/items/alumentum.png:0:0:255:255:0.0625</IMG>    <-- alumentum item icon
 
  #                  <IMG>thaumcraft:textures/items/alumentum.png:0:0:255:255:0.0625</IMG>    <-- alumentum item icon
 +
 +
For adding pages displaying recipes, the following methods can be used.  Each one takes a Key and an ItemStack as an argument and will add a page displaying the first recipe for that item it can find.  Make sure to add a recipe for an item before trying to add a page for the recipe.
 +
 +
//Adds a normal crafting table recipe page
 +
addCraftingPage("WTFPLANTS", <minecraft:planks>);
 +
//Adds an arcane crafting table recipe page
 +
addArcanePage("WTFPLANTS", <Thaumcraft:WandRod>);
 +
//Adds a crucible recipe page
 +
addArcanePage("WTFPLANTS", <Thaumcraft:ItemResource:1>);
 +
//Adds an infusion recipe page
 +
addInfusionPage("WTFPLANTS", <Thaumcraft:WandRod:2>);
 +
 +
Infusion Enchanting pages can be added by supplying the key and the Enchantment ID.
 +
addEnchantmentPage("WTFPLANTS", 18);
  
 
{{ModTweakerNavigation}}
 
{{ModTweakerNavigation}}

Revision as of 12:23, 17 July 2014

The Basics

Each research is identified by a unique string called its Key. The general naming scheme is for the Key to be in all caps. Exceptions to this are wand parts, which tend to come in the ROD_blah or CAP_blahblah format. If you want to alter an existing research, you'll need to know its key.

Removing Research

Research can be removed with the removeResearch() method. However, if the research was used as prerequisite for anything, the Thaumonomicon will cause the game to crash when opened to that research's tab. You can use orphanResearch() to cut all ties to a research to make it safe to remove, or use clearPrereqs() to clear the prerequisites off of specific researches.

Example:

//ResearchKey
mods.thaumcraft.Research.orphanResearch("ROD_greatwood");
mods.thaumcraft.Research.removeResearch("ROD_greatwood");

Research Tabs

Each research tab is also identified with its own unique string. These are important to know if you want to remove a tab or place a new research in one.

Known Tab Keys:

* BASICS
* THAUMATURGY
* ALCHEMY
* ARTIFICE
* GOLEMANCY
* FORBIDDEN (Apocrypha)
* TT_CATEGORY (Thaumic Tinkering)
* TX (Thaumic Esoterica)
* RAILCRAFT (Traheremagy)

Removing Tabs

Removing a research tab also removes all research in the tab, which can cause crashes if they're prerequisites for anything. Use orphanResearch() to cut all ties to researches in the tab, move all researches to a different tab, or stick to removing small tabs with nothing in them like Traheremagy.

Example:

//TabKey
mods.thaumcraft.Research.removeTab("RAILCRAFT");

Creating Tabs

Creating a research tab requires a sprite to supply for the tab icon. You'll need the domain and file path for the texture. You'll also need to create a localization for the tab name either through a resource pack or by using ModTweaker's localization changer. The localization key will always be "tc.research_category." followed by the tab key.

For example, if you wanted a tab with the zombie brain icon from Thaumcraft 4:

//TabKey, Domain, Path
mods.thaumcraft.Research.addTab("DEMENTIA", "thaumcraft", "textures/items/brain.png");
mods.modtweaker.setLocalization("en_US", "tc.research_category.DEMENTIA", "Dementia");

Tabs can also be created with custom backgrounds if you supply a texture:

//TabKey, IconDomain, IconPath, BackgroundDomain, BackgroundPath
mods.thaumcraft.Research.addTab("AHPYRCOPA", "forbidden", "textures/items/spork.png", "forbidden", "textures/misc/runecircle.png");
mods.modtweaker.setLocalization("en_US", "tc.research_category.AHPYRCOPA", "Not Apocrypha");

Creating Research

Research is created with a unique Key, a research tab key, a list of aspects, coordinates, a complexity rating, and either a texture path or an ItemStack to give it an icon. Like with creating a research tab, creating a new research requires a new localization.

If a research is added through ModTweaker, its name is localized as "tc.research_name." followed by the research Key. Its tooltip is localized as "tc.research_text." followed by the Key.

Aspects are entered as a single string with a list of aspects and values separated by commas. If you plan on making a research auto-unlock, it's okay to leave it without aspects and just enter a null as the aspect list.

Aspect coordinates are different from standard mathematical coordinates. Decreasing Y moves the research up, while increasing Y moves it down. Increasing X moves the research further to the right as one would expect.

Example:

//ResearchKey, TabKey, AspectList, X, Y, Complexity, ItemStack
mods.thaumcraft.Research.addResearch("WTFPLANTS", "BASICS", "lucrum 100, alienis 200", 1, 0, 8, <minecraft:sapling>);
mods.modtweaker.setLocalization("en_US", "tc.research_name.WTFPLANTS", "Trees!");
mods.modtweaker.setLocalization("en_US", "tc.research_text.WTFPLANTS", "[MT] Science just doesn't know!");

Adding Pages to Research

Just creating the base research isn't enough. The base research starts out without pages and crashes the game if you try to open it. Once a research has been created, you can use addPage() to add new pages. Just entering the Key and a localization key will add a normal text page that can be filled in with localization.

Example:

//ResearchKey, LocalizationKey
mods.thaumcraft.Research.addPage("WTFPLANTS", "derp.research_page.WTFPLANTS");
mods.modtweaker.setLocalization("en_US", "derp.research_page.WTFPLANTS", "Plants! What are they?<BR>The Thaumometer doesn't know!");

When localizing text for research pages, the following markup can be used:

# Special formatting codes:
# <BR> or <BR/>         Paragraph break (<BR/> is included for people using XML for their localization)
# <LINE> or <LINE/>     Insert a fancy linebreak between sections of text.
# <IMG>...</IMG>  Insert a centered image into text. Parameters are separated by ':' and are:
#                    - mod resource location name
#                    - png file location (assumed to be a 256x256 texture, a sub-image will be grabbed from this png as specified below)
#                    - x location of sub-image in png
#                    - y location of sub-image in png
#                    - x size of sub-image (255 if full x size of png must be used)
#                    - y size of sub-image (255 if full y size of png must be used)
#                    - scaling - 1.0 for normal 256x256 images, or smaller for proportionately smaller .png files (a 16x16 image will be 0.0625)   
#               Examples: 
#                   <IMG>thaumcraft:textures/gui/gui_researchbook.png:24:184:96:4:1.0</IMG>   <-- line break image as used in <LINE> above
#                   <IMG>thaumcraft:textures/items/alumentum.png:0:0:255:255:0.0625</IMG>     <-- alumentum item icon

For adding pages displaying recipes, the following methods can be used. Each one takes a Key and an ItemStack as an argument and will add a page displaying the first recipe for that item it can find. Make sure to add a recipe for an item before trying to add a page for the recipe.

//Adds a normal crafting table recipe page
addCraftingPage("WTFPLANTS", <minecraft:planks>);
//Adds an arcane crafting table recipe page
addArcanePage("WTFPLANTS", <Thaumcraft:WandRod>);
//Adds a crucible recipe page
addArcanePage("WTFPLANTS", <Thaumcraft:ItemResource:1>);
//Adds an infusion recipe page
addInfusionPage("WTFPLANTS", <Thaumcraft:WandRod:2>);

Infusion Enchanting pages can be added by supplying the key and the Enchantment ID.

addEnchantmentPage("WTFPLANTS", 18);



ModTweaker Supported Mods

Applied Energistics 2 | Aura Cascade | Botania | Chisel 2 | Ex Nihilo | Extra Utilities | Factorization | Flaxbeard's Steam Power Support | Forestry | Mariculture | Mekanism | Metallurgy 4 | PneumaticCraft | Railcraft | Thaumcraft 4 | Thermal Expansion | Tinker's Construct