add fluid craft support (#22)

* Add fluid craft support

* spotless apply

Co-authored-by: GlodBlock <[email protected]>
This commit is contained in:
asdfljandGlodBlock authored and GitHub committed 2022-09-23 17:27:06 +02:00
1 parent 9a15d09740
commit d0bfcf308c
10 files changed
+127 -87

No files matched your search

@@ -1,6 +1,7 @@
package com.github.vfyjxf.nee.utils;
import static com.github.vfyjxf.nee.nei.NEECraftingHelper.noPreview;
import static com.github.vfyjxf.nee.utils.GuiUtils.isFluidCraftPatternTerm;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
@@ -13,6 +14,7 @@ import codechicken.nei.recipe.IRecipeHandler;
import com.github.vfyjxf.nee.config.NEEConfig;
import com.github.vfyjxf.nee.network.NEENetworkHandler;
import com.github.vfyjxf.nee.network.packet.PacketCraftingRequest;
import com.glodblock.github.client.gui.GuiFCBaseMonitor;
import cpw.mods.fml.relauncher.ReflectionHelper;
import java.util.ArrayList;
import java.util.List;
@@ -75,6 +77,16 @@ public class IngredientTracker {
}
}
private ItemRepo getRepo() throws IllegalAccessException {
if (isFluidCraftPatternTerm(termGui)) {
return (ItemRepo)
ReflectionHelper.findField(GuiFCBaseMonitor.class, "repo").get(termGui);
} else {
return (ItemRepo)
ReflectionHelper.findField(GuiMEMonitorable.class, "repo").get(termGui);
}
}
@SuppressWarnings("unchecked")
private List<IAEItemStack> getCraftableStacks() {
List<IAEItemStack> craftableStacks = new ArrayList<>();
@@ -82,8 +94,7 @@ public class IngredientTracker {
IItemList<IAEItemStack> list = null;
try {
if (!GuiUtils.isGuiWirelessCrafting(termGui)) {
ItemRepo repo = (ItemRepo) ReflectionHelper.findField(GuiMEMonitorable.class, "repo")
.get(termGui);
ItemRepo repo = getRepo();
list = (IItemList<IAEItemStack>)
ReflectionHelper.findField(ItemRepo.class, "list").get(repo);
} else {