跳到正文
烈焰甘蔗Wiki

ResearchItem and ResearchPage

These are the core classes for defining research entries and their associated documentation/crafting pages in the Thaumonomicon.

ResearchItem

Package: thaumcraft.api.research

Defines a single research entry. Created via one of three constructors, then configured with builder-style setters, and finally registered by calling registerResearchItem().

Key Fields

Field Type Description
key String Unique identifier for this research
category String Key of the category this belongs to
tags AspectList Aspect costs required to complete the research
parents String[] Research keys that must be completed first (visible connection line)
parentsHidden String[] Same as parents, but no visible line in the Thaumonomicon
siblings String[] Research keys unlocked automatically when this is completed
displayColumn int Horizontal grid position
displayRow int Vertical grid position
icon_item ItemStack Item icon for this research
icon_resource ResourceLocation Texture-based icon for this research
itemTriggers ItemStack[] Items that may reveal hidden knowledge when scanned
entityTriggers String[] Entity names that may reveal hidden knowledge when scanned
aspectTriggers Aspect[] Aspects that may reveal hidden knowledge when studied
pages ResearchPage[] The pages displayed in the Thaumonomicon

Constructors

// Stub research (minimal, no position)
public ResearchItem(String key, String category)

// Full research with texture icon
public ResearchItem(String key, String category, AspectList tags, int col, int row, int complex, ResourceLocation icon)

// Full research with item icon
public ResearchItem(String key, String category, AspectList tags, int col, int row, int complex, ItemStack icon)

Flags

All flags return this for chaining.

Method Effect
setSpecial() Spiky border — marks important milestones
setRound() Circular icon border — passive/auto-unlock research
setSecondary() Can be purchased directly with RP in normal difficulty
setStub() Cannot be discovered normally; only via sibling unlocking
setVirtual() Completely hidden; recipes never show in Thaumonomicon
setConcealed() Hidden until parent research is discovered
setHidden() Discoverable only via scanning or knowledge fragments
setLost() Discoverable only via scanning (not fragments)
setAutoUnlock() Unlocks automatically for all players at game start

Setters

Method Parameter Description
setParents(String... par) Research keys Prerequisites with visible connecting line
setParentsHidden(String... par) Research keys Prerequisites with no connecting line
setSiblings(String... sib) Research keys Auto-unlocked when this research completes
setPages(ResearchPage... par) ResearchPage array Thaumonomicon pages for this entry
setItemTriggers(ItemStack... par) ItemStacks Items that may unlock hidden knowledge when scanned
setEntityTriggers(String... par) Entity names Entities that may unlock hidden knowledge when scanned
setAspectTriggers(Aspect... par) Aspects Aspects that may unlock hidden knowledge when studied
setComplexity(int complexity) 1–3 Size of the research grid (clamped)

Getters

Method Returns Description
getName() String Translated name via tc.research_name.<key>
getText() String Translated description via tc.research_text.<key>
getPages() ResearchPage[] The configured pages
getItemTriggers() ItemStack[] Item scan triggers
getEntityTriggers() String[] Entity scan triggers
getAspectTriggers() Aspect[] Aspect study triggers
getComplexity() int Grid size (1–3)
getResearchPrimaryTag() Aspect Aspect with highest tag value (used for scroll color)

Registration

public ResearchItem registerResearchItem()

Adds the item to ResearchCategories. Must be called after all configuration is complete. Returns this for chaining.


ResearchPage

Package: thaumcraft.api.research

Represents a single page in the Thaumonomicon for a ResearchItem. Different constructors create different page types.

PageType Enum

Value Description
TEXT Plain text page
TEXT_CONCEALED Text page only shown after a specific research is completed
IMAGE Image with caption
NORMAL_CRAFTING Vanilla crafting recipe
ARCANE_CRAFTING Arcane workbench recipe
CRUCIBLE_CRAFTING Crucible (alchemical) recipe
INFUSION_CRAFTING Infusion crafting recipe

