Examples of IGridNode


Examples of appeng.api.networking.IGridNode

          }
        }

        if ( con != null )
        {
          IGridNode os = con.getOtherSide( this );
          if ( os == node )
          {
            // if this connection is no longer valid, destroy it.
            if ( !isValidConnection )
              con.destroy();
View Full Code Here

Examples of appeng.api.networking.IGridNode

  {
    Connections.add( gridConnection );
    if ( gridConnection.hasDirection() )
      gridProxy.onGridNotification( GridNotification.ConnectionsChanged );

    final IGridNode gn = this;

    Collections.sort( Connections, new Comparator<IGridConnection>() {

      @Override
      public int compare(IGridConnection o1, IGridConnection o2)
View Full Code Here

Examples of appeng.api.networking.IGridNode

    bch.addBox( min, min, min, max, max, max );

    if ( Platform.isServer() )
    {
      IGridNode n = getGridNode();
      if ( n != null )
        connections = n.getConnectedSides();
      else
        connections.clear();
    }

    for (ForgeDirection of : connections)
View Full Code Here

Examples of appeng.api.networking.IGridNode

  {
    bch.addBox( 5.0, 5.0, 5.0, 11.0, 11.0, 11.0 );

    if ( Platform.isServer() )
    {
      IGridNode n = getGridNode();
      if ( n != null )
        connections = n.getConnectedSides();
      else
        connections.clear();
    }

    for (ForgeDirection of : connections)
View Full Code Here

Examples of appeng.api.networking.IGridNode

  {
    bch.addBox( 5.0, 5.0, 5.0, 11.0, 11.0, 11.0 );

    if ( Platform.isServer() )
    {
      IGridNode n = getGridNode();
      if ( n != null )
        connections = n.getConnectedSides();
      else
        connections.clear();
    }

    for (ForgeDirection of : connections)
View Full Code Here

Examples of appeng.api.networking.IGridNode

        return gridProxy.getSecurity().hasPermission( ((PlayerSource) src).player, SecurityPermissions.BUILD );
      }
      else if ( src.isMachine() )
      {
        IActionHost te = ((MachineSource) src).via;
        IGridNode n = te.getActionableNode();
        if ( n == null )
          return false;

        int playerID = n.getPlayerID();
        return gridProxy.getSecurity().hasPermission( playerID, SecurityPermissions.BUILD );
      }
      else
        return false;
    }
View Full Code Here

Examples of appeng.api.networking.IGridNode

        if ( te instanceof IGridHost )
        {
          IGridHost gh = (IGridHost) te;
          ForgeDirection sideOff = ForgeDirection.getOrientation( src_side );
          ForgeDirection currentSideOff = ForgeDirection.getOrientation( side );
          IGridNode n = gh.getGridNode( sideOff );
          if ( n != null )
          {
            IGrid g = n.getGrid();
            if ( g != null )
            {
              ISpatialCache sc = g.getCache( ISpatialCache.class );
              if ( sc.isValidRegion() )
              {
View Full Code Here

Examples of appeng.api.networking.IGridNode

      {
        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() );
          }
        }
      }

      if ( te instanceof IAEPowerStorage )
      {
        IAEPowerStorage ps = (IAEPowerStorage) te;
        outputMsg( player, "Energy: " + ps.getAECurrentPower() + " / " + ps.getAEMaxPower() );

        if ( te instanceof IGridHost )
        {
          IGridNode node = ((IGridHost) te).getGridNode( ForgeDirection.getOrientation( side ) );
          if ( node != null && node.getGrid() != null )
          {
            IEnergyGrid eg = node.getGrid().getCache( IEnergyGrid.class );
            outputMsg( player, "GridEnergy: " + eg.getStoredPower() + " : " + eg.getEnergyDemand( Double.MAX_VALUE ) );
          }
        }
      }
    }
View Full Code Here

Examples of appeng.api.networking.IGridNode

    boolean posted = false;

    for (TileCraftingTile r : tiles)
    {
      IGridNode n = r.getActionableNode();
      if ( n != null && !posted )
      {
        IGrid g = n.getGrid();
        if ( g != null )
        {
          g.postEvent( new MENetworkCraftingCpuChange( n ) );
          posted = true;
        }
View Full Code Here

Examples of appeng.api.networking.IGridNode

  public IGrid getGrid()
  {
    for (TileCraftingTile r : tiles)
    {
      IGridNode gn = r.getActionableNode();
      if ( gn != null )
      {
        IGrid g = gn.getGrid();
        if ( g != null )
          return r.getActionableNode().getGrid();
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.