package com.blamejared.compat.actuallyaddition;

import com.blamejared.ModTweaker;
import com.blamejared.mtlib.helpers.*;
import com.blamejared.mtlib.utils.*;
import crafttweaker.annotations.*;
import crafttweaker.api.item.IItemStack;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
import stanhebben.zenscript.annotations.Optional;
import stanhebben.zenscript.annotations.*;

import java.util.*;

@ZenClass("mods.actuallyadditions.Empowerer")
@ModOnly("actuallyadditions")
@ZenRegister
public class Empowerer {
    
    @ZenMethod
    public static void addRecipe(IItemStack output, IItemStack input, IItemStack modifier1, IItemStack modifier2, IItemStack modifier3, IItemStack modifier4, int energyPerStand, int time, @Optional float[] particleColourArray) {
        if(particleColourArray == null || particleColourArray.length == 0) {
            particleColourArray = new float[]{0, 0, 0};
        }
        ModTweaker.LATE_ADDITIONS.add(new Add(Collections.singletonList(new EmpowererRecipe(InputHelper.toStack(input), InputHelper.toStack(output), InputHelper.toStack(modifier1), InputHelper.toStack(modifier2), InputHelper.toStack(modifier3), InputHelper.toStack(modifier4), energyPerStand, time, particleColourArray))));
    }
    
    @ZenMethod
    public static void removeRecipe(IItemStack output) {
        ModTweaker.LATE_REMOVALS.add(new Remove(output));
    }
    
    private static class Add extends BaseListAddition<EmpowererRecipe> {
        
        protected Add(List<EmpowererRecipe> recipes) {
            super("Empowerer", ActuallyAdditionsAPI.EMPOWERER_RECIPES, recipes);
        }
        
        @Override
        protected String getRecipeInfo(EmpowererRecipe recipe) {
            return LogHelper.getStackDescription(recipe.getOutput());
        }
        
    }
    
    public static class Remove extends BaseListRemoval<EmpowererRecipe> {
        
        private IItemStack output;
        
        protected Remove(IItemStack output) {
            super("Empowerer", ActuallyAdditionsAPI.EMPOWERER_RECIPES);
            this.output = output;
        }
        
        @Override
        public void apply() {
            for(EmpowererRecipe recipe : ActuallyAdditionsAPI.EMPOWERER_RECIPES) {
                if(output.matches(InputHelper.toIItemStack(recipe.getOutput()))) {
                    recipes.add(recipe);
                }
            }
            super.apply();
        }
        
        @Override
        protected String getRecipeInfo(EmpowererRecipe recipe) {
            return LogHelper.getStackDescription(recipe.getOutput());
        }
        
    }
    
}
@@ -218,24 +218,116 @@
 .item.II
-temStack
+ngredient;%0Aimport crafttweaker.api.item.IItemStack;%0Aimport crafttweaker.api.minecraft.CraftTweakerMC
 ;%0Aimport
@@ -749,24 +749,25 @@
 tput, II
-temStack
+ngredient
  input, 
@@ -764,32 +764,33 @@
 nt input, II
-temStack
+ngredient
  modifier1, 
@@ -787,32 +787,33 @@
 odifier1, II
-temStack
+ngredient
  modifier2, 
@@ -810,32 +810,33 @@
 odifier2, II
-temStack
+ngredient
  modifier3, 
@@ -837,24 +837,25 @@
 ier3, II
-temStack
+ngredient
  modifie
@@ -1164,35 +1164,44 @@
 rRecipe(
-InputHelper.toStack
+CraftTweakerMC.getIngredient
 (input),
@@ -1234,123 +1234,159 @@
 t), 
-InputHelper.toStack(modifier1), InputHelper.toStack(modifier2), InputHelper.toStack(modifier3), InputHelper.toStack
+CraftTweakerMC.getIngredient(modifier1), CraftTweakerMC.getIngredient(modifier2), CraftTweakerMC.getIngredient(modifier3), CraftTweakerMC.getIngredient
 (mod

Add Ore Dictionary support for the empowerer