// Path: src/main/java/cn/academy/energy/api/item/ImagEnergyItem.java
// public interface ImagEnergyItem {
// 
//     double getMaxEnergy();
// 
//     double getBandwidth();
// 
// 
// }
// 
// Path: src/main/java/cn/academy/support/EnergyItemHelper.java
// public interface EnergyItemManager {
// 
//     boolean isSupported(ItemStack stack);
// 
//     double getEnergy(ItemStack stack);
// 
//     void setEnergy(ItemStack stack, double energy);
// 
//     /**
//      * @return How much energy not transfered into stack(left)
//      */
//     double charge(ItemStack stack, double amt, boolean ignoreBandwidth);
// 
//     /**
//      * @return How much energy pulled out of stack
//      */
//     double pull(ItemStack stack, double amt, boolean ignoreBandwidth);
// 
// }
// 
// Path: src/main/java/cn/liutils/util/mc/StackUtils.java
// public class StackUtils {
// 
//     public static void dropItems(World world, int x, int y, int z, IInventory inv) {
//         Random rand = new Random();
// 
//         for (int i = 0; i < inv.getSizeInventory(); ++i) {
//             ItemStack stack = inv.getStackInSlot(i);
//             if (stack != null && stack.stackSize > 0) {
//                 float rx = rand.nextFloat() * 0.8F + 0.1F;
//                 float ry = rand.nextFloat() * 0.8F + 0.1F;
//                 float rz = rand.nextFloat() * 0.8F + 0.1F;
// 
//                 EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, stack.copy());
// 
//                 if (stack.hasTagCompound()) {
//                     entityItem.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
//                 }
// 
//                 float factor = 0.05F;
//                 entityItem.motionX = rand.nextGaussian() * factor;
//                 entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
//                 entityItem.motionZ = rand.nextGaussian() * factor;
//                 world.spawnEntityInWorld(entityItem);
//                 stack.stackSize = 0;
//             }
//         }
//     }
// 
//     /**
//      * Return whether two stack's item instance and data are equal.
//      */
//     public static boolean isStackDataEqual(ItemStack s1, ItemStack s2) {
//         if (s1.getItem() != s1.getItem())
//             return false;
//         NBTTagCompound tag1 = s1.getTagCompound(), tag2 = s2.getTagCompound();
//         if (tag1 == null || tag2 == null) {
//             return tag1 == null && tag2 == null;
//         }
// 
//         return tag1.equals(tag2);
//     }
// 
//     public static NBTTagCompound loadTag(ItemStack stack) {
//         NBTTagCompound ret = stack.getTagCompound();
//         if (ret == null)
//             stack.setTagCompound(new NBTTagCompound());
//         ret = stack.getTagCompound();
//         return ret;
//     }
// 
// }


import cn.liutils.util.mc.StackUtils;
import net.minecraft.item.ItemStack;
import cn.academy.energy.api.item.ImagEnergyItem;
import cn.academy.support.EnergyItemHelper.EnergyItemManager;
/**
 * Copyright (c) Lambda Innovation, 2013-2015
 * 本作品版权由Lambda Innovation所有。
 * http://www.li-dev.cn/
 * <p/>
 * This project is open-source, and it is distributed under
 * the terms of GNU General Public License. You can modify
 * and distribute freely as long as you follow the license.
 * 本项目是一个开源项目，且遵循GNU通用公共授权协议。
 * 在遵照该协议的情况下，您可以自由传播和修改。
 * http://www.gnu.org/licenses/gpl.html
 */
package cn.academy.energy.api;


/**
 * @author WeathFolD
 */
public final class IFItemManager implements EnergyItemManager {

    public static IFItemManager instance = new IFItemManager();

    private IFItemManager() {
    }

    public double getEnergy(ItemStack stack) {
// Path: src/main/java/cn/academy/energy/api/item/ImagEnergyItem.java
// public interface ImagEnergyItem {
// 
//     double getMaxEnergy();
// 
//     double getBandwidth();
// 
// 
// }
// 
// Path: src/main/java/cn/academy/support/EnergyItemHelper.java
// public interface EnergyItemManager {
// 
//     boolean isSupported(ItemStack stack);
// 
//     double getEnergy(ItemStack stack);
// 
//     void setEnergy(ItemStack stack, double energy);
// 
//     /**
//      * @return How much energy not transfered into stack(left)
//      */
//     double charge(ItemStack stack, double amt, boolean ignoreBandwidth);
// 
//     /**
//      * @return How much energy pulled out of stack
//      */
//     double pull(ItemStack stack, double amt, boolean ignoreBandwidth);
// 
// }
// 
// Path: src/main/java/cn/liutils/util/mc/StackUtils.java
// public class StackUtils {
// 
//     public static void dropItems(World world, int x, int y, int z, IInventory inv) {
//         Random rand = new Random();
// 
//         for (int i = 0; i < inv.getSizeInventory(); ++i) {
//             ItemStack stack = inv.getStackInSlot(i);
//             if (stack != null && stack.stackSize > 0) {
//                 float rx = rand.nextFloat() * 0.8F + 0.1F;
//                 float ry = rand.nextFloat() * 0.8F + 0.1F;
//                 float rz = rand.nextFloat() * 0.8F + 0.1F;
// 
//                 EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, stack.copy());
// 
//                 if (stack.hasTagCompound()) {
//                     entityItem.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
//                 }
// 
//                 float factor = 0.05F;
//                 entityItem.motionX = rand.nextGaussian() * factor;
//                 entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
//                 entityItem.motionZ = rand.nextGaussian() * factor;
//                 world.spawnEntityInWorld(entityItem);
//                 stack.stackSize = 0;
//             }
//         }
//     }
// 
//     /**
//      * Return whether two stack's item instance and data are equal.
//      */
//     public static boolean isStackDataEqual(ItemStack s1, ItemStack s2) {
//         if (s1.getItem() != s1.getItem())
//             return false;
//         NBTTagCompound tag1 = s1.getTagCompound(), tag2 = s2.getTagCompound();
//         if (tag1 == null || tag2 == null) {
//             return tag1 == null && tag2 == null;
//         }
// 
//         return tag1.equals(tag2);
//     }
// 
//     public static NBTTagCompound loadTag(ItemStack stack) {
//         NBTTagCompound ret = stack.getTagCompound();
//         if (ret == null)
//             stack.setTagCompound(new NBTTagCompound());
//         ret = stack.getTagCompound();
//         return ret;
//     }
// 
// }


// Path: src/main/java/cn/academy/energy/api/IFItemManager.java
import cn.liutils.util.mc.StackUtils;
import net.minecraft.item.ItemStack;
import cn.academy.energy.api.item.ImagEnergyItem;
import cn.academy.support.EnergyItemHelper.EnergyItemManager;

/**
 * Copyright (c) Lambda Innovation, 2013-2015
 * 本作品版权由Lambda Innovation所有。
 * http://www.li-dev.cn/
 * <p/>
 * This project is open-source, and it is distributed under
 * the terms of GNU General Public License. You can modify
 * and distribute freely as long as you follow the license.
 * 本项目是一个开源项目，且遵循GNU通用公共授权协议。
 * 在遵照该协议的情况下，您可以自由传播和修改。
 * http://www.gnu.org/licenses/gpl.html
 */
package cn.academy.energy.api;


/**
 * @author WeathFolD
 */
public final class IFItemManager implements EnergyItemManager {

    public static IFItemManager instance = new IFItemManager();

    private IFItemManager() {
    }

    public double getEnergy(ItemStack stack) {
        ImagEnergyItem item = (ImagEnergyItem) stack.getItem();