diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..85e7c1df --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/.idea/ diff --git a/config/ZenUtils.cfg b/config/ZenUtils.cfg index f5393897..2416aa02 100644 --- a/config/ZenUtils.cfg +++ b/config/ZenUtils.cfg @@ -1,8 +1,27 @@ # Configuration file general { + # Allow insertion of zs execution during mod loading stage + # Format: scriptLoaderName;modid;stageMarker;before|after + # Valid stage marker: C (Construction) H (Preinit) I (Init) J (Postinit) A (Available) + # Example: custom;mekanism;J;before -> runs `#loader custom` scripts before mekanism runs its code on post-initialization stage + # Note: + # 1. On construction stage and preinit stage before crafttweaker, only native methods are available + # 2. Many recipe modifications are staged. For example, scripts are loaded on init, but recipe modifications for crafting table and furnace are staged on postinit + # It means recipe modifications MAY NOT be executed after their loading stage + # ZenUtils will re-execute crafttweaker recipe modifications after all custom script load entrypoint on POSTINIT, but other crafttweaker addons not + S:customScriptEntrypoint < + lateAddTC;modtweaker;A;after + > + + # Enable mixinzs. Default: false B:enableMixin=true + + # Enable RandomTickEvent. It patches hotspot random tick code, which may produce performance loss. Do not enable it if you don't need it. Default: false B:enableRandomTickEvent=false + + # Enable fast script loading. Note: If enabled, ONLY PREPROCESSORS AT SCRIPT HEADER ARE EFFECTIVE. (except mixin scripts) Default: false + B:fastScriptLoading=false } diff --git a/config/thaumcraftfix/patches/thaumic_energistics.json b/config/thaumcraftfix/patches/thaumic_energistics.json new file mode 100644 index 00000000..243efcd2 --- /dev/null +++ b/config/thaumcraftfix/patches/thaumic_energistics.json @@ -0,0 +1,36 @@ +[ + { + "key": "ARCANEASSEMBLER", + "ops": [ + { + "op": "move", + "from": "stages/0/required_craft", + "path": "stages/0/required_item" + } + ] + }, + { + "key": "ARCANEINSCRIBER", + "ops": [ + { + "op": "move", + "from": "stages/0/required_craft", + "path": "stages/0/required_item" + } + ] + } + { + "key": "KNOWLEDGECORE", + "ops": [ + { + "op": "remove", + "path": "stages/0/required_craft" + }, + { + "op": "replace", + "path": "stages/0/required_item/0", + "value": "contenttweaker:complex_gearbox" + } + ] + } +] \ No newline at end of file diff --git a/config/unidict/UniDict.cfg b/config/unidict/UniDict.cfg index ff22e445..64eb5ad6 100644 --- a/config/unidict/UniDict.cfg +++ b/config/unidict/UniDict.cfg @@ -245,6 +245,7 @@ resources { minecraft:gold_ingot_from_block minecraft:gold_ingot_from_nuggets minecraft:gold_block + immersiveengineering:compat/plate_thaumium_brass > # Recipe names that you want to be removed. diff --git a/scripts/ThaumcraftGating.zs b/scripts/ThaumcraftGating.zs index 7f627614..0b1f7b82 100644 --- a/scripts/ThaumcraftGating.zs +++ b/scripts/ThaumcraftGating.zs @@ -66,14 +66,15 @@ recipes.addShaped(*4, [, .reuse(), ], [, , ]]); -// mods.thaumcraft.ArcaneWorkbench.removeRecipe(); - recipes.removeShaped(); recipes.removeShaped(); -// recipes.removeShaped(); -// recipes.removeShaped(); -// recipes.removeShaped(); - +# See scripts/thaumcraft/research/LateResearch.zs for related research adjustments +recipes.removeShaped(); +recipes.removeShaped(); +recipes.removeShaped(); +# See config/thaumcraftfix/patches/thaumic_energistics.json for related research adjustments +mods.thaumcraft.ArcaneWorkbench.removeRecipe(); +mods.thaumcraft.ArcaneWorkbench.removeRecipe(); mods.thaumcraft.Infusion.removeRecipe(); val arcaneassembler = RecipeBuilder.newBuilder("arcaneassemblerinf","arcane_autoinfuser",120); @@ -92,8 +93,6 @@ arcaneassembler.addItemInput(); arcaneassembler.addItemOutput(); arcaneassembler.build(); -mods.thaumcraft.ArcaneWorkbench.removeRecipe(); - mods.thaumcraft.Crucible.registerRecipe("easierseal1", "", , , [*20,*10]); mods.thaumcraft.Crucible.registerRecipe("easierseal2", "", , , [*20,*10]); mods.thaumcraft.Crucible.registerRecipe("easierseal3", "", , , [*20,*10]); @@ -108,53 +107,6 @@ mods.thaumcraft.Infusion.registerRecipe("infuseshimmerleaf", "", , [, , , ]); - -mods.thaumcraft.Infusion.removeRecipe(); - -mods.thaumcraft.Infusion.registerRecipe("infkamichest", "", -, 10, -[*250,*150,*125,*125,*125,*60], -, -[, , - , , - , , - , , - , , - , ]); - -mods.thaumcraft.Infusion.registerRecipe("infkamiboots", "", -, 10, -[*250,*150,*125,*125,*125,*60], -, -[, , - , , - , , - , , - , , - , ]); - - mods.thaumcraft.Infusion.registerRecipe("infkamilegs", "", -, 10, -[*250,*150,*125,*125,*125,*60], -, -[, , - , , - , , - .withTag({Potion: "minecraft:fire_resistance"}), , - , , - , ]); - - mods.thaumcraft.Infusion.registerRecipe("infkamihelm", "", -, 10, -[*250,*150,*125,*125,*125,*60], -, -[, , - , , - , , - .withTag({Potion: "minecraft:night_vision"}), , - , , - , ]); - recipes.addShaped(, [[null, , null], [, , ], diff --git a/scripts/TheGreatOreCleanse.zs b/scripts/TheGreatOreCleanse.zs index 7b409c3c..9e195233 100644 --- a/scripts/TheGreatOreCleanse.zs +++ b/scripts/TheGreatOreCleanse.zs @@ -45,12 +45,15 @@ recipes.addShapeless(*9, []); val brassplate = ; brassplate.remove(); +brassplate.remove(); + +recipes.removeByRecipeName("thaumcraft:brassplate"); mods.immersiveengineering.MetalPress.removeRecipe(); mods.immersiveengineering.MetalPress.addRecipe(, , , 2000); -recipes.removeShapeless(, [], true); -recipes.addShapeless(, +recipes.removeShapeless(, [], true); +recipes.addShapeless("plate_brass_ie", , [, ]); @@ -68,8 +71,6 @@ recipes.addShaped(, mods.immersiveengineering.ArcFurnace.removeRecipe(); mods.immersiveengineering.ArcFurnace.addRecipe(, , null, 100, 512, [*3]); mods.immersiveengineering.ArcFurnace.addRecipe(, , null, 100, 512, [*3]); -mods.immersiveengineering.ArcFurnace.addRecipe(, , null, 100, 512, [*3]); -mods.immersiveengineering.ArcFurnace.addRecipe(, , null, 100, 512, [*3]); //================================================================== @@ -286,11 +287,13 @@ silverplate.remove(); silverplate.remove(); silverplate.remove(); +recipes.removeByRecipeName("bewitchment:compat/silver_plate"); + mods.immersiveengineering.MetalPress.removeRecipe(); mods.immersiveengineering.MetalPress.addRecipe(, , , 2000); recipes.removeShapeless(, [], true); -recipes.addShapeless(, +recipes.addShapeless("plate_silver_ie", , [, ]); @@ -691,26 +694,20 @@ irondust.remove(); val ironplate = ; ironplate.remove(); ironplate.remove(); +// ironplate.remove(); ironplate.remove(); ironplate.remove(); -recipes.remove(); -recipes.addShaped(*3, -[[,,]]); +recipes.removeByRecipeName("thaumcraft:ironplate"); mods.immersiveengineering.MetalPress.removeRecipe(); mods.immersiveengineering.MetalPress.addRecipe(, , , 2000); recipes.removeShapeless(, [], true); -recipes.addShapeless(, +recipes.addShapeless("plate_iron_ie", , [, ]); -recipes.addShapeless(*3, -[, -, -]); - mods.immersiveengineering.Crusher.removeRecipe(); mods.immersiveengineering.Crusher.addRecipe(*2, , 2048, , 0.1); mods.immersiveengineering.Crusher.addRecipe(, , 2048); diff --git a/scripts/ToolTips.zs b/scripts/ToolTips.zs index ce97a298..13526270 100644 --- a/scripts/ToolTips.zs +++ b/scripts/ToolTips.zs @@ -1192,10 +1192,6 @@ .addTooltip(format.red("Use inside the Recursion Prison Key Dungeon")); .addTooltip(format.red("Use inside the Recursion Prison Key Dungeon")); -.addTooltip(format.red("If you want to complete the Thaumonomicon entries that require plates, make sure you craft them, making them in a compactor won't work")); -.addTooltip(format.red("If you want to complete the Thaumonomicon entries that require plates, make sure you craft them, making them in a compactor won't work")); -.addTooltip(format.red("If you want to complete the Thaumonomicon entries that require plates, make sure you craft them, making them in a compactor won't work")); - .addTooltip(format.red("The actual item has been hidden from JEI for lag reasons, ignore the structure voids")); diff --git a/scripts/ToolTips2.zs b/scripts/ToolTips2.zs index ae174e12..1fd9ee81 100644 --- a/scripts/ToolTips2.zs +++ b/scripts/ToolTips2.zs @@ -2612,7 +2612,6 @@ import crafttweaker.item.IItemCondition; .addTooltip(format.red("WARNING: don't combine with Astral Tome, Thaumonomicon, Lexica botania, Necronomicon, Alkahestry")); .addTooltip(format.red("WARNINGS: This is very crashy, you shouldn't need to use it much")); -.addTooltip(format.red("Vis discount does not work with voidseers pearl")); .addTooltip(format.red("HiaggTM had to upgrade his hatch")); diff --git a/scripts/mixin/thaumcraft/UnifyBoreDrop.zs b/scripts/mixin/thaumcraft/UnifyBoreDrop.zs new file mode 100644 index 00000000..bfd04f57 --- /dev/null +++ b/scripts/mixin/thaumcraft/UnifyBoreDrop.zs @@ -0,0 +1,28 @@ +#modloaded thaumcraft techreborn +#loader mixin + +import native.net.minecraft.item.Item; +import native.net.minecraft.item.ItemStack; + +import native.techreborn.items.ingredients.ItemPlates as TRPlates; + +/* +Unify plate drops for arcane bore. + +Created by ChaosStrikez for Thaumcraft v6.1.BETA-26. +*/ +#mixin {targets: "thaumcraft.common.entities.construct.EntityArcaneBore"} +zenClass mixinEntityArcaneBore { + #mixin Redirect + #{ + # method: "func_70628_a", + # at: { + # value: "NEW", + # target: "(Lnet/minecraft/item/Item;)Lnet/minecraft/item/ItemStack;", + # ordinal: 5 + # } + #} + function mbc_unifyBrassPlate(original as Item) as ItemStack { + return TRPlates.getPlateByName("brass"); + } +} \ No newline at end of file diff --git a/scripts/mixin/thaumcraft/UnifyTurretDrops.zs b/scripts/mixin/thaumcraft/UnifyTurretDrops.zs new file mode 100644 index 00000000..a5ffa83a --- /dev/null +++ b/scripts/mixin/thaumcraft/UnifyTurretDrops.zs @@ -0,0 +1,55 @@ +#modloaded thaumcraft techreborn thermalfoundation +#loader mixin + +import native.net.minecraft.item.Item; +import native.net.minecraft.item.ItemStack; + +import native.cofh.thermalfoundation.item.ItemMaterial as ThermalPlates; +import native.techreborn.items.ingredients.ItemPlates as TRPlates; + +/* +Unify plate drops for advanced crossbow turret. + +Created by ChaosStrikez for Thaumcraft v6.1.BETA-26. +*/ +#mixin {targets: "thaumcraft.common.entities.construct.EntityTurretCrossbowAdvanced"} +zenClass MixinEntityTurretCrossbowAdvanced { + #mixin Redirect + #{ + # method: "func_70628_a", + # at: { + # value: "NEW", + # target: "(Lnet/minecraft/item/Item;II)Lnet/minecraft/item/ItemStack;", + # ordinal: 4 + # } + #} + function mbc_unifyBrassPlate(original as Item, amount as int, meta as int) as ItemStack { + return TRPlates.getPlateByName("brass"); + } + + #mixin Redirect + #{ + # method: "func_70628_a", + # at: { + # value: "NEW", + # target: "(Lnet/minecraft/item/Item;II)Lnet/minecraft/item/ItemStack;", + # ordinal: 5 + # } + #} + function mbc_unifyIronPlate1(original as Item, amount as int, meta as int) as ItemStack { + return ThermalPlates.plateIron.copy(); + } + + #mixin Redirect + #{ + # method: "func_70628_a", + # at: { + # value: "NEW", + # target: "(Lnet/minecraft/item/Item;II)Lnet/minecraft/item/ItemStack;", + # ordinal: 6 + # } + #} + function mbc_unifyIronPlate2(original as Item, amount as int, meta as int) as ItemStack { + return ThermalPlates.plateIron.copy(); + } +} \ No newline at end of file diff --git a/scripts/thaumcraft/UnifyGolemMaterials.zs b/scripts/thaumcraft/UnifyGolemMaterials.zs new file mode 100644 index 00000000..2ca503d8 --- /dev/null +++ b/scripts/thaumcraft/UnifyGolemMaterials.zs @@ -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 = { + : , // brass + : , // iron + : , // 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; +} \ No newline at end of file diff --git a/scripts/thaumcraft/infusion/LateInfusionRecipes.zs b/scripts/thaumcraft/infusion/LateInfusionRecipes.zs new file mode 100644 index 00000000..65d5196b --- /dev/null +++ b/scripts/thaumcraft/infusion/LateInfusionRecipes.zs @@ -0,0 +1,123 @@ +#modloaded thaumcraft modtweaker +#loader lateAddTC +import native.com.blamejared.compat.thaumcraft.handlers.ThaumCraft; +import native.com.blamejared.mtlib.helpers.InputHelper; +import native.net.minecraft.util.ResourceLocation; +import native.thaumcraft.api.ThaumcraftApi; +import native.thaumcraft.api.ThaumcraftApiHelper; +import native.thaumcraft.api.crafting.InfusionRecipe; + +import crafttweaker.item.IIngredient; +import crafttweaker.item.IItemStack; +import thaumcraft.aspect.CTAspectStack; + +/* +Infusion recipes that REPLACE existing recipes tied to research. Removal is unnecssary, the recipes will be overwritten. +This is to keep the recipe available in the research page. +*/ +var tcAdditions = "thaumadditions"; +var tcTinkerer = "thaumictinkerer"; +# KAMI armor +registerInfusionRecipeFromAddon(`${tcTinkerer}:kami_helm`, "TT_KAMIHELM", + , 32, + [ + * 150, * 125, * 125, + * 60, * 250, * 125 + ], + , + [ + , , , + , , , + .withTag({Potion: "minecraft:night_vision"}), , , + , , + ] +); +registerInfusionRecipeFromAddon(`${tcTinkerer}:kami_chest`, "TT_KAMICHEST", + , 32, + [ + * 150, * 125, * 125, + * 125, * 250, * 60 + ], + , + [ + , , , + , , , + , , , + , , + ] +); +registerInfusionRecipeFromAddon(`${tcTinkerer}:kami_legs`, "TT_KAMILEGS", + , 32, + [ + * 150, * 125, * 125, + * 125, * 250, * 60 + ], + , + [ + , , , + , , , + .withTag({Potion: "minecraft:fire_resistance"}), , , + , , + ] +); +registerInfusionRecipeFromAddon(`${tcTinkerer}:kami_boots`, "TT_KAMIBOOTS", + , 32, + [ + * 150, * 125, * 125, + * 125, * 250, * 60, + * 60 + ], + , + [ + , , , + , , , + , , , + , , + ] +); + +# Fix crystal crusher in JEI +registerInfusionRecipeFromAddon(`${tcAdditions}:crystal_crusher`, "TAR_CRYSTAL_CRUSHER", + , 3, + [ + * 20, * 20, * 20 + ], + , + [ + makeCrystal(), makeCrystal(), makeCrystal(), + makeCrystal(), makeCrystal(), makeCrystal(), + , , , + , , , + .withTag({Aspects: [{amount: 1, key: "praemunio"}]}), .withTag({Aspects: [{amount: 1, key: "praemunio"}]}) + ] +); + +# Unify brass plates +registerInfusionRecipeFromAddon(`${tcAdditions}:crystal_bore`, "TAR_CRYSTAL_BORE", + , 5, + [ + * 20, * 10, * 30 + ], + , + [ + , , , + , , + ] +); + +/* + 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. +*/ +function registerInfusionRecipeFromAddon(resourceLocation as string, research as string, output as IItemStack, instability as int, + aspects as CTAspectStack[], centralItem as IIngredient, recipe as IIngredient[]) { + var infusionRecipe = InfusionRecipe( + research, output.native, instability, + ThaumCraft.getAspects(aspects), centralItem.native, InputHelper.toObjects(recipe) + ); + ThaumcraftApi.addInfusionCraftingRecipe(ResourceLocation(resourceLocation), infusionRecipe); +} + +function makeCrystal(aspect as CTAspectStack) as IItemStack { + return ThaumcraftApiHelper.makeCrystal(ThaumCraft.getAspect(aspect)).wrapper; +} \ No newline at end of file diff --git a/scripts/thaumcraft/research/LateResearch.zs b/scripts/thaumcraft/research/LateResearch.zs new file mode 100644 index 00000000..1d831f67 --- /dev/null +++ b/scripts/thaumcraft/research/LateResearch.zs @@ -0,0 +1,82 @@ +#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; + +/* +Hard-coded, non-JSON, research pages to replace crafting requirements for consume requirements. +This is so we can make these ingredients obtainable through non-crafting recipes, +but still make associated research completable. + +See config/thaumcraftfix/patches for research page changes that are JSON-based. +*/ + +# Mithrillium plates +var mithrilliumPlate = ; +var t1JarStage = findCraftingStage("TAR_MITHRILLIUM_JAR", mithrilliumPlate); +convertCraftToConsume(t1JarStage, mithrilliumPlate); + +var t1SmelterStage = findCraftingStage("TAR_MITHRILLIUM_SMELTER", mithrilliumPlate); +convertCraftToConsume(t1SmelterStage, mithrilliumPlate); + +# Adaminite plates +var adaminitePlate = ; +var t2JarStage = findCraftingStage("TAR_ADAMINITE_JAR", adaminitePlate); +convertCraftToConsume(t2JarStage, adaminitePlate); + +var t2SmelterStage = findCraftingStage("TAR_ADAMINITE_SMELTER", adaminitePlate); +convertCraftToConsume(t2SmelterStage, adaminitePlate); + +# Mithminite plates +var mithminitePlate = ; +var t3JarStage = findCraftingStage("TAR_MITHMINITE_JAR", mithminitePlate); +convertCraftToConsume(t3JarStage, mithminitePlate); + +var t3SmelterStage = findCraftingStage("TAR_MITHMINITE_SMELTER", mithminitePlate); +convertCraftToConsume(t3SmelterStage, mithminitePlate); + +var scytheStage = findCraftingStage("TAR_MITHMINITE_SCYTHE", mithminitePlate); +convertCraftToConsume(scytheStage, mithminitePlate); + +function findCraftingStage(researchName as string, targetItem as IItemStack) as ResearchStage { + var stages = ResearchCategories.getResearch(researchName).getStages(); + for stage in stages { + var crafts = stage.getCraft(); + // Check this stage has the target crafting requirement + if (!isNull(crafts)) { + var craftsAsItems = crafts as ItemStack[]; + for stack in craftsAsItems { + if (ItemStack.areItemStacksEqual(stack, targetItem.native)) { + return stage; + } + } + } + } + return null; +} + +function convertCraftToConsume(stage as ResearchStage, itemToConvert as IItemStack) { + var newCrafts = [] as [ItemStack]; + var oldCrafts = stage.getCraft() as ItemStack[]; + for stack in oldCrafts { + if (!ItemStack.areItemStacksEqual(stack, itemToConvert.native)) { + newCrafts += stack; + } + } + // Remove item from crafting requirement + if (newCrafts.length == 0) { + stage.setCraft(null); + } else { + stage.setCraft(newCrafts); + } + // Add item to consume requirement + var consumed = stage.getObtain(); + if (isNull(consumed) || consumed.length == 0) { + stage.setObtain([itemToConvert.native] as ItemStack[]); + } else { + stage.setObtain((consumed as ItemStack[]) + itemToConvert.native); + } +}