Package appeng.api.networking.energy

Examples of appeng.api.networking.energy.IEnergyGrid


        markForUpdate();
      }
    }
    else
    {
      IEnergyGrid eg;
      try
      {
        eg = gridProxy.getEnergy();
        IEnergySource src = this;

        // Base 1, increase by 1 for each card
        int speedFactor = 1 + upgrades.getInstalledUpgrades( Upgrades.SPEED );
        int powerConsumption = 10 * speedFactor;
        double powerThreshold = powerConsumption - 0.01;
        double powerReq = extractAEPower( powerConsumption, Actionable.SIMULATE, PowerMultiplier.CONFIG );

        if ( powerReq <= powerThreshold )
        {
          src = eg;
          powerReq = eg.extractAEPower( powerConsumption, Actionable.SIMULATE, PowerMultiplier.CONFIG );
        }

        if ( powerReq > powerThreshold )
        {
          src.extractAEPower( powerConsumption, Actionable.MODULATE, PowerMultiplier.CONFIG );
View Full Code Here


    delay++;
    if ( Platform.isServer() && delay > 15 && network != null )
    {
      delay = 0;

      IEnergyGrid eg = network.getCache( IEnergyGrid.class );
      if ( eg != null )
      {
        avgAddition = (long) (100.0 * eg.getAvgPowerInjection());
        powerUsage = (long) (100.0 * eg.getAvgPowerUsage());
        currentPower = (long) (100.0 * eg.getStoredPower());
        maxPower = (long) (100.0 * eg.getMaxStoredPower());
      }

      PacketMEInventoryUpdate piu;
      try
      {
View Full Code Here

      burnTime = 0;
    }

    try
    {
      IEnergyGrid grid = gridProxy.getEnergy();
      double newPower = timePassed * powerPerTick;
      double overFlow = grid.injectPower( newPower, Actionable.SIMULATE );

      // burn the over flow.
      grid.injectPower( Math.max( 0.0, newPower - overFlow ), Actionable.MODULATE );

      if ( overFlow > 0 )
        burnSpeed -= TicksSinceLastCall;
      else
        burnSpeed += TicksSinceLastCall;
View Full Code Here

      delay++;
      if ( delay > 15 && network != null )
      {
        delay = 0;

        IEnergyGrid eg = network.getCache( IEnergyGrid.class );
        ISpatialCache sc = network.getCache( ISpatialCache.class );
        if ( eg != null )
        {
          currentPower = (long) (100.0 * eg.getStoredPower());
          maxPower = (long) (100.0 * eg.getMaxStoredPower());
          reqPower = (long) (100.0 * sc.requiredPower());
          eff = (long) (100.0f * sc.currentEfficiency());
        }
      }
    }
 
View Full Code Here

  {
    if ( internalCurrentPower > 0 )
    {
      try
      {
        IEnergyGrid eg = gridProxy.getEnergy();
        double powerRequested = internalCurrentPower - eg.injectPower( internalCurrentPower, Actionable.SIMULATE );

        if ( powerRequested > 0 )
        {
          eg.injectPower( extractAEPower( powerRequested, Actionable.MODULATE, PowerMultiplier.ONE ), Actionable.MODULATE );
        }
      }
      catch (GridAccessException e)
      {
        // null net, probably bad.
View Full Code Here

  @Override
  protected double getFunnelPowerDemand(double maxRequired)
  {
    try
    {
      IEnergyGrid grid = gridProxy.getEnergy();
      return grid.getEnergyDemand( maxRequired );
    }
    catch (GridAccessException e)
    {
      return super.getFunnelPowerDemand( maxRequired );
    }
View Full Code Here

  @Override
  protected double funnelPowerIntoStorage(double newPower, Actionable mode)
  {
    try
    {
      IEnergyGrid grid = gridProxy.getEnergy();
      double leftOver = grid.injectPower( newPower, mode );
      if ( mode == Actionable.SIMULATE )
        return leftOver;
      return 0.0;
    }
    catch (GridAccessException e)
View Full Code Here

          IGrid g = gn.getGrid();
          if ( g != null )
          {
            if ( requirePower )
            {
              IEnergyGrid eg = g.getCache( IEnergyGrid.class );
              if ( !eg.isNetworkPowered() )
              {
                return false;
              }
            }
View Full Code Here

        IGrid g = gn.getGrid();
        if ( g != null )
        {
          if ( requirePower )
          {
            IEnergyGrid eg = g.getCache( IEnergyGrid.class );
            if ( !eg.isNetworkPowered() )
              return false;
          }

          ISecurityGrid sg = g.getCache( ISecurityGrid.class );
          if ( sg.hasPermission( invPlayer.player, perm ) )
View Full Code Here

  {
    IGrid g = getGrid();
    if ( g != null )
    {
      IPathingGrid pg = g.getCache( IPathingGrid.class );
      IEnergyGrid eg = g.getCache( IEnergyGrid.class );
      return meetsChannelRequirements() && eg.isNetworkPowered() && !pg.isNetworkBooting();
    }
    return false;
  }
View Full Code Here

TOP

Related Classes of appeng.api.networking.energy.IEnergyGrid

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.