Using CraftTweaker scripts to control the display of material pages in the Tinkers' Antique (Materials and You) book in Minecraft 1.12.2, linked with Game Stages
API
ZenScript class: mods.hiddenmaterials.MaterialStages
method
require(material, stage)
unlocks the stage before displaying the material (equivalent to writing only one stage's requireAll)
requireAll(material, stages...)
requires all stages to be owned simultaneously
requireAny(material, stages...)
requires any one stage to be owned
remove(material)
deletes the rules for this material
clear() deletes all rules
getAllMaterialNames()
returns all available material identifiers (String[]) for name lookup
getRules()
returns a readable snapshot of the current rules (String, one per line) for debugging
example
// 1) 解锁单个阶段后显示 ------------------------------------------------------
// 拥有 stage_iron 的玩家才会在书里看到铁
mods.hiddenmaterials.MaterialStages.require("tconstruct:iron", "stage_iron");
// 2) 需要同时拥有多个阶段 ----------------------------------------------------
// 需要同时拥有 stage_smeltery 与 stage_nether
mods.hiddenmaterials.MaterialStages.requireAll("cobalt", ["stage_smeltery", "stage_nether"]);
// 3) 任意一个阶段即可 --------------------------------------------------------
// stage_nether 或 stage_end 任意一个
mods.hiddenmaterials.MaterialStages.requireAny("manyullyn", "stage_nether", "stage_end");
// 4) 批量隐藏基础材料,随进度解锁 --------------------------------------------
val starterMaterials = [
"wood",
"stone",
"flint",
"bone",
"cactus",
"obsidian"
];
for material in starterMaterials {
mods.hiddenmaterials.MaterialStages.require(material, "stage_tinkers_start");
}
// 5) 移除 / 清空 -------------------------------------------------------------
// mods.hiddenmaterials.MaterialStages.remove("cobalt");
// mods.hiddenmaterials.MaterialStages.clear();
// 6) 调试:查看全部可用材料名与当前规则 --------------------------------------
// print(mods.hiddenmaterials.MaterialStages.getAllMaterialNames());
// print(mods.hiddenmaterials.MaterialStages.getRules());

