package com.mcmoddev.modernmetals.integration.plugins;

import java.util.Arrays;
import java.util.List;

import com.mcmoddev.lib.init.Materials;
import com.mcmoddev.lib.integration.IIntegration;
import com.mcmoddev.lib.integration.MMDPlugin;
import com.mcmoddev.lib.util.ConfigBase.Options;
import com.mcmoddev.modernmetals.ModernMetals;
import com.mcmoddev.modernmetals.data.MaterialNames;

import net.minecraft.item.crafting.IRecipe;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

@MMDPlugin(addonId = ModernMetals.MODID, pluginId = IC2.PLUGIN_MODID)
public class IC2 extends com.mcmoddev.lib.integration.plugins.IC2Base implements IIntegration {

	@Override
	public void init() {
		if (!Options.isModEnabled(PLUGIN_MODID)) {
			return;
		}
	}

	@SubscribeEvent
	public void multiplyOres(RegistryEvent.Register<IRecipe> event) {
		final List<String> materials = Arrays.asList(MaterialNames.ALUMINUM, MaterialNames.BERYLLIUM,
				MaterialNames.BORON, MaterialNames.CADMIUM, MaterialNames.CHROMIUM, MaterialNames.IRIDIUM,
				MaterialNames.MAGNESIUM, MaterialNames.MANGANESE, MaterialNames.PLUTONIUM, MaterialNames.RUTILE,
				MaterialNames.TANTALUM, MaterialNames.THORIUM, MaterialNames.TITANIUM, MaterialNames.TUNGSTEN,
				MaterialNames.URANIUM, MaterialNames.ZIRCONIUM);

		materials.stream().filter(Materials::hasMaterial)
				.filter(materialName -> !Materials.getMaterialByName(materialName).isEmpty())
				.forEach(materialName -> {
					registerVanillaRecipes(materialName);
					addMaceratorRecipes(materialName);
					addOreWashingPlantRecipes(materialName);
					addThermalCentrifugeRecipes(materialName);
					addMetalFormerRecipes(materialName);
					addCompressorRecipes(materialName);
				});
	}
}

@@ -429,16 +429,65 @@
 Recipe;%0A
+import net.minecraftforge.common.MinecraftForge;%0A
 import n
@@ -660,16 +660,48 @@
 IN_MODID
+, initCallback=%22doHammerRecipes%22
 )%0Apublic
@@ -884,16 +884,59 @@
 rn;%0A%09%09%7D%0A
+%09%09MinecraftForge.EVENT_BUS.register(this);%0A
 %09%7D%0A%0A%09@Su
@@ -1414,31 +1414,8 @@
 %09%09%09%09
-MaterialNames.URANIUM, 
 Mate
@@ -1873,10 +1873,605 @@
 %09%7D);%0A%09%7D%0A
+%09%0A%09public void doHammerRecipes() %7B%0A%09%09Arrays.asList(MaterialNames.ALUMINUM, MaterialNames.BERYLLIUM,%0A%09%09%09%09MaterialNames.BORON, MaterialNames.CADMIUM, MaterialNames.CHROMIUM, MaterialNames.IRIDIUM,%0A%09%09%09%09MaterialNames.MAGNESIUM, MaterialNames.MANGANESE, MaterialNames.PLUTONIUM, MaterialNames.RUTILE,%0A%09%09%09%09MaterialNames.TANTALUM, MaterialNames.THORIUM, MaterialNames.TITANIUM, MaterialNames.TUNGSTEN,%0A%09%09%09%09MaterialNames.URANIUM, MaterialNames.ZIRCONIUM).stream()%0A%09%09.filter(Materials::hasMaterial)%0A%09%09.filter(name-%3E!Materials.getMaterialByName(name).isEmpty())%0A%09%09.forEach(this::addForgeHammerRecipe);%0A%09%7D%0A
 %7D%0A

fix ic2 integrations (#91)