Package buildcraft.api.mj

Examples of buildcraft.api.mj.IBatteryObject


      final PowerReceiver ph = receptor.getPowerReceiver( side );

      if ( ph == null )
        return null;

      return new IBatteryObject() {

        @Override
        public void setEnergyStored(double mj)
        {
View Full Code Here


  private IBatteryObject getTargetBattery()
  {
    TileEntity te = getWorld().getTileEntity( tile.xCoord + side.offsetX, tile.yCoord + side.offsetY, tile.zCoord + side.offsetZ );
    if ( te != null )
    {
      IBatteryObject bo = MjAPI.getMjBattery( te, MjAPI.DEFAULT_POWER_FRAMEWORK, side.getOpposite() );
      if ( bo != null )
        return bo;
     
      return ((IMJ6) AppEng.instance.getIntegration( IntegrationType.MJ6 )).provider( te, side.getOpposite() );
    }
View Full Code Here

    {
      double totalRequiredPower = 0.0f;

      for (PartP2PBCPower g : getOutputs())
      {
        IBatteryObject o = g.getTargetBattery();
        if ( o != null )
          totalRequiredPower += o.getEnergyRequested();
      }

      return totalRequiredPower;
    }
    catch (GridAccessException e)
View Full Code Here

      TunnelCollection<PartP2PBCPower> outs = getOutputs();

      double outputs = 0;
      for (PartP2PBCPower g : outs)
      {
        IBatteryObject o = g.getTargetBattery();
        if ( o != null )
        {
          outputs = outputs + 1.0;
        }
      }

      if ( outputs < 0.0000001 )
        return 0;

      for (PartP2PBCPower g : outs)
      {
        IBatteryObject o = g.getTargetBattery();
        if ( o != null )
        {
          double fraction = originalInput / outputs;
          if ( cycleLimitMode )
            fraction = o.addEnergy( fraction );
          else
            fraction = o.addEnergy( fraction, ignoreCycleLimit );
          mj -= fraction;
        }
      }

      if ( mj > 0 )
      {
        for (PartP2PBCPower g : outs)
        {
          IBatteryObject o = g.getTargetBattery();
          if ( o != null )
          {
            if ( cycleLimitMode )
              mj = mj - o.addEnergy( mj );
            else
              mj = mj - o.addEnergy( mj, ignoreCycleLimit );
          }
        }
      }

      return originalInput - mj;
View Full Code Here

    {
      double totalRequiredPower = 0.0f;

      for (PartP2PBCPower g : getOutputs())
      {
        IBatteryObject o = g.getTargetBattery();
        if ( o != null )
          totalRequiredPower += o.getEnergyStored();
      }

      return totalRequiredPower;
    }
    catch (GridAccessException e)
View Full Code Here

    {
      double totalRequiredPower = 0.0f;

      for (PartP2PBCPower g : getOutputs())
      {
        IBatteryObject o = g.getTargetBattery();
        if ( o != null )
          totalRequiredPower += o.maxCapacity();
      }

      return totalRequiredPower;
    }
    catch (GridAccessException e)
View Full Code Here

    {
      double totalRequiredPower = 1000000000000.0;

      for (PartP2PBCPower g : getOutputs())
      {
        IBatteryObject o = g.getTargetBattery();
        if ( o != null )
          totalRequiredPower = Math.min( totalRequiredPower, o.minimumConsumption() );
      }

      return totalRequiredPower;
    }
    catch (GridAccessException e)
View Full Code Here

    {
      double totalRequiredPower = 1000000.0;

      for (PartP2PBCPower g : getOutputs())
      {
        IBatteryObject o = g.getTargetBattery();
        if ( o != null )
          totalRequiredPower = Math.min( totalRequiredPower, o.maxReceivedPerCycle() );
      }

      return totalRequiredPower;
    }
    catch (GridAccessException e)
View Full Code Here

TOP

Related Classes of buildcraft.api.mj.IBatteryObject

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.