// Path: src/main/java/de/keridos/floodlights/compatability/ModCompatibility.java
// @SuppressWarnings("WeakerAccess")
// public class ModCompatibility {
//     private static ModCompatibility instance = null;
// 
//     public static boolean IC2Loaded = false;
//     public static boolean BCLoaded = false;
//     public static boolean CofhCoreLoaded = false;
//     public static boolean NEILoaded = false;
//     public static boolean JEILoaded = false;
//     public static boolean EnderIOLoaded = false;
//     public static boolean WrenchAvailable = false;
//     public static boolean ColoredLightCoreLoaded = false;
//     public static boolean ACLoaded = false;
// 
// 
//     private ModCompatibility() {
//     }
// 
//     public static ModCompatibility getInstance() {
//         if (instance == null) {
//             instance = new ModCompatibility();
//         }
//         return instance;
//     }
// 
//     private void checkForMods() {
//         IC2Loaded = Loader.isModLoaded("ic2");
//         BCLoaded = ModAPIManager.INSTANCE.hasAPI("BuildCraftAPI|tools");
//         CofhCoreLoaded = ModAPIManager.INSTANCE.hasAPI("cofhapi");
//         NEILoaded = Loader.isModLoaded("notenoughitems");
//         JEILoaded = Loader.isModLoaded("jei");
//         EnderIOLoaded = Loader.isModLoaded("enderio");
//         ColoredLightCoreLoaded = Loader.isModLoaded("coloredlightcore");
//         ACLoaded = Loader.isModLoaded("agricraft");
//     }
// 
//     private void addVersionCheckerInfo() {
//         NBTTagCompound versionchecker = new NBTTagCompound();
//         versionchecker.setString("curseProjectName", "224728-floodlights");
//         versionchecker.setString("curseFilenameParser", "FloodLights-@MCVERSION@-[]");
//         versionchecker.setString("modDisplayName", "FloodLights");
//         versionchecker.setString("oldVersion", Reference.VERSION);
//         FMLInterModComms.sendRuntimeMessage("floodlights", "VersionChecker", "addCurseCheck", versionchecker);
//     }
// 
//     public void performModCompat() {
//         checkForMods();
//         if (ConfigHandler.IGWNotifierEnabled) {
//             new IGWSupportNotifier();
//         }
//         addVersionCheckerInfo();
//         //FMLInterModComms.sendMessage("Waila", "register", "de.keridos.floodlights.compatability.WailaTileHandler.callbackRegister");
//         WrenchAvailable = (BCLoaded || EnderIOLoaded || IC2Loaded || CofhCoreLoaded);
//     }
// 
//     @SuppressWarnings("ConstantConditions")
//     public boolean isItemValidWrench(ItemStack stack) {
//         return stack.getItem().getRegistryName().toString().equals("ic2:wrench")
//                 || stack.getItem().getRegistryName().toString().equals("ic2:wrench_new")
//                 || stack.getItem().getRegistryName().toString().equals("enderio:item_yeta_wrench")
//                 || stack.getItem().getRegistryName().toString().equals("thermalfoundation:wrench")
//                 || stack.getItem().getRegistryName().toString().equals("buildcraftcore:wrench");
//     }
// 
//     /*@Optional.Method(modid = "AgriCraft")
//     public boolean isBlockValidAgriCraftSeed(Block block, World world, BlockPos blockPos) {
//         if (block instanceof ICrop && ((APIv2) API.getAPI(2)).getCrop(world, blockPos.posX, blockPos.posY, blockPos.posZ).hasPlant() && ((APIv2) API.getAPI(2)).getCrop(world, blockPos.posX, blockPos.posY, blockPos.posZ).getPlant().getGrowthRequirement().canGrow(world, blockPos.posX, blockPos.posY, blockPos.posZ)) {
//             return true;
//         }
//         return false;
//     }        */
// }


