Tabnine Logo
IEnergyGrid
Code IndexAdd Tabnine to your IDE (free)

How to use
IEnergyGrid
in
appeng.api.networking.energy

Best Java code snippets using appeng.api.networking.energy.IEnergyGrid (Showing top 20 results out of 315)

origin: AppliedEnergistics/Applied-Energistics-2

private static boolean isPowered( final IGrid grid )
{
  if( grid == null )
  {
    return false;
  }
  final IEnergyGrid eg = grid.getCache( IEnergyGrid.class );
  return eg.isNetworkPowered();
}
origin: AppliedEnergistics/Applied-Energistics-2

@Override
public void onThresholdPass( final IEnergyGrid energyGrid )
{
  this.lastReportedValue = (long) energyGrid.getStoredPower();
  this.updateState();
}
origin: AppliedEnergistics/Applied-Energistics-2

private int userPower( final int ticksPassed, final int bonusValue, final double acceleratorTax )
{
  try
  {
    return (int) ( this.getProxy()
        .getEnergy()
        .extractAEPower( ticksPassed * bonusValue * acceleratorTax, Actionable.MODULATE,
            PowerMultiplier.CONFIG ) / acceleratorTax );
  }
  catch( final GridAccessException e )
  {
    return 0;
  }
}
origin: AppliedEnergistics/Applied-Energistics-2

if( eg != null )
  this.setAverageAddition( (long) ( 100.0 * eg.getAvgPowerInjection() ) );
  this.setPowerUsage( (long) ( 100.0 * eg.getAvgPowerUsage() ) );
  this.setCurrentPower( (long) ( 100.0 * eg.getStoredPower() ) );
  this.setMaxPower( (long) ( 100.0 * eg.getMaxStoredPower() ) );
origin: AppliedEnergistics/Applied-Energistics-2

if( eg != null )
  this.setCurrentPower( (long) ( 100.0 * eg.getStoredPower() ) );
  this.setMaxPower( (long) ( 100.0 * eg.getMaxStoredPower() ) );
  this.setRequiredPower( (long) ( 100.0 * sc.requiredPower() ) );
  this.setEfficency( (long) ( 100.0f * sc.currentEfficiency() ) );
origin: AppliedEnergistics/Applied-Energistics-2

this.outputMsg( player, "GridEnergy: " + eg.getStoredPower() + " : " + eg.getEnergyDemand( Double.MAX_VALUE ) );
origin: SquidDev-CC/plethora

@BasicObjectMethod.Inject(
  value = IGrid.class, modId = AppEng.MOD_ID,
  doc = "function():int -- Get the energy usage of this AE network"
)
public static Object[] getNetworkEnergyUsage(IContext<IGrid> context, Object[] args) {
  IEnergyGrid energy = context.getTarget().getCache(IEnergyGrid.class);
  return new Object[]{energy.getAvgPowerUsage()};
}
origin: AppliedEnergistics/Applied-Energistics-2

@Override
protected double getFunnelPowerDemand( final double maxReceived )
{
  try
  {
    final IEnergyGrid grid = this.getProxy().getEnergy();
    return grid.getEnergyDemand( maxReceived );
  }
  catch( final GridAccessException e )
  {
    // no grid? use local...
    return super.getFunnelPowerDemand( maxReceived );
  }
}
origin: AppliedEnergistics/Applied-Energistics-2

@Override
protected double getFunnelPowerDemand( final double maxRequired )
{
  try
  {
    final IEnergyGrid grid = this.getProxy().getEnergy();
    return grid.getEnergyDemand( maxRequired );
  }
  catch( final GridAccessException e )
  {
    return this.getInternalMaxPower();
  }
}
origin: AppliedEnergistics/Applied-Energistics-2

public boolean isPowered()
{
  try
  {
    return this.getEnergy().isNetworkPowered();
  }
  catch( final GridAccessException e )
  {
    return false;
  }
}
origin: SquidDev-CC/plethora

@BasicObjectMethod.Inject(
  value = IGrid.class, modId = AppEng.MOD_ID,
  doc = "function():int -- Get the energy stored usage in this AE network"
)
public static Object[] getNetworkEnergyStored(IContext<IGrid> context, Object[] args) {
  IEnergyGrid energy = context.getTarget().getCache(IEnergyGrid.class);
  return new Object[]{energy.getStoredPower()};
}
origin: AppliedEnergistics/Applied-Energistics-2

