Package appeng.api.networking

Examples of appeng.api.networking.IGridHost


  IGrid network;

  public ContainerNetworkStatus(InventoryPlayer ip, INetworkTool te) {
    super( ip, null, null );
    IGridHost host = te.getGridHost();

    if ( host != null )
    {
      findNode( host, ForgeDirection.UNKNOWN );
      for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS)
View Full Code Here


  }

  @Override
  public boolean visitNode(IGridNode n)
  {
    IGridHost host = n.getMachine();
    if ( isValid && host instanceof TileController )
    {
      TileController c = (TileController) host;

      minX = Math.min( c.xCoord, minX );
View Full Code Here

  }

  @Override
  public IGridNode next()
  {
    IGridHost host = hosts.next();
    return host.getGridNode( ForgeDirection.UNKNOWN );
  }
View Full Code Here

  final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();

  public ContainerCraftingCPU(InventoryPlayer ip, Object te) {
    super( ip, te );
    IGridHost host = (IGridHost) (te instanceof IGridHost ? te : null);

    if ( host != null )
    {
      findNode( host, ForgeDirection.UNKNOWN );
      for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS)
View Full Code Here

    EnumSet<ForgeDirection> newSecurityConnections = EnumSet.noneOf( ForgeDirection.class );

    DimensionalCoord dc = gridProxy.getLocation();
    for (ForgeDirection f : ForgeDirection.VALID_DIRECTIONS)
    {
      IGridHost te = findGridHost( dc.getWorld(), dc.x + f.offsetX, dc.y + f.offsetY, dc.z + f.offsetZ );
      if ( te != null )
      {
        GridNode node = (GridNode) te.getGridNode( f.getOpposite() );
        if ( node == null )
          continue;

        boolean isValidConnection = this.canConnect( node, f ) && node.canConnect( this, f.getOpposite() );

        IGridConnection con = null; // find the connection for this
                      // direction..
        for (IGridConnection c : getConnections())
        {
          if ( c.getDirection( this ) == f )
          {
            con = c;
            break;
          }
        }

        if ( con != null )
        {
          IGridNode os = con.getOtherSide( this );
          if ( os == node )
          {
            // if this connection is no longer valid, destroy it.
            if ( !isValidConnection )
              con.destroy();
          }
          else
          {
            con.destroy();
            // throw new GridException( "invalid state found, encountered connection to phantom block." );
          }
        }
        else if ( isValidConnection )
        {
          if ( node.lastSecurityKey != -1 )
            newSecurityConnections.add( f );
          else
          {
            // construct a new connection between these two nodes.
            try
            {
              new GridConnection( node, this, f.getOpposite() );
            }
            catch (FailedConnection e)
            {
              TickHandler.instance.addCallable( node.getWorld(), new Callable() {

                @Override
                public Object call() throws Exception
                {
                  getMachine().securityBreak();
                  return null;
                }

              } );

              return;
            }
          }
        }

      }
    }

    for (ForgeDirection f : newSecurityConnections)
    {
      IGridHost te = findGridHost( dc.getWorld(), dc.x + f.offsetX, dc.y + f.offsetY, dc.z + f.offsetZ );
      if ( te != null )
      {
        GridNode node = (GridNode) te.getGridNode( f.getOpposite() );
        if ( node == null )
          continue;

        // construct a new connection between these two nodes.
        try
View Full Code Here

  @SideOnly(Side.CLIENT)
  public void renderDenseConnection(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer, int channels, ForgeDirection of)
  {
    TileEntity te = this.tile.getWorldObj().getTileEntity( x + of.offsetX, y + of.offsetY, z + of.offsetZ );
    IPartHost partHost = te instanceof IPartHost ? (IPartHost) te : null;
    IGridHost ghh = te instanceof IGridHost ? (IGridHost) te : null;
    boolean isGlass = false;
    AEColor myColor = getCableColor();
    /*
     * ( ghh != null && partHost != null && ghh.getCableConnectionType( of ) == AECableType.GLASS && partHost.getPart(
     * of.getOpposite() ) == null ) { isGlass = true; rh.setTexture( getGlassTexture( myColor = partHost.getColor() ) );
     * } else if ( partHost == null && ghh != null && ghh.getCableConnectionType( of ) != AECableType.GLASS ) {
     * rh.setTexture( getSmartTexture( myColor ) ); switch (of) { case DOWN: rh.setBounds( 3, 0, 3, 13, 4, 13 );
     * break; case EAST: rh.setBounds( 12, 3, 3, 16, 13, 13 ); break; case NORTH: rh.setBounds( 3, 3, 0, 13, 13, 4
     * ); break; case SOUTH: rh.setBounds( 3, 3, 12, 13, 13, 16 ); break; case UP: rh.setBounds( 3, 12, 3, 13, 16,
     * 13 ); break; case WEST: rh.setBounds( 0, 3, 3, 4, 13, 13 ); break; default: return; } rh.renderBlock( x, y,
     * z, renderer );
     *
     * if ( true ) { setSmartConnectionRotations( of, renderer ); IIcon firstIcon = new TaughtIcon( getChannelTex(
     * channels, false ).getIcon(), -0.2f ); IIcon secondIcon = new TaughtIcon( getChannelTex( channels, true ).getIcon(),
     * -0.2f );
     *
     * if ( of == ForgeDirection.EAST || of == ForgeDirection.WEST ) { AEBaseBlock blk = (AEBaseBlock)
     * rh.getBlock(); FlippableIcon ico = blk.getRendererInstance().getTexture( ForgeDirection.EAST ); ico.setFlip(
     * false, true ); }
     *
     * Tessellator.instance.setBrightness( 15 << 20 | 15 << 5 ); Tessellator.instance.setColorOpaque_I(
     * myColor.mediumVariant ); rh.setTexture( firstIcon, firstIcon, firstIcon, firstIcon, firstIcon, firstIcon ); renderAllFaces( (AEBaseBlock)
     * rh.getBlock(), x, y, z, renderer );
     *
     * Tessellator.instance.setColorOpaque_I( myColor.whiteVariant ); rh.setTexture( secondIcon, secondIcon, secondIcon, secondIcon, secondIcon,
     * secondIcon ); renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, renderer );
     *
     * renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth =
     * renderer.uvRotateTop = renderer.uvRotateWest = 0; }
     *
     * rh.setTexture( getTexture( getCableColor() ) ); }
     */

    rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of, of.getOpposite() ) ) );
    if ( ghh != null && partHost != null && ghh.getCableConnectionType( of ) != AECableType.GLASS && partHost.getColor() != AEColor.Transparent
        && partHost.getPart( of.getOpposite() ) == null )
      rh.setTexture( getTexture( myColor = partHost.getColor() ) );
    else
      rh.setTexture( getTexture( getCableColor() ) );

View Full Code Here

        World src_w = DimensionManager.getWorld( dimid );

        TileEntity te = src_w.getTileEntity( src_x, src_y, src_z );
        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 )
            {
View Full Code Here

      LinkedList<WorldCoord> places = new LinkedList<WorldCoord>();

      Iterator<IGridHost> i = cluster.getTiles();
      while (i.hasNext())
      {
        IGridHost h = i.next();
        if ( h == this )
          places.add( new WorldCoord( this ) );
        else
        {
          TileEntity te = (TileEntity) h;
View Full Code Here

  @SideOnly(Side.CLIENT)
  public void renderGlassConnection(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer, ForgeDirection of)
  {
    TileEntity te = this.tile.getWorldObj().getTileEntity( x + of.offsetX, y + of.offsetY, z + of.offsetZ );
    IPartHost partHost = te instanceof IPartHost ? (IPartHost) te : null;
    IGridHost gh = te instanceof IGridHost ? (IGridHost) te : null;

    rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of ) ) );

    if ( gh != null && partHost != null && gh.getCableConnectionType( of ) == AECableType.GLASS && partHost.getColor() != AEColor.Transparent
        && partHost.getPart( of.getOpposite() ) == null )
      rh.setTexture( getTexture( partHost.getColor() ) );
    else if ( partHost == null && gh != null && gh.getCableConnectionType( of ) != AECableType.GLASS )
    {
      rh.setTexture( getCoveredTexture( getCableColor() ) );
      switch (of)
      {
      case DOWN:
View Full Code Here

  @SideOnly(Side.CLIENT)
  public void renderCoveredConnection(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer, int channels, ForgeDirection of)
  {
    TileEntity te = this.tile.getWorldObj().getTileEntity( x + of.offsetX, y + of.offsetY, z + of.offsetZ );
    IPartHost partHost = te instanceof IPartHost ? (IPartHost) te : null;
    IGridHost ghh = te instanceof IGridHost ? (IGridHost) te : null;
    boolean isSmart = false;

    rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of ) ) );
    if ( ghh != null && partHost != null && ghh.getCableConnectionType( of.getOpposite() ) == AECableType.GLASS && partHost.getPart( of.getOpposite() ) == null
        && partHost.getColor() != AEColor.Transparent )
      rh.setTexture( getGlassTexture( partHost.getColor() ) );
    else if ( partHost == null && ghh != null && ghh.getCableConnectionType( of ) != AECableType.GLASS )
    {
      rh.setTexture( getCoveredTexture( getCableColor() ) );
      switch (of)
      {
      case DOWN:
        rh.setBounds( 5, 0, 5, 11, 4, 11 );
        break;
      case EAST:
        rh.setBounds( 12, 5, 5, 16, 11, 11 );
        break;
      case NORTH:
        rh.setBounds( 5, 5, 0, 11, 11, 4 );
        break;
      case SOUTH:
        rh.setBounds( 5, 5, 12, 11, 11, 16 );
        break;
      case UP:
        rh.setBounds( 5, 12, 5, 11, 16, 11 );
        break;
      case WEST:
        rh.setBounds( 0, 5, 5, 4, 11, 11 );
        break;
      default:
        return;
      }

      rh.renderBlock( x, y, z, renderer );

      rh.setTexture( getTexture( getCableColor() ) );
    }
    else if ( ghh != null && partHost != null && ghh.getCableConnectionType( of ) == AECableType.COVERED && partHost.getColor() != AEColor.Transparent
        && partHost.getPart( of.getOpposite() ) == null )
      rh.setTexture( getCoveredTexture( partHost.getColor() ) );
    else if ( ghh != null && partHost != null && ghh.getCableConnectionType( of ) == AECableType.SMART && partHost.getPart( of.getOpposite() ) == null )
    {
      isSmart = true;
      rh.setTexture( getSmartTexture( getCableColor() ) );
    }
    else
View Full Code Here

TOP

Related Classes of appeng.api.networking.IGridHost

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.