Package appeng.me

Examples of appeng.me.GridNode


  }

  @Override
  public boolean visitNode(IGridNode n)
  {
    GridNode gn = (GridNode) n;
    gn.setControllerRoute( null, true );
    gn.incrementChannelCount( usedChannels );
    gn.finalizeChannels();
    return true;
  }
View Full Code Here


{

  @Override
  public boolean visitNode(IGridNode n)
  {
    GridNode gn = (GridNode) n;
    gn.finalizeChannels();
    return true;
  }
View Full Code Here

  @MENetworkEventSubscribe
  public void EnergyNodeChanges(MENetworkPowerIdleChange ev)
  {
    // update power usage based on event.
    GridNode node = (GridNode) ev.node;
    IGridBlock gb = node.getGridBlock();

    double newDraw = gb.getIdlePowerUsage();
    double diffDraw = newDraw - node.previousDraw;
    node.previousDraw = newDraw;
View Full Code Here

  {
    if ( machine instanceof IEnergyGridProvider )
      energyGridProviders.add( (IEnergyGridProvider) machine );

    // idle draw...
    GridNode gridNode = (GridNode) node;
    IGridBlock gb = gridNode.getGridBlock();
    gridNode.previousDraw = gb.getIdlePowerUsage();
    drainPerTick += gridNode.previousDraw;

    // power storage
    if ( machine instanceof IAEPowerStorage )
View Full Code Here

  {
    if ( machine instanceof IEnergyGridProvider )
      energyGridProviders.remove( machine );

    // idle draw.
    GridNode gridNode = (GridNode) node;
    drainPerTick -= gridNode.previousDraw;

    // power storage.
    if ( machine instanceof IAEPowerStorage )
    {
View Full Code Here

    {
      TileEntity te = world.getTileEntity( x, y, z );

      if ( te instanceof IGridHost )
      {
        GridNode node = (GridNode) ((IGridHost) te).getGridNode( ForgeDirection.getOrientation( side ) );
        if ( node != null )
        {
          Grid g = node.getInternalGrid();
          IGridNode center = g.getPivot();
          outputMsg( player, "This Node: " + node.toString() );
          outputMsg( player, "Center Node: " + center.toString() );
         
          IPathingGrid pg = g.getCache( IPathingGrid.class );
          if ( pg.getControllerState() == ControllerState.CONTROLLER_ONLINE )
          {
            int length = 0;
           
            HashSet<IGridNode> next = new HashSet<IGridNode>();
            next.add( node );
           
            int maxLength = 10000;
           
            outer: while ( ! next.isEmpty() )
            {
              HashSet<IGridNode> current = next;
              next = new HashSet<IGridNode>();
             
              for ( IGridNode n : current )
              {
                if ( n.getMachine() instanceof TileController )
                  break outer;
               
                for ( IGridConnection c : n.getConnections() )
                  next.add( c.getOtherSide( n ) );
              }
             
              length++;
             
              if ( length > maxLength )
                break;
            }
           
            outputMsg( player, "Cable Distance: " + length );
          }
         
          if ( center.getMachine() instanceof PartP2PTunnel )
          {
            outputMsg( player, "Freq: " + ((PartP2PTunnel) center.getMachine()).freq );
          }

          TickManagerCache tmc = g.getCache( ITickManager.class );
          for (Class c : g.getMachineClasses())
          {
            int o = 0;
            long nanos = 0;
            for (IGridNode oj : g.getMachines( c ))
            {
              o++;
              nanos += tmc.getAvgNanoTime( oj );
            }

            if ( nanos < 0 )
            {
              outputMsg( player, c.getSimpleName() + " - " + o );
            }
            else
            {
              outputMsg( player, c.getSimpleName() + " - " + o + "; " + timeMeasurement( nanos ) );
            }
          }
        }
        else
          outputMsg( player, "No Node Available." );
      }
      else
        outputMsg( player, "Not Networked Block" );

      if ( te instanceof IPartHost )
      {
        IPart center = ((IPartHost) te).getPart( ForgeDirection.UNKNOWN );
        ((IPartHost) te).markForUpdate();
        if ( center != null )
        {
          GridNode n = (GridNode) center.getGridNode();
          outputMsg( player, "Node Channels: " + n.usedChannels() );
          for (IGridConnection gc : n.getConnections())
          {
            ForgeDirection fd = gc.getDirection( n );
            if ( fd != ForgeDirection.UNKNOWN )
              outputMsg( player, fd.toString() + ": " + gc.getUsedChannels() );
          }
View Full Code Here

  @Override
  public IGridNode createGridNode(IGridBlock blk)
  {
    if ( Platform.isClient() )
      throw new RuntimeException( "Grid Features are Server Side Only." );
    return new GridNode( blk );
  }
View Full Code Here

TOP

Related Classes of appeng.me.GridNode

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.