Unify thaumcraft plates

This commit is contained in:
jchung01
2025-05-20 20:21:53 -07:00
parent e51f3aa8ba
commit e8aa75b05b
6 changed files with 168 additions and 14 deletions
+60
View File
@@ -0,0 +1,60 @@
#modloaded thaumcraft
#loader lateAddTC
import native.net.minecraft.item.ItemStack;
import native.thaumcraft.api.golems.parts.GolemMaterial;
import native.thaumcraft.api.golems.parts.GolemHead;
import native.thaumcraft.api.golems.parts.GolemLeg;
import crafttweaker.item.IItemStack;
/*
Unify plates visually shown in the golem press.
*/
var unifiedPlates = {
<thaumcraft:plate:0>: <techreborn:plates:18>, // brass
<thaumcraft:plate:1>: <thermalfoundation:material:32>, // iron
<bewitchment:silver_plate>: <thermalfoundation:material:322>, // silver
} as IItemStack[IItemStack];
# Materials
for material in GolemMaterial.getMaterials() {
if (isStackValid(material.componentBase)) {
var baseComponent as IItemStack = material.componentBase.wrapper;
material.componentBase = unifyStack(baseComponent, unifiedPlates);
}
}
# Head
for head in GolemHead.getHeads() {
var components = head.components;
for i in 0 to components.length {
var component = components[i];
if (component instanceof ItemStack && isStackValid(component as ItemStack)) {
var stack as IItemStack = (component as ItemStack).wrapper;
components[i] = unifyStack(stack, unifiedPlates);
}
}
}
# Leg
for leg in GolemLeg.getLegs() {
var components = leg.components;
for i in 0 to components.length {
var component = components[i];
if (component instanceof ItemStack && isStackValid(component as ItemStack)) {
var stack as IItemStack = (component as ItemStack).wrapper;
components[i] = unifyStack(stack, unifiedPlates);
}
}
}
function isStackValid(stack as ItemStack) as bool {
return !(isNull(stack) || stack.isEmpty());
}
function unifyStack(stackIn as ItemStack, unifiedDict as IItemStack[IItemStack]) as ItemStack {
var stack as IItemStack = stackIn.wrapper;
for original, unified in unifiedDict {
if (stack.anyAmount().matches(original)) {
return (unified * stack.amount).native;
}
}
return stackIn;
}
@@ -92,6 +92,19 @@ registerInfusionRecipeFromAddon(`${tcAdditions}:crystal_crusher`, "TAR_CRYSTAL_C
]
);
# Unify brass plates
registerInfusionRecipeFromAddon(`${tcAdditions}:crystal_bore`, "TAR_CRYSTAL_BORE",
<thaumadditions:crystal_bore>, 5,
[
<aspect:exitium> * 20, <aspect:terra> * 10, <aspect:perditio> * 30
],
<thaumcraft:morphic_resonator>,
[
<thaumcraft:stone_arcane>, <techreborn:plates:18>, <thaumcraft:stone_arcane>,
<techreborn:plates:18>, <thaumcraft:stone_arcane>, <thaumcraft:mechanism_complex>
]
);
/*
The same as Infusion.registerRecipe(), but allows a namespace in the resource location.
ModTweaker only allows infusion recipes with the "thaumcraft" namespace, this allows any namespace.