package com.infinityraider.agricraft.api.v1.plant;

import com.infinityraider.agricraft.api.v1.AgriApi;
import com.infinityraider.agricraft.api.v1.content.items.IAgriSeedItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import net.minecraftforge.common.crafting.IIngredientSerializer;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.stream.Stream;

public class AgriPlantIngredient extends Ingredient {
    private final IAgriPlant plant;

    public AgriPlantIngredient(IAgriPlant plant) {
        super(Stream.of(new SingleItemList(plant.toItemStack())));
        this.plant = plant;
    }

    public String getPlantId() {
        return this.getPlant().getId();
    }

    public IAgriPlant getPlant() {
        return this.plant;
    }

    public boolean isValid() {
        return this.getPlant().isPlant();
    }

    @Override
    public boolean test(@Nullable ItemStack stack) {
        return stack != null
                && stack.getItem() instanceof IAgriSeedItem
                && this.isValid()
                && ((IAgriSeedItem) stack.getItem()).getPlant(stack).equals(this.getPlant());
    }

    @Nonnull
    @Override
    public IIngredientSerializer<AgriPlantIngredient> getSerializer() {
        return AgriApi.getPlantIngredientSerializer();
    }
}

@@ -508,16 +508,48 @@
 t plant;
+%0A    private ItemStack%5B%5D stacks;
 %0A%0A    pu
@@ -920,24 +920,363 @@
 t();%0A    %7D%0A%0A
+    @Override%0A    @Nonnull%0A    public ItemStack%5B%5D getMatchingStacks() %7B%0A        if(this.stacks == null) %7B%0A            if(this.isValid()) %7B%0A                this.stacks = new ItemStack%5B%5D%7Bthis.getPlant().toItemStack()%7D;%0A            %7D else %7B%0A                return new ItemStack%5B%5D%7B%7D;%0A            %7D%0A        %7D%0A        return this.stacks;%0A    %7D%0A%0A
     @Overrid

Make Plant ingredient return valid seed stacks