Aspect Recipe Index Support (#63)

This commit is contained in:
koolkrafter5 authored and GitHub committed 2026-03-10 14:34:14 -04:00
1 parent e367164245
commit e1094ff70b
11 files changed
+171 -52

No files matched your search

+3 -2
View File
@@ -27,7 +27,7 @@ This mod removes that functionality and allows the player to use NEI's transfer
- You can use shift + mouse wheel to choose ingredient.
- you can use ctrl+ click [?] in crafting terminal to request the items while missing in AE and having existing pattern in AE(alt + click for no preview)
## Compatible Modslist as followed:
## Compatible Mods:
- [x] AppliedEnergistics2
- [x] Vanilla
@@ -38,7 +38,8 @@ This mod removes that functionality and allows the player to use NEI's transfer
- [x] EnderIO
- [x] Forestry (Doesn't support Fermenter and Still,because they don't have an item output)
- [x] Thaumcraft NEI Plugin
- [x] Thaumic Energistics (Allows you to transfer ArcaneRecipe from NEI to Knowledge Inscriber, it requires Thaumcraft NEI Plugin)
- [x] Aspect Recipe Index
- [x] Thaumic Energistics (Allows you to transfer ArcaneRecipe from NEI to Knowledge Inscriber, it requires either Aspect Recipe Index or Thaumcraft NEI Plugin)
- [x] ThermalExpansion
- [x] ImmersiveEngineering
- [x] Mekanism
+2 -1
View File
@@ -15,11 +15,12 @@ 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.31-GTNH:dev") { transitive = false }
compileOnly("com.github.GTNewHorizons:ThaumicEnergistics:1.7.33-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 }
compileOnly("curse.maven:thermal-expansion-69163:2388759") { transitive = false }
compileOnly("com.github.GTNewHorizons:AspectRecipeIndex:1.0.0:dev") { transitive = false }
runtimeOnly("curse.maven:cofh-core-69162:2388751")
}
+3
View File
@@ -209,3 +209,6 @@ customArchiveBaseName = NotEnoughEnergistics
# This is meant to be set in $HOME/.gradle/gradle.properties.
# ideaCheckSpotlessOnBuild = true
# Non-GTNH properties
org.gradle.configuration-cache = true
org.gradle.parallel = true
+12
View File
@@ -0,0 +1,12 @@
#This file is generated by updateDaemonJvm
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/df211d3c3eefdc408b462041881bc575/redirect
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/93aeea858331bd6bb00ba94759830234/redirect
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/df211d3c3eefdc408b462041881bc575/redirect
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/93aeea858331bd6bb00ba94759830234/redirect
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/46949723aaa20c7b64d7ecfed7207034/redirect
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/d6690dfd71c4c91e08577437b5b2beb0/redirect
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/4945f00643ec68e7c7a6b66f90124f89/redirect
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/b41931cf1e70bc8e08d7dd19c343ef00/redirect
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/3cd7045fca9a72cd9bc7d14a385e594c/redirect
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/552c7bffe0370c66410a51c55985b511/redirect
toolchainVersion=25
+2 -2
View File
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
networkTimeout=30000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.48'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.22'
}
@@ -188,9 +188,23 @@ public class NEINeeConfig implements IConfigureNEI {
NEEKnowledgeInscriberHandler.instance,
"arcaneshapelessrecipes");
} catch (ClassNotFoundException e) {
API.registerGuiOverlay(GuiKnowledgeInscriber.class, "thaumcraft.arcane.shaped");
API.registerGuiOverlay(GuiKnowledgeInscriber.class, "thaumcraft.arcane.shapeless");
API.registerGuiOverlay(GuiKnowledgeInscriber.class, "thaumcraft.wands");
API.registerGuiOverlayHandler(
GuiKnowledgeInscriber.class,
NEEKnowledgeInscriberHandler.instance,
"thaumcraft.arcane.shaped");
API.registerGuiOverlayHandler(
GuiKnowledgeInscriber.class,
NEEKnowledgeInscriberHandler.instance,
"thaumcraft.arcane.shapeless");
API.registerGuiOverlayHandler(
GuiKnowledgeInscriber.class,
NEEKnowledgeInscriberHandler.instance,
"thaumcraft.wands");
}
} catch (ClassNotFoundException ignored) {}
}
}
@@ -1,5 +1,8 @@
package com.github.vfyjxf.nee.nei;
import static com.github.vfyjxf.nee.processor.RecipeProcessor.AspectRecipeIndex_isLoaded;
import static com.github.vfyjxf.nee.processor.RecipeProcessor.TCNEIPlugin_isLoaded;
import java.util.List;
import java.util.stream.Collectors;
@@ -14,6 +17,8 @@ import com.github.vfyjxf.nee.utils.Ingredient;
import com.github.vfyjxf.nee.utils.IngredientTracker;
import com.github.vfyjxf.nee.utils.ItemUtils;
import com.github.vfyjxf.nee.utils.ModIDs;
import com.gtnewhorizons.aspectrecipeindex.nei.arcaneworkbench.ArcaneSlotPositioner;
import com.gtnewhorizons.aspectrecipeindex.nei.arcaneworkbench.ShapedArcaneRecipeHandler;
import appeng.util.Platform;
import codechicken.nei.ItemsTooltipLineHandler;
@@ -32,7 +37,7 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
*/
public class NEEKnowledgeInscriberHandler implements IOverlayHandler {
public class NEEArcaneOverlayButton extends NEETerminalOverlayButton {
public static class NEEArcaneOverlayButton extends NEETerminalOverlayButton {
public NEEArcaneOverlayButton(GuiOverlayButton button) {
super(button.firstGui, button.handlerRef, button.xPosition, button.yPosition);
@@ -82,7 +87,6 @@ public class NEEKnowledgeInscriberHandler implements IOverlayHandler {
private NEEKnowledgeInscriberHandler() {
try {
// "Knowledge Inscriber"
knowledgeInscriberClz = Class.forName("thaumicenergistics.client.gui.GuiKnowledgeInscriber");
} catch (ClassNotFoundException ignored) {}
@@ -104,57 +108,57 @@ public class NEEKnowledgeInscriberHandler implements IOverlayHandler {
final List<PositionedStack> ingredients = recipe.getIngredientStacks(recipeIndex);
if (itemAspectClz != null) {
// Aspect Recipe Index already does not include vis in the ingredients for arcane recipes so they do not
// need to be removed.
ingredients.removeIf(positionedStack -> itemAspectClz.isInstance(positionedStack.item.getItem()));
}
for (PositionedStack positionedStack : ingredients) {
if (positionedStack.items != null && positionedStack.items.length > 0) {
final int slotIndex = getSlotIndex(positionedStack.relx * 100 + positionedStack.rely);
final ItemStack[] currentStackList = positionedStack.items;
ItemStack stack = positionedStack.item;
for (ItemStack currentStack : currentStackList) {
if (Platform.isRecipePrioritized(currentStack)) {
stack = currentStack.copy();
}
}
recipeInputs.setTag("#" + slotIndex, ItemUtils.writeItemStackToNBT(stack, stack.stackSize));
// Also applies to shapeless and wand handlers through inheritance
if (AspectRecipeIndex_isLoaded && recipe instanceof ShapedArcaneRecipeHandler) {
for (PositionedStack ps : ingredients) {
addIndexedIngredient(ps, ArcaneSlotPositioner.getSlotIndex(ps), recipeInputs);
}
} else if (TCNEIPlugin_isLoaded) {
for (PositionedStack ps : ingredients) {
addIndexedIngredient(ps, getSlotIndex(ps.relx * 100 + ps.rely), recipeInputs);
}
}
return new PacketArcaneRecipe(recipeInputs);
}
private int getSlotIndex(int xy) {
switch (xy) {
case 7533:
return 1;
case 10333:
return 2;
case 4960:
return 3;
case 7660:
return 4;
case 10360:
return 5;
case 4987:
return 6;
case 7687:
return 7;
case 10387:
return 8;
case 4832:
default:
return 0;
private static void addIndexedIngredient(PositionedStack ps, int i, NBTTagCompound recipeInputs) {
if (ps.items != null && ps.items.length > 0) {
ItemStack stack = getPrioritizedItem(ps.items);
if (stack == null) return;
recipeInputs.setTag("#" + i, ItemUtils.writeItemStackToNBT(stack, stack.stackSize));
}
}
private static ItemStack getPrioritizedItem(ItemStack[] ps) {
for (ItemStack currentStack : ps) {
if (Platform.isRecipePrioritized(currentStack)) {
return currentStack.copy();
}
}
return ps[0];
}
private int getSlotIndex(int xy) {
return switch (xy) {
case 7533 -> 1;
case 10333 -> 2;
case 4960 -> 3;
case 7660 -> 4;
case 10360 -> 5;
case 4987 -> 6;
case 7687 -> 7;
case 10387 -> 8;
default -> 0;
};
}
@SubscribeEvent
public void onActionPerformedEventPost(GuiRecipeButton.UpdateRecipeButtonsEvent.Post event) {
if (NEEConfig.noShift && event.gui instanceof GuiRecipe guiRecipe) {
if (NEEConfig.noShift && event.gui instanceof GuiRecipe<?>guiRecipe) {
if (isGuiArcaneCraftingTerm(guiRecipe)) {
for (int i = 0; i < event.buttonList.size(); i++) {
if (event.buttonList.get(i) instanceof GuiOverlayButton btn) {
@@ -2,6 +2,7 @@ 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.AspectRecipeIndex_isLoaded;
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;
@@ -200,11 +201,16 @@ public class PacketNEIPatternRecipe implements IMessage {
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) {
} else if (ThaumicEnergistics_isLoaded && isAspect(is)) {
return AEStackTypeRegistry.getType(ESSENTIA_STACK_ID).convertStackFromItem(is);
} else {
return AEItemStack.create(is);
}
}
private static boolean isAspect(ItemStack is) {
return (TCNEIPlugin_isLoaded && is.getItem() instanceof ItemAspect) || (AspectRecipeIndex_isLoaded
&& is.getItem() instanceof com.gtnewhorizons.aspectrecipeindex.common.items.ItemAspect);
}
}
}
@@ -0,0 +1,73 @@
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;
import java.util.List;
import java.util.Set;
import javax.annotation.Nonnull;
import com.gtnewhorizons.aspectrecipeindex.common.items.ItemAspect;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.IRecipeHandler;
/**
* @author vfyjxf
*/
public class AspectRecipeIndexRecipeProcessor implements IRecipeProcessor {
@Nonnull
@Override
public Set<String> getAllOverlayIdentifier() {
return new HashSet<>(
Arrays.asList(
"thaumcraft.arcane.shaped",
"thaumcraft.arcane.shapeless",
"thaumcraft.wands",
"thaumcraft.aspects",
"thaumcraft.alchemy",
"thaumcraft.infusion"));
}
@Nonnull
@Override
public String getRecipeProcessorId() {
return "aspectrecipeindex";
}
@Nonnull
@Override
public List<PositionedStack> getRecipeInput(IRecipeHandler recipe, int recipeIndex, String identifier) {
List<PositionedStack> recipeInputs = new ArrayList<>();
if (this.getAllOverlayIdentifier().contains(identifier)) {
recipeInputs.addAll(recipe.getIngredientStacks(recipeIndex));
if (!ThaumicEnergistics_isLoaded) {
recipeInputs.removeIf(positionedStack -> positionedStack.item.getItem() instanceof ItemAspect);
}
return recipeInputs;
}
return recipeInputs;
}
@Nonnull
@Override
public List<PositionedStack> getRecipeOutput(IRecipeHandler recipe, int recipeIndex, String identifier) {
List<PositionedStack> 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;
}
}
@@ -11,8 +11,9 @@ public class RecipeProcessor {
public static final String NULL_IDENTIFIER = "null";
public static List<IRecipeProcessor> recipeProcessors = new ArrayList<>();
public static boolean TCNEIPlugin_isLoaded = Loader.isModLoaded("thaumcraftneiplugin");
public static boolean ThaumicEnergistics_isLoaded = Loader.isModLoaded("thaumicenergistics");
public static final boolean TCNEIPlugin_isLoaded = Loader.isModLoaded("thaumcraftneiplugin");
public static final boolean ThaumicEnergistics_isLoaded = Loader.isModLoaded("thaumicenergistics");
public static final boolean AspectRecipeIndex_isLoaded = Loader.isModLoaded("aspectrecipeindex");
public static void init() {
NotEnoughEnergistics.logger.info("-----Not Enough Energistics Init Start-----");
@@ -60,6 +61,10 @@ public class RecipeProcessor {
NotEnoughEnergistics.logger.info("Found Forestry, install Forestry support");
recipeProcessors.add(new ForestryRecipeProcessor());
}
if (AspectRecipeIndex_isLoaded) {
NotEnoughEnergistics.logger.info("Found Aspect Recipe Index, install Aspect Recipe Index support");
recipeProcessors.add(new AspectRecipeIndexRecipeProcessor());
}
if (TCNEIPlugin_isLoaded) {
NotEnoughEnergistics.logger.info("Found TCNEIPlugin, install TCNEIPlugin support");
recipeProcessors.add(new TCNEIPluginRecipeProcessor());