mirror of
https://github.com/GTNewHorizons/NotEnoughEnergistics.git
synced 2026-11-17 10:55:07 +00:00
allow autofill aspects in pattern (#62)
This commit is contained in:
1 parent
40c12951ce
commit
e367164245
4 files changed
+40
-18
No files matched your search
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,8 @@ 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 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());
|
||||
}
|
||||
|
||||
@@ -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<PositionedStack> 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<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;
|
||||
|
||||
Reference in new issue
Block a user