⚠️ 已订正:原条目把 INFUSION_CRAFTING 描述为「Infusion enchantment recipe」——张冠李戴。 证据:research/ResearchPage.java:27-28,两者是两个独立枚举值: INFUSION_CRAFTING(对应 InfusionRecipe)与 INFUSION_ENCHANTMENT(对应 InfusionEnchantmentRecipe)。 下方构造器表本就正确(第 142-144 行),已据此订正本页描述表。 | INFUSION_ENCHANTMENT | Infusion enchantment on an item | | COMPOUND_CRAFTING | Multiple recipes displayed together | | ASPECTS | Aspect list display (internal use) | | SMELTING | Furnace smelting recipe |

Fields

Field Type Description
type PageType The page type
text String Text content or caption
research String Research key for concealed pages
image ResourceLocation Image texture
aspects AspectList Aspects to display
recipe Object Recipe object (IRecipe, CrucibleRecipe, InfusionRecipe, etc.)
recipeOutput ItemStack Output itemstack of the recipe

Constructors

Signature Page Type Notes
ResearchPage(String text) TEXT Text; may be a localization key
ResearchPage(String research, String text) TEXT_CONCEALED Only visible after player has research
ResearchPage(ResourceLocation image, String caption) IMAGE Image with caption
ResearchPage(IRecipe recipe) NORMAL_CRAFTING Single vanilla recipe
ResearchPage(IRecipe[] recipe) NORMAL_CRAFTING Multiple vanilla recipes
ResearchPage(IArcaneRecipe recipe) ARCANE_CRAFTING Single arcane recipe
ResearchPage(IArcaneRecipe[] recipe) ARCANE_CRAFTING Multiple arcane recipes
ResearchPage(CrucibleRecipe recipe) CRUCIBLE_CRAFTING Single crucible recipe
ResearchPage(CrucibleRecipe[] recipe) CRUCIBLE_CRAFTING Multiple crucible recipes
ResearchPage(InfusionRecipe recipe) INFUSION_CRAFTING Single infusion recipe
ResearchPage(InfusionRecipe[] recipe) INFUSION_CRAFTING Multiple infusion recipes
ResearchPage(InfusionEnchantmentRecipe recipe) INFUSION_ENCHANTMENT Infusion enchantment
ResearchPage(List recipe) COMPOUND_CRAFTING Compound crafting list
ResearchPage(ItemStack input) SMELTING Furnace recipe; output looked up automatically

Method

public String getTranslatedText()

Returns the localized text if text is a localization key, otherwise returns text as-is.

Example

new ResearchItem("MYMOD_ALCHEMY", "ALCHEMY",
    new AspectList().add(Aspect.WATER, 2).add(Aspect.FIRE, 2),
    2, 3, 1,
    new ItemStack(Items.blaze_powder))
.setParents("BASICS")
.setPages(
    new ResearchPage("research.mymod.alchemy.text"),
    new ResearchPage(new CrucibleRecipe(
        "MYMOD_RESEARCH",
        new ItemStack(Items.glowstone_dust),
        new ItemStack(Items.blaze_powder),
        new AspectList().add(Aspect.FIRE, 1)))
)
.registerResearchItem();

⚠️ 已订正:原示例里 new CrucibleRecipe(...) 只传了 3 个参数且顺序错误,无法编译。 真实构造器是 4 参数(证据:crafting/CrucibleRecipe.java 构造器,顺序为「研究键 → 产物 → 催化剂 → 元素标签」): CrucibleRecipe(String researchKey, ItemStack result, Object cat, AspectList tags)。 tags 是最后一个参数,不是第一个。已按正确签名改写。

另:ResearchPage 构造器表遗漏了 ResearchPage(AspectList as)(ASPECTS 类型页, 证据:research/ResearchPage.java:174-177,其 javadoc 明示「should really not be called directly」)。

ResearchItem Flags Summary

Flag Meaning
isSpecial Spiky border — major milestone
isRound Circular border — passive/auto research
isSecondary Purchasable with RP in normal mode
isStub Not auto-discoverable; only sibling-unlocked
isVirtual Completely hidden; recipes invisible
isConcealed Hidden until parent research complete
isHidden Found only via scan or fragments
isLost Found only via scanning
isAutoUnlock Unlocked for all players at world start
浏览全部模组