diff --git a/dependencies.gradle b/dependencies.gradle index 5d97935..90e8746 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,12 +1,12 @@ dependencies { - api("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-817-GTNH:dev") + api("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-855-GTNH:dev") api("com.github.GTNewHorizons:NotEnoughItems:2.8.44-GTNH:dev") api('com.github.GTNewHorizons:CodeChickenCore:1.4.10:dev') implementation("com.github.GTNewHorizons:Baubles-Expanded:2.2.6-GTNH:dev") - implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.12.12:dev") - implementation("com.github.GTNewHorizons:AE2FluidCraft-Rework:1.5.57-gtnh:dev") + implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.12.13:dev") + implementation("com.github.GTNewHorizons:AE2FluidCraft-Rework:1.5.64-gtnh:dev") compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.52.173:dev") { transitive = false } compileOnly("com.github.GTNewHorizons:Avaritia:1.78:dev") { transitive = false } @@ -15,7 +15,7 @@ dependencies { compileOnly('com.github.GTNewHorizons:EnderIO:2.10.10:dev') {transitive=false} compileOnly("com.github.GTNewHorizons:ForestryMC:4.11.4:dev") { transitive = false } compileOnly("com.github.GTNewHorizons:GTplusplus:1.12.11:dev") { transitive = false } - compileOnly("com.github.GTNewHorizons:ThaumicEnergistics:1.7.27-GTNH:dev") { transitive = false } + compileOnly("com.github.GTNewHorizons:ThaumicEnergistics:1.7.31-GTNH:dev") { transitive = false } compileOnly("com.github.GTNewHorizons:Botania:1.13.6-GTNH:dev") { transitive = false } compileOnly("com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev") { transitive = false } compileOnly("curse.maven:thaumcraft-nei-plugin-225095:2241913") { transitive = false } diff --git a/src/main/java/com/github/vfyjxf/nee/network/packet/PacketNEIPatternRecipe.java b/src/main/java/com/github/vfyjxf/nee/network/packet/PacketNEIPatternRecipe.java index 5da4cb2..d2a9dd6 100644 --- a/src/main/java/com/github/vfyjxf/nee/network/packet/PacketNEIPatternRecipe.java +++ b/src/main/java/com/github/vfyjxf/nee/network/packet/PacketNEIPatternRecipe.java @@ -2,6 +2,9 @@ package com.github.vfyjxf.nee.network.packet; import static com.github.vfyjxf.nee.nei.NEEPatternTerminalHandler.INPUT_KEY; import static com.github.vfyjxf.nee.nei.NEEPatternTerminalHandler.OUTPUT_KEY; +import static com.github.vfyjxf.nee.processor.RecipeProcessor.TCNEIPlugin_isLoaded; +import static com.github.vfyjxf.nee.processor.RecipeProcessor.ThaumicEnergistics_isLoaded; +import static thaumicenergistics.common.storage.AEEssentiaStackType.ESSENTIA_STACK_ID; import javax.annotation.Nonnull; @@ -10,6 +13,7 @@ import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import com.djgiannuzz.thaumcraftneiplugin.items.ItemAspect; import com.github.vfyjxf.nee.utils.GuiUtils; import com.github.vfyjxf.nee.utils.ItemUtils; @@ -18,6 +22,7 @@ import appeng.api.networking.IGridNode; import appeng.api.networking.security.ISecurityGrid; import appeng.api.networking.storage.IStorageGrid; import appeng.api.storage.StorageName; +import appeng.api.storage.data.AEStackTypeRegistry; import appeng.api.storage.data.IAEStack; import appeng.container.AEBaseContainer; import appeng.container.implementations.ContainerPatternTerm; @@ -168,12 +173,9 @@ public class PacketNEIPatternRecipe implements IMessage { final ItemStack nextStack = recipeInput[i]; if (nextStack == null) continue; - final IAEStack aes; - if (StackInfo.itemStackToNBT(nextStack).hasKey("gtFluidName")) { - aes = AEFluidStack.create(StackInfo.getFluid(nextStack)); - } else { - aes = AEItemStack.create(nextStack); - } + final IAEStack aes = this.getAEStack(nextStack); + + if (aes == null) continue; input.put(i, aes); } @@ -182,12 +184,9 @@ public class PacketNEIPatternRecipe implements IMessage { final ItemStack nextStack = recipeOutput[i]; if (nextStack == null) continue; - IAEStack aes; - if (StackInfo.itemStackToNBT(nextStack).hasKey("gtFluidName")) { - aes = AEFluidStack.create(StackInfo.getFluid(nextStack)); - } else { - aes = AEItemStack.create(nextStack); - } + final IAEStack aes = this.getAEStack(nextStack); + + if (aes == null) continue; output.put(i, aes); } @@ -197,5 +196,15 @@ public class PacketNEIPatternRecipe implements IMessage { container.receiveSlotStacks(StorageName.CRAFTING_OUTPUT, output); } } + + private IAEStack getAEStack(final ItemStack is) { + if (StackInfo.itemStackToNBT(is).hasKey("gtFluidName")) { + return AEFluidStack.create(StackInfo.getFluid(is)); + } else if (TCNEIPlugin_isLoaded && ThaumicEnergistics_isLoaded && is.getItem() instanceof ItemAspect) { + return AEStackTypeRegistry.getType(ESSENTIA_STACK_ID).convertStackFromItem(is); + } else { + return AEItemStack.create(is); + } + } } } diff --git a/src/main/java/com/github/vfyjxf/nee/processor/RecipeProcessor.java b/src/main/java/com/github/vfyjxf/nee/processor/RecipeProcessor.java index d16572e..11b97b3 100644 --- a/src/main/java/com/github/vfyjxf/nee/processor/RecipeProcessor.java +++ b/src/main/java/com/github/vfyjxf/nee/processor/RecipeProcessor.java @@ -11,6 +11,8 @@ public class RecipeProcessor { public static final String NULL_IDENTIFIER = "null"; public static List recipeProcessors = new ArrayList<>(); + public static boolean TCNEIPlugin_isLoaded = Loader.isModLoaded("thaumcraftneiplugin"); + public static boolean ThaumicEnergistics_isLoaded = Loader.isModLoaded("thaumicenergistics"); public static void init() { NotEnoughEnergistics.logger.info("-----Not Enough Energistics Init Start-----"); @@ -58,7 +60,7 @@ public class RecipeProcessor { NotEnoughEnergistics.logger.info("Found Forestry, install Forestry support"); recipeProcessors.add(new ForestryRecipeProcessor()); } - if (Loader.isModLoaded("thaumcraftneiplugin")) { + if (TCNEIPlugin_isLoaded) { NotEnoughEnergistics.logger.info("Found TCNEIPlugin, install TCNEIPlugin support"); recipeProcessors.add(new TCNEIPluginRecipeProcessor()); } diff --git a/src/main/java/com/github/vfyjxf/nee/processor/TCNEIPluginRecipeProcessor.java b/src/main/java/com/github/vfyjxf/nee/processor/TCNEIPluginRecipeProcessor.java index 7a0b17d..c097f41 100644 --- a/src/main/java/com/github/vfyjxf/nee/processor/TCNEIPluginRecipeProcessor.java +++ b/src/main/java/com/github/vfyjxf/nee/processor/TCNEIPluginRecipeProcessor.java @@ -1,5 +1,7 @@ package com.github.vfyjxf.nee.processor; +import static com.github.vfyjxf.nee.processor.RecipeProcessor.ThaumicEnergistics_isLoaded; + import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; @@ -42,7 +44,11 @@ public class TCNEIPluginRecipeProcessor implements IRecipeProcessor { List recipeInputs = new ArrayList<>(); if (this.getAllOverlayIdentifier().contains(identifier)) { recipeInputs.addAll(recipe.getIngredientStacks(recipeIndex)); - recipeInputs.removeIf(positionedStack -> positionedStack.item.getItem() instanceof ItemAspect); + + if (!ThaumicEnergistics_isLoaded) { + recipeInputs.removeIf(positionedStack -> positionedStack.item.getItem() instanceof ItemAspect); + } + return recipeInputs; } return recipeInputs; @@ -54,6 +60,11 @@ public class TCNEIPluginRecipeProcessor implements IRecipeProcessor { List recipeOutputs = new ArrayList<>(); if (this.getAllOverlayIdentifier().contains(identifier)) { recipeOutputs.add(recipe.getResultStack(recipeIndex)); + + if (!ThaumicEnergistics_isLoaded) { + recipeOutputs.removeIf(positionedStack -> positionedStack.item.getItem() instanceof ItemAspect); + } + return recipeOutputs; } return recipeOutputs;