// Path: src/main/java/cn/academy/energy/api/block/IWirelessNode.java
// public interface IWirelessNode extends IWirelessTile {
// 
//     double getMaxEnergy();
// 
//     double getEnergy();
// 
//     void setEnergy(double value);
// 
//     /**
//      * @return How many energy that this node can transfer each tick.
//      */
//     double getBandwidth();
// 
//     int getCapacity();
// 
//     /**
//      * @return How far this node's signal can reach.
//      */
//     double getRange();
// 
//     /**
//      * @return the user custom name of the node
//      */
//     String getNodeName();
// 
// }
// 
// Path: src/main/java/cn/academy/support/EnergyBlockHelper.java
// public class EnergyBlockHelper {
// 
//     private static List<IEnergyBlockManager> handlers = new ArrayList();
// 
//     public static void register(IEnergyBlockManager handler) {
//         handlers.add(handler);
//     }
// 
//     public static boolean isSupported(TileEntity tile) {
//         for (IEnergyBlockManager handler : handlers)
//             if (handler.isSupported(tile))
//                 return true;
//         return false;
//     }
// 
//     public static double getEnergy(TileEntity tile) {
//         for (IEnergyBlockManager handler : handlers)
//             if (handler.isSupported(tile))
//                 return handler.getEnergy(tile);
//         return 0;
//     }
// 
//     public static void setEnergy(TileEntity tile, double energy) {
//         for (IEnergyBlockManager handler : handlers)
//             if (handler.isSupported(tile)) {
//                 handler.setEnergy(tile, energy);
//                 break;
//             }
//     }
// 
//     public static double charge(TileEntity tile, double amt, boolean ignoreBandwidth) {
//         for (IEnergyBlockManager handler : handlers)
//             if (handler.isSupported(tile)) {
//                 return handler.charge(tile, amt, ignoreBandwidth);
//             }
//         return amt;
//     }
// 
//     public static double pull(TileEntity tile, double amt, boolean ignoreBandwidth) {
//         for (IEnergyBlockManager handler : handlers)
//             if (handler.isSupported(tile)) {
//                 return handler.pull(tile, amt, ignoreBandwidth);
//             }
//         return 0;
//     }
// 
//     public static interface IEnergyBlockManager {
// 
//         boolean isSupported(TileEntity tile);
// 
//         double getEnergy(TileEntity tile);
// 
//         void setEnergy(TileEntity tile, double energy);
// 
//         /**
//          * Charge a specified amount of energy into the tile.
//          *
//          * @return How much energy not charged into the tile(left)
//          */
//         double charge(TileEntity tile, double amt, boolean ignoreBandwidth);
// 
//         /**
//          * Pull a specified amount of energy from the energy tile.
//          *
//          * @return How much energy pulled out
//          */
//         double pull(TileEntity tile, double amt, boolean ignoreBandwidth);
// 
//     }
// 
// }
// 
// Path: src/main/java/cn/academy/support/EnergyBlockHelper.java
// public static interface IEnergyBlockManager {
// 
//     boolean isSupported(TileEntity tile);
// 
//     double getEnergy(TileEntity tile);
// 
//     void setEnergy(TileEntity tile, double energy);
// 
//     /**
//      * Charge a specified amount of energy into the tile.
//      *
//      * @return How much energy not charged into the tile(left)
//      */
//     double charge(TileEntity tile, double amt, boolean ignoreBandwidth);
// 
//     /**
//      * Pull a specified amount of energy from the energy tile.
//      *
//      * @return How much energy pulled out
//      */
//     double pull(TileEntity tile, double amt, boolean ignoreBandwidth);
// 
// }


import cn.academy.energy.api.block.IWirelessNode;
import cn.academy.support.EnergyBlockHelper;
import cn.academy.support.EnergyBlockHelper.IEnergyBlockManager;
import cn.annoreg.core.Registrant;
import net.minecraft.tileentity.TileEntity;
/**
 * 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
 */
@Registrant
public class IFNodeManager implements IEnergyBlockManager {

    public static IFNodeManager instance = new IFNodeManager();

    private IFNodeManager() {
        EnergyBlockHelper.register(this);
    }

    @Override
    public boolean isSupported(TileEntity tile) {
        return tile instanceof IWirelessNode;
    }

    @Override
    public double getEnergy(TileEntity tile) {
        return ((IWirelessNode) tile).getEnergy();
    }

