Skip to content

Commit

Permalink
Add Hazmat infusion enchantment recipe (#1715)
Browse files Browse the repository at this point in the history
* Add Infusion Enchantment support to IThaumcraftCompat and implementation

* Add Infusion Enchantment recipe for Hazmat enchant
  • Loading branch information
dvdmandt authored Feb 4, 2023
1 parent c7556ee commit 87d9c66
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -38,6 +39,9 @@ public interface IThaumcraftCompat {
Object addInfusionRecipe(String aResearch, ItemStack aMainInput, ItemStack[] aSideInputs, ItemStack aOutput,
int aInstability, List<TC_Aspects.TC_AspectStack> aAspects);

Object addInfusionEnchantmentRecipe(String aResearch, Enchantment aEnchantment, int aInstability,
List<TC_Aspects.TC_AspectStack> 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<TC_AspectStack> aAspects,
ItemStack[] aResearchTriggers, Object[] aPages);
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/gregtech/common/GT_ThaumcraftCompat.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -249,6 +250,23 @@ public Object addInfusionRecipe(String aResearch, ItemStack aMainInput, ItemStac
aSideInputs);
}

@Override
public Object addInfusionEnchantmentRecipe(String aResearch, Enchantment aEnchantment, int aInstability,
List<TC_Aspects.TC_AspectStack> 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<TC_Aspects.TC_AspectStack> aAspects,
String aOreDict) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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) }) });
}
}
}
Expand Down

0 comments on commit 87d9c66

Please sign in to comment.