import cofh.redstoneflux.api.IEnergyContainerItem;
import de.keridos.floodlights.compatability.ModCompatibility;
import ic2.api.item.IElectricItem;
import net.minecraft.block.Block;
import net.minecraft.block.IGrowable;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.*;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.world.World;
import net.minecraftforge.event.ForgeEventFactory;
import java.util.logging.Logger;

            //noinspection deprecation
            if (block.getMaterial(block.getStateFromMeta(itemStack.getItemDamage())) == Material.WOOD) {
                return 300;
            }

            if (block == Blocks.COAL_BLOCK) {
                return 14400;
            }
        }

        if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 200;
        if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 200;
        if (item instanceof ItemHoe && ((ItemHoe) item).getMaterialName().equals("WOOD")) return 200;
        if (item == Items.STICK) return 100;
        if (item == Items.COAL) return 1600;
        if (item == Items.LAVA_BUCKET) return 20000;
        if (item == Item.getItemFromBlock(Blocks.SAPLING)) return 100;
        if (item == Items.BLAZE_ROD) return 2400;
        return ForgeEventFactory.getItemBurnTime(itemStack);
    }

    public static boolean isItemStackValidElectrical(ItemStack itemStack) {
        Item item = itemStack.getItem();
        if (ModCompatibility.IC2Loaded) {
            if (item instanceof IElectricItem) {
                return ((IElectricItem) item).canProvideEnergy(itemStack);
            }
        }

// Path: src/main/java/de/keridos/floodlights/compatability/ModCompatibility.java
// @SuppressWarnings("WeakerAccess")
// public class ModCompatibility {
//     private static ModCompatibility instance = null;
// 
//     public static boolean IC2Loaded = false;
//     public static boolean BCLoaded = false;
//     public static boolean CofhCoreLoaded = false;
//     public static boolean NEILoaded = false;
//     public static boolean JEILoaded = false;
//     public static boolean EnderIOLoaded = false;
//     public static boolean WrenchAvailable = false;
//     public static boolean ColoredLightCoreLoaded = false;
//     public static boolean ACLoaded = false;
// 
// 
//     private ModCompatibility() {
//     }
// 
//     public static ModCompatibility getInstance() {
//         if (instance == null) {
//             instance = new ModCompatibility();
//         }
//         return instance;
//     }
// 
//     private void checkForMods() {
//         IC2Loaded = Loader.isModLoaded("ic2");
//         BCLoaded = ModAPIManager.INSTANCE.hasAPI("BuildCraftAPI|tools");
//         CofhCoreLoaded = ModAPIManager.INSTANCE.hasAPI("cofhapi");
//         NEILoaded = Loader.isModLoaded("notenoughitems");
//         JEILoaded = Loader.isModLoaded("jei");
//         EnderIOLoaded = Loader.isModLoaded("enderio");
//         ColoredLightCoreLoaded = Loader.isModLoaded("coloredlightcore");
//         ACLoaded = Loader.isModLoaded("agricraft");
//     }
// 
//     private void addVersionCheckerInfo() {
//         NBTTagCompound versionchecker = new NBTTagCompound();
//         versionchecker.setString("curseProjectName", "224728-floodlights");
//         versionchecker.setString("curseFilenameParser", "FloodLights-@MCVERSION@-[]");
//         versionchecker.setString("modDisplayName", "FloodLights");
//         versionchecker.setString("oldVersion", Reference.VERSION);
//         FMLInterModComms.sendRuntimeMessage("floodlights", "VersionChecker", "addCurseCheck", versionchecker);
//     }
// 
//     public void performModCompat() {
//         checkForMods();
//         if (ConfigHandler.IGWNotifierEnabled) {
//             new IGWSupportNotifier();
//         }
//         addVersionCheckerInfo();
//         //FMLInterModComms.sendMessage("Waila", "register", "de.keridos.floodlights.compatability.WailaTileHandler.callbackRegister");
//         WrenchAvailable = (BCLoaded || EnderIOLoaded || IC2Loaded || CofhCoreLoaded);
//     }
// 
//     @SuppressWarnings("ConstantConditions")
//     public boolean isItemValidWrench(ItemStack stack) {
//         return stack.getItem().getRegistryName().toString().equals("ic2:wrench")
//                 || stack.getItem().getRegistryName().toString().equals("ic2:wrench_new")
//                 || stack.getItem().getRegistryName().toString().equals("enderio:item_yeta_wrench")
//                 || stack.getItem().getRegistryName().toString().equals("thermalfoundation:wrench")
//                 || stack.getItem().getRegistryName().toString().equals("buildcraftcore:wrench");
//     }
// 
//     /*@Optional.Method(modid = "AgriCraft")
//     public boolean isBlockValidAgriCraftSeed(Block block, World world, BlockPos blockPos) {
//         if (block instanceof ICrop && ((APIv2) API.getAPI(2)).getCrop(world, blockPos.posX, blockPos.posY, blockPos.posZ).hasPlant() && ((APIv2) API.getAPI(2)).getCrop(world, blockPos.posX, blockPos.posY, blockPos.posZ).getPlant().getGrowthRequirement().canGrow(world, blockPos.posX, blockPos.posY, blockPos.posZ)) {
//             return true;
//         }
//         return false;
//     }        */
// }


// Path: src/main/java/de/keridos/floodlights/util/GeneralUtil.java
import cofh.redstoneflux.api.IEnergyContainerItem;
import de.keridos.floodlights.compatability.ModCompatibility;
import ic2.api.item.IElectricItem;
import net.minecraft.block.Block;
import net.minecraft.block.IGrowable;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.*;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.world.World;
import net.minecraftforge.event.ForgeEventFactory;
import java.util.logging.Logger;


            //noinspection deprecation
            if (block.getMaterial(block.getStateFromMeta(itemStack.getItemDamage())) == Material.WOOD) {
                return 300;
            }

            if (block == Blocks.COAL_BLOCK) {
                return 14400;
            }
        }

        if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 200;
        if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 200;
        if (item instanceof ItemHoe && ((ItemHoe) item).getMaterialName().equals("WOOD")) return 200;
        if (item == Items.STICK) return 100;
        if (item == Items.COAL) return 1600;
        if (item == Items.LAVA_BUCKET) return 20000;
        if (item == Item.getItemFromBlock(Blocks.SAPLING)) return 100;
        if (item == Items.BLAZE_ROD) return 2400;
        return ForgeEventFactory.getItemBurnTime(itemStack);
    }

    public static boolean isItemStackValidElectrical(ItemStack itemStack) {
        Item item = itemStack.getItem();
        if (ModCompatibility.IC2Loaded) {
            if (item instanceof IElectricItem) {
                return ((IElectricItem) item).canProvideEnergy(itemStack);
            }
        }

        return ModCompatibility.CofhCoreLoaded && item instanceof IEnergyContainerItem;