diff --git a/gradle.properties b/gradle.properties index b79aa0a..dabed7d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ org.gradle.daemon=false mc_version=1.7.10 nei_version=2.1.6-GTNH ae2_version=rv3-beta-52-GTNH -mod_version=1.1.0 +mod_version=1.1.1 forge_version=10.13.4.1614 mod_group=com.github.vfyjxf.neenergistics mod_id=neenergistics diff --git a/src/main/java/com/github/vfyjxf/nee/processor/GregTechRecipeProcessor.java b/src/main/java/com/github/vfyjxf/nee/processor/GregTechRecipeProcessor.java index 3b7c6ea..12038f1 100644 --- a/src/main/java/com/github/vfyjxf/nee/processor/GregTechRecipeProcessor.java +++ b/src/main/java/com/github/vfyjxf/nee/processor/GregTechRecipeProcessor.java @@ -2,9 +2,14 @@ import codechicken.nei.PositionedStack; import codechicken.nei.recipe.IRecipeHandler; +import gregtech.api.enums.ItemList; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.nei.GT_NEI_DefaultHandler.FixedPositionedStack; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; import java.util.HashSet; @@ -49,7 +54,7 @@ public List getRecipeInput(IRecipeHandler recipe, int recipeInd if (gtDefaultClz.isInstance(recipe) || gtAssLineClz.isInstance(recipe)) { List recipeInputs = new ArrayList<>(recipe.getIngredientStacks(recipeIndex)); - recipeInputs.removeIf(positionedStack -> GT_Utility.getFluidFromDisplayStack(positionedStack.items[0]) != null || positionedStack.item.stackSize == 0); + recipeInputs.removeIf(positionedStack -> getFluidFromDisplayStack(positionedStack.items[0]) != null || positionedStack.item.stackSize == 0); return recipeInputs; } return null; @@ -60,7 +65,7 @@ public List getRecipeInput(IRecipeHandler recipe, int recipeInd public List getRecipeOutput(IRecipeHandler recipe, int recipeIndex, String identifier) { if (gtDefaultClz.isInstance(recipe) || gtAssLineClz.isInstance(recipe)) { List recipeOutputs = new ArrayList<>(recipe.getOtherStacks(recipeIndex)); - recipeOutputs.removeIf(positionedStack -> GT_Utility.getFluidFromDisplayStack(positionedStack.items[0]) != null); + recipeOutputs.removeIf(positionedStack -> getFluidFromDisplayStack(positionedStack.items[0]) != null); //remove output if it's chance != 1 recipeOutputs.removeIf(stack -> stack instanceof FixedPositionedStack && !(((FixedPositionedStack) stack).mChance == 10000 || ((FixedPositionedStack) stack).mChance <= 0)); return recipeOutputs; @@ -68,4 +73,21 @@ public List getRecipeOutput(IRecipeHandler recipe, int recipeIn return null; } + /** + * For resolving NoSuchMethodError + * Copied from GTNewHorizons/GT5-Unofficial. + */ + public static FluidStack getFluidFromDisplayStack(ItemStack aDisplayStack) { + if (!isStackValid(aDisplayStack) || + aDisplayStack.getItem() != ItemList.Display_Fluid.getItem() || + !aDisplayStack.hasTagCompound()) { + return null; + } + Fluid tFluid = FluidRegistry.getFluid(ItemList.Display_Fluid.getItem().getDamage(aDisplayStack)); + return new FluidStack(tFluid, (int) aDisplayStack.getTagCompound().getLong("mFluidDisplayAmount")); + } + public static boolean isStackValid(Object aStack) { + return (aStack instanceof ItemStack) && ((ItemStack) aStack).getItem() != null && ((ItemStack) aStack).stackSize >= 0; + } + } diff --git a/src/main/java/com/github/vfyjxf/nee/processor/ICRecipeProcessor.java b/src/main/java/com/github/vfyjxf/nee/processor/ICRecipeProcessor.java index 8b4eebd..3ffaf14 100644 --- a/src/main/java/com/github/vfyjxf/nee/processor/ICRecipeProcessor.java +++ b/src/main/java/com/github/vfyjxf/nee/processor/ICRecipeProcessor.java @@ -12,7 +12,8 @@ public class ICRecipeProcessor implements IRecipeProcessor { @Override public Set getAllOverlayIdentifier() { return new HashSet<>(Arrays.asList( - "blastfurnace", "BlockCutter", "centrifuge", "compressor", "extractor", "fluidcanner", "macerator", + "blastfurnace", "BlockCutter", "centrifuge", "compressor", + "extractor", "fluidcanner", "macerator", "metalformer", "oreWashing", "solidcanner" )); }