Hide unused fluids in JEI, since we have no choice but to register them before we know if they are used
@@ -4,7 +4,9 @@ import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidUtil;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -17,13 +19,16 @@ import mezz.jei.api.IRecipeRegistry;
import mezz.jei.api.ISubtypeRegistry;
import mezz.jei.api.gui.IAdvancedGuiHandler;
import mezz.jei.api.gui.ICraftingGridHelper;
+import mezz.jei.api.ingredients.IIngredientBlacklist;
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
import mezz.jei.api.recipe.IRecipeCategoryRegistration;
import slimeknights.tconstruct.TConstruct;
import slimeknights.tconstruct.gadgets.TinkerGadgets;
import slimeknights.tconstruct.library.DryingRecipe;
+import slimeknights.tconstruct.library.MaterialIntegration;
import slimeknights.tconstruct.library.TinkerRegistry;
+import slimeknights.tconstruct.library.fluid.FluidColored;
import slimeknights.tconstruct.library.smeltery.AlloyRecipe;
import slimeknights.tconstruct.library.smeltery.MeltingRecipe;
import slimeknights.tconstruct.library.tools.IToolPart;
@@ -169,6 +174,17 @@ public class JEIPlugin implements IModPlugin {
// liquid recipe lookup for smeltery and tinker tank
registry.addAdvancedGuiHandlers(new TinkerGuiTankHandler<>(GuiTinkerTank.class), new TinkerGuiTankHandler<>(GuiSmeltery.class));
+
+ // hide unused fluids from JEI
+ IIngredientBlacklist blacklist = registry.getJeiHelpers().getIngredientBlacklist();
+ for(MaterialIntegration integration : TinkerRegistry.getMaterialIntegrations()) {
+ // if it has a fluid and that fluid is one of ours, hide it
+ if(!integration.isIntegrated() && integration.fluid instanceof FluidColored) {
+ FluidStack stack = new FluidStack(integration.fluid, Fluid.BUCKET_VOLUME);
+ blacklist.addIngredientToBlacklist(stack);
+ blacklist.addIngredientToBlacklist(FluidUtil.getFilledBucket(stack));
+ }
+ }
}
// drying rack
