From 87d9c661960db58dbf5213fbb6b420944681b85f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Lindstr=C3=B6m?= Date: Sat, 4 Feb 2023 15:34:41 +0100 Subject: [PATCH] Add Hazmat infusion enchantment recipe (#1715) * Add Infusion Enchantment support to IThaumcraftCompat and implementation * Add Infusion Enchantment recipe for Hazmat enchant --- .../internal/IThaumcraftCompat.java | 4 ++ .../gregtech/common/GT_ThaumcraftCompat.java | 18 ++++++++ .../postload/recipes/ThaumcraftRecipes.java | 45 +++++++++++++++++++ 3 files changed, 67 insertions(+) diff --git a/src/main/java/gregtech/api/interfaces/internal/IThaumcraftCompat.java b/src/main/java/gregtech/api/interfaces/internal/IThaumcraftCompat.java index debbe928fd8..1178d872981 100644 --- a/src/main/java/gregtech/api/interfaces/internal/IThaumcraftCompat.java +++ b/src/main/java/gregtech/api/interfaces/internal/IThaumcraftCompat.java @@ -3,6 +3,7 @@ import java.util.List; import net.minecraft.block.Block; +import net.minecraft.enchantment.Enchantment; import net.minecraft.item.ItemStack; import gregtech.api.enums.TC_Aspects; @@ -38,6 +39,9 @@ public interface IThaumcraftCompat { Object addInfusionRecipe(String aResearch, ItemStack aMainInput, ItemStack[] aSideInputs, ItemStack aOutput, int aInstability, List aAspects); + Object addInfusionEnchantmentRecipe(String aResearch, Enchantment aEnchantment, int aInstability, + List aAspects, ItemStack[] aSideInputs); + Object addResearch(String aResearch, String aName, String aText, String[] aParentResearches, String aCategory, ItemStack aIcon, int aComplexity, int aType, int aX, int aY, List aAspects, ItemStack[] aResearchTriggers, Object[] aPages); diff --git a/src/main/java/gregtech/common/GT_ThaumcraftCompat.java b/src/main/java/gregtech/common/GT_ThaumcraftCompat.java index 3e91f876a80..2cd845fadf9 100644 --- a/src/main/java/gregtech/common/GT_ThaumcraftCompat.java +++ b/src/main/java/gregtech/common/GT_ThaumcraftCompat.java @@ -5,6 +5,7 @@ import java.util.List; import net.minecraft.block.Block; +import net.minecraft.enchantment.Enchantment; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.util.ResourceLocation; @@ -249,6 +250,23 @@ public Object addInfusionRecipe(String aResearch, ItemStack aMainInput, ItemStac aSideInputs); } + @Override + public Object addInfusionEnchantmentRecipe(String aResearch, Enchantment aEnchantment, int aInstability, + List aAspects, ItemStack[] aSideInputs) { + if ((GT_Utility.isStringInvalid(aResearch)) || (aSideInputs == null) + || (aAspects == null) + || (aEnchantment == null) + || (aAspects.isEmpty())) { + return null; + } + return ThaumcraftApi.addInfusionEnchantmentRecipe( + aResearch, + aEnchantment, + aInstability, + getAspectList(aAspects), + aSideInputs); + } + @Override public boolean registerThaumcraftAspectsToItem(ItemStack aExampleStack, List aAspects, String aOreDict) { diff --git a/src/main/java/gregtech/loaders/postload/recipes/ThaumcraftRecipes.java b/src/main/java/gregtech/loaders/postload/recipes/ThaumcraftRecipes.java index 9ccf72fc92b..8af72a84e1c 100644 --- a/src/main/java/gregtech/loaders/postload/recipes/ThaumcraftRecipes.java +++ b/src/main/java/gregtech/loaders/postload/recipes/ThaumcraftRecipes.java @@ -12,11 +12,13 @@ import net.minecraft.item.ItemStack; import gregtech.api.GregTech_API; +import gregtech.api.enchants.Enchantment_Hazmat; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.TC_Aspects; import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.loaders.postload.GT_MachineRecipeLoader; @@ -931,6 +933,49 @@ public void run() { new TC_Aspects.TC_AspectStack(TC_Aspects.VACUOS, 128L), new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 256L), new TC_Aspects.TC_AspectStack(TC_Aspects.STRONTIO, 64L))) }); + + tKey = "GT_HAZMATENCH"; + GT_LanguageManager.addStringLocalization( + GT_MachineRecipeLoader.aTextTCGTPage + tKey, + "You have discovered a way to magically enchant a mundane piece of armor with the protective properties of a Hazmat suite."); + GregTech_API.sThaumcraftCompat.addResearch( + tKey, + "Hazmat Protection", + "Magical protection from physical hazards", + new String[] { "INFUSIONENCHANTMENT" }, + "ARTIFICE", + GT_ModHandler.getIC2Item("hazmatChestplate", 1), + 4, + 0, + -7, + 13, + Arrays.asList( + new TC_Aspects.TC_AspectStack(TC_Aspects.VITIUM, 1L), + new TC_Aspects.TC_AspectStack(TC_Aspects.GELUM, 1L), + new TC_Aspects.TC_AspectStack(TC_Aspects.RADIO, 1L), + new TC_Aspects.TC_AspectStack(TC_Aspects.TUTAMEN, 1L), + new TC_Aspects.TC_AspectStack(TC_Aspects.VENENUM, 1L)), + null, + new Object[] { GT_MachineRecipeLoader.aTextTCGTPage + tKey, + GregTech_API.sThaumcraftCompat.addInfusionEnchantmentRecipe( + tKey, + Enchantment_Hazmat.INSTANCE, + 5, + Arrays.asList( + new TC_Aspects.TC_AspectStack(TC_Aspects.VITIUM, 8L), + new TC_Aspects.TC_AspectStack(TC_Aspects.GELUM, 16L), + new TC_Aspects.TC_AspectStack(TC_Aspects.RADIO, 16L), + new TC_Aspects.TC_AspectStack(TC_Aspects.TUTAMEN, 32L), + new TC_Aspects.TC_AspectStack(TC_Aspects.VENENUM, 16L)), + new ItemStack[] { getModItem(MOD_ID_TC, "ItemResource", 1L, 14), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Titanium, 1), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Rubber, 1), + GT_OreDictUnificator.get(OrePrefixes.plateDense, Materials.Lead, 1), + getModItem(MOD_ID_TC, "ItemResource", 1L, 14), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Titanium, 1), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Rubber, 1), + GT_OreDictUnificator + .get(OrePrefixes.plateDense, Materials.Lead, 1) }) }); } } }