protected void queueTunnelDrain( final PowerUnits unit, final double f )
{
  final double ae_to_tax = unit.convertTo( PowerUnits.AE, f * AEConfig.TUNNEL_POWER_LOSS );
  try
  {
    this.getProxy().getEnergy().extractAEPower( ae_to_tax, Actionable.MODULATE, PowerMultiplier.ONE );
  }
  catch( final GridAccessException e )
  {
    // :P
  }
}
origin: AppliedEnergistics/Applied-Energistics-2

public boolean isPowered()
{
  if( Platform.isClient() )
  {
    return ( this.constructed & this.powered ) == this.powered && this.constructed != -1;
  }
  try
  {
    return this.getProxy().getEnergy().isNetworkPowered();
  }
  catch( final GridAccessException e )
  {
    // :P
  }
  return false;
}
origin: AppliedEnergistics/Applied-Energistics-2

this.lastReportedValue = (long) this.getProxy().getEnergy().getStoredPower();
this.updateState();
origin: AppliedEnergistics/Applied-Energistics-2

@Override
protected double extractAEPower( final double amt, final Actionable mode )
{
  double stash = 0.0;
  try
  {
    final IEnergyGrid eg = this.getProxy().getEnergy();
    stash = eg.extractAEPower( amt, mode, PowerMultiplier.ONE );
    if( stash >= amt )
    {
      return stash;
    }
  }
  catch( final GridAccessException e )
  {
    // no grid :(
  }
  // local battery!
  return super.extractAEPower( amt - stash, mode ) + stash;
}
origin: AppliedEnergistics/Applied-Energistics-2

@Override
public boolean isPowered()
{
  if( Platform.isServer() )
  {
    try
    {
      return this.getProxy().getEnergy().isNetworkPowered();
    }
    catch( final GridAccessException e )
    {
      return false;
    }
  }
  return this.hasPower;
}
origin: AppliedEnergistics/Applied-Energistics-2

private void updatePowerState()
{
  boolean newState = false;
  try
  {
    newState = this.getProxy().isActive() && this.getProxy().getEnergy().extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.0001;
  }
  catch( final GridAccessException ignored )
  {
  }
  if( newState != this.isPowered )
  {
    this.isPowered = newState;
    this.markForUpdate();
  }
}
origin: AppliedEnergistics/Applied-Energistics-2

@Override
public final boolean isPowered()
{
  try
  {
    if( Platform.isServer() )
    {
      return this.getProxy().getEnergy().isNetworkPowered();
    }
    else
    {
      return( ( this.getClientFlags() & PartPanel.POWERED_FLAG ) == PartPanel.POWERED_FLAG );
    }
  }
  catch( final GridAccessException e )
  {
    return false;
  }
}
origin: AppliedEnergistics/Applied-Energistics-2

private boolean storeFluid( IAEFluidStack stack, boolean modulate )
{
  try
  {
    final IStorageGrid storage = this.getProxy().getStorage();
    final IMEInventory<IAEFluidStack> inv = storage.getInventory( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) );
    if( modulate )
    {
      final IEnergyGrid energy = this.getProxy().getEnergy();
      return Platform.poweredInsert( energy, inv, stack, this.mySrc ) == null;
    }
    else
    {
      final float requiredPower = stack.getStackSize() / Math.min( 1.0f, stack.getChannel().transferFactor() );
      final IEnergyGrid energy = this.getProxy().getEnergy();
      if( energy.extractAEPower( requiredPower, Actionable.SIMULATE, PowerMultiplier.CONFIG ) < requiredPower )
      {
        return false;
      }
      final IAEFluidStack leftOver = inv.injectItems( stack, Actionable.SIMULATE, this.mySrc );
      return leftOver == null || leftOver.getStackSize() == 0;
    }
  }
  catch( final GridAccessException e )
  {
    // :P
  }
  return false;
}
origin: AppliedEnergistics/Applied-Energistics-2

@Override
public void writeToStream( final ByteBuf data ) throws IOException
{
  super.writeToStream( data );
  try
  {
    data.writeBoolean( this.getProxy().getEnergy().isNetworkPowered() );
  }
  catch( final GridAccessException e )
  {
    data.writeBoolean( false );
  }
}
appeng.api.networking.energyIEnergyGrid

Most used methods

  • isNetworkPowered
  • getAvgPowerUsage
  • getStoredPower
  • extractAEPower
  • getAvgPowerInjection
  • getEnergyDemand
  • getMaxStoredPower
  • injectPower

Popular in Java

  • Making http requests using okhttp
  • findViewById (Activity)
  • getContentResolver (Context)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now