Unify thaumcraft plates in research rewards

This commit is contained in:
jchung01
2025-07-08 20:52:39 -07:00
parent dd5b82f2c1
commit 0da8ecd252
3 changed files with 49 additions and 20 deletions
+17 -1
View File
@@ -1,15 +1,20 @@
#modloaded thaumcraft
#loader lateAddTC
import native.net.minecraft.item.ItemStack;
import native.thaumcraft.api.research.ResearchCategories;
import native.thaumcraft.api.research.ResearchStage;
import crafttweaker.item.IItemStack;
import scripts.thaumcraft.Unifier;
/*
Hard-coded, non-JSON, research pages to replace crafting requirements for consume requirements.
Hard-coded, non-JSON, research pages to edit.
- Replaces crafting requirements for consume requirements.
This is so we can make these ingredients obtainable through non-crafting recipes,
but still make associated research completable.
- Unifies plates from rewards.
See config/thaumcraftfix/patches for research page changes that are JSON-based.
*/
@@ -41,6 +46,9 @@ convertCraftToConsume(t3SmelterStage, mithminitePlate);
var scytheStage = findCraftingStage("TAR_MITHMINITE_SCYTHE", mithminitePlate);
convertCraftToConsume(scytheStage, mithminitePlate);
# TC plate unification
convertRewardItems("TAR_CRYSTAL_CRUSHER", Unifier.unifiedPlates);
function findCraftingStage(researchName as string, targetItem as IItemStack) as ResearchStage {
var stages = ResearchCategories.getResearch(researchName).getStages();
for stage in stages {
@@ -80,3 +88,11 @@ function convertCraftToConsume(stage as ResearchStage, itemToConvert as IItemSta
stage.setObtain((consumed as ItemStack[]) + itemToConvert.native);
}
}
function convertRewardItems(researchName as string, itemsToReplace as IItemStack[IItemStack]) {
var rewards = ResearchCategories.getResearch(researchName).getRewardItem();
for i in 0 to rewards.length {
var reward = rewards[i];
rewards[i] = Unifier.unifyStack(reward, itemsToReplace);
}
}