    @Override
    public void setEnergy(TileEntity tile, double energy) {
        ((IWirelessNode) tile).setEnergy(energy);
    }

// Path: src/main/java/cn/academy/energy/api/block/IWirelessNode.java
// public interface IWirelessNode extends IWirelessTile {
// 
//     double getMaxEnergy();
// 
//     double getEnergy();
// 
//     void setEnergy(double value);
// 
//     /**
//      * @return How many energy that this node can transfer each tick.
//      */
//     double getBandwidth();
// 
//     int getCapacity();
// 
//     /**
//      * @return How far this node's signal can reach.
//      */
//     double getRange();
// 
//     /**
//      * @return the user custom name of the node
//      */
//     String getNodeName();
// 
// }
// 
// Path: src/main/java/cn/academy/support/EnergyBlockHelper.java
// public class EnergyBlockHelper {
// 
//     private static List<IEnergyBlockManager> handlers = new ArrayList();
// 
//     public static void register(IEnergyBlockManager handler) {
//         handlers.add(handler);
//     }
// 
//     public static boolean isSupported(TileEntity tile) {
//         for (IEnergyBlockManager handler : handlers)
//             if (handler.isSupported(tile))
//                 return true;
//         return false;
//     }
// 
//     public static double getEnergy(TileEntity tile) {
//         for (IEnergyBlockManager handler : handlers)
//             if (handler.isSupported(tile))
//                 return handler.getEnergy(tile);
//         return 0;
//     }
// 
//     public static void setEnergy(TileEntity tile, double energy) {
//         for (IEnergyBlockManager handler : handlers)
//             if (handler.isSupported(tile)) {
//                 handler.setEnergy(tile, energy);
//                 break;
//             }
//     }
// 
//     public static double charge(TileEntity tile, double amt, boolean ignoreBandwidth) {
//         for (IEnergyBlockManager handler : handlers)
//             if (handler.isSupported(tile)) {
//                 return handler.charge(tile, amt, ignoreBandwidth);
//             }
//         return amt;
//     }
// 
//     public static double pull(TileEntity tile, double amt, boolean ignoreBandwidth) {
//         for (IEnergyBlockManager handler : handlers)
//             if (handler.isSupported(tile)) {
//                 return handler.pull(tile, amt, ignoreBandwidth);
//             }
//         return 0;
//     }
// 
//     public static interface IEnergyBlockManager {
// 
//         boolean isSupported(TileEntity tile);
// 
//         double getEnergy(TileEntity tile);
// 
//         void setEnergy(TileEntity tile, double energy);
// 
//         /**
//          * Charge a specified amount of energy into the tile.
//          *
//          * @return How much energy not charged into the tile(left)
//          */
//         double charge(TileEntity tile, double amt, boolean ignoreBandwidth);
// 
//         /**
//          * Pull a specified amount of energy from the energy tile.
//          *
//          * @return How much energy pulled out
//          */
//         double pull(TileEntity tile, double amt, boolean ignoreBandwidth);
// 
//     }
// 
// }
// 
// Path: src/main/java/cn/academy/support/EnergyBlockHelper.java
// public static interface IEnergyBlockManager {
// 
//     boolean isSupported(TileEntity tile);
// 
//     double getEnergy(TileEntity tile);
// 
//     void setEnergy(TileEntity tile, double energy);
// 
//     /**
//      * Charge a specified amount of energy into the tile.
//      *
//      * @return How much energy not charged into the tile(left)
//      */
//     double charge(TileEntity tile, double amt, boolean ignoreBandwidth);
// 
//     /**
//      * Pull a specified amount of energy from the energy tile.
//      *
//      * @return How much energy pulled out
//      */
//     double pull(TileEntity tile, double amt, boolean ignoreBandwidth);
// 
// }


// Path: src/main/java/cn/academy/energy/api/IFNodeManager.java
import cn.academy.energy.api.block.IWirelessNode;
import cn.academy.support.EnergyBlockHelper;
import cn.academy.support.EnergyBlockHelper.IEnergyBlockManager;
import cn.annoreg.core.Registrant;
import net.minecraft.tileentity.TileEntity;

/**
 * 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
 */
@Registrant
public class IFNodeManager implements IEnergyBlockManager {

    public static IFNodeManager instance = new IFNodeManager();

    private IFNodeManager() {
        EnergyBlockHelper.register(this);
    }

    @Override
    public boolean isSupported(TileEntity tile) {
        return tile instanceof IWirelessNode;
    }

    @Override
    public double getEnergy(TileEntity tile) {
        return ((IWirelessNode) tile).getEnergy();
    }

    @Override
    public void setEnergy(TileEntity tile, double energy) {
        ((IWirelessNode) tile).setEnergy(energy);
    }

    @Override