Package mekanism.api.energy

Examples of mekanism.api.energy.IStrictEnergyAcceptor


        continue;
      }

      if(acceptor instanceof IStrictEnergyAcceptor)
      {
        IStrictEnergyAcceptor handler = (IStrictEnergyAcceptor)acceptor;

        if(handler.canReceiveEnergy(side.getOpposite()))
        {
          if(handler.getMaxEnergy() - handler.getEnergy() > 0)
          {
            toReturn.add(acceptor);
            continue;
          }
        }
      }
      else if(MekanismUtils.useRF() && acceptor instanceof IEnergyReceiver)
      {
        IEnergyReceiver handler = (IEnergyReceiver)acceptor;

        if(handler.canConnectEnergy(side.getOpposite()))
        {
          if(handler.receiveEnergy(side.getOpposite(), 1, true) > 0)
          {
            toReturn.add(acceptor);
            continue;
          }
        }
      }
      else if(MekanismUtils.useIC2() && acceptor instanceof IEnergySink)
      {
        IEnergySink handler = (IEnergySink)acceptor;

        if(handler.acceptsEnergyFrom(null, side.getOpposite()))
        {
          double demanded = handler.getDemandedEnergy()*Mekanism.FROM_IC2;
          int tier = Math.min(handler.getSinkTier(), 8);
          double max = EnergyNet.instance.getPowerFromTier(tier)*Mekanism.FROM_IC2;
         
          if(Math.min(demanded, max) > 0)
          {
            toReturn.add(acceptor);
View Full Code Here


  {
    double sent = 0;

    if(tileEntity instanceof IStrictEnergyAcceptor)
    {
      IStrictEnergyAcceptor acceptor = (IStrictEnergyAcceptor)tileEntity;

      if(acceptor.canReceiveEnergy(side.getOpposite()))
      {
        sent += acceptor.transferEnergyToAcceptor(side.getOpposite(), currentSending);
      }
    }
    else if(MekanismUtils.useRF() && tileEntity instanceof IEnergyReceiver)
    {
      IEnergyReceiver handler = (IEnergyReceiver)tileEntity;
View Full Code Here

   
    public static float otherModsEnergyTransfer(TileEntity tileAdj, ForgeDirection inputAdj, float toSend, boolean simulate)
    {
        if (isMekLoaded && tileAdj instanceof IStrictEnergyAcceptor)
        {
            IStrictEnergyAcceptor tileMek = (IStrictEnergyAcceptor) tileAdj;
            if (tileMek.canReceiveEnergy(inputAdj))
            {
              float transferredMek;
              if (simulate)
                transferredMek = tileMek.canReceiveEnergy(inputAdj) ? (float) (tileMek.getMaxEnergy() - tileMek.getEnergy()) : 0F;
              else
                transferredMek = (float) tileMek.transferEnergyToAcceptor(inputAdj, toSend * EnergyConfigHandler.TO_MEKANISM_RATIO);
                return transferredMek * EnergyConfigHandler.MEKANISM_RATIO;
            }
        }
        else if (isIC2Loaded && tileAdj instanceof IEnergySink)
        {
View Full Code Here

TOP

Related Classes of mekanism.api.energy.IStrictEnergyAcceptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.