Package appeng.api.parts

Examples of appeng.api.parts.IPart


      return false;

    int interested = 0;
    for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
    {
      IPart part = getPart( dir );
      if ( part instanceof IEnergyTile )
      {
        interested++;
      }
    }
View Full Code Here


  public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction)
  {
    if ( !isInIC2() )
      return false;

    IPart part = getPart( direction );
    if ( part instanceof IEnergySink )
      return ((IEnergySink) part).acceptsEnergyFrom( emitter, direction );
    return false;
  }
View Full Code Here

    // this is a flawed implementation, that requires a change to the IC2 API.

    for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
    {
      IPart part = getPart( dir );
      if ( part instanceof IEnergySink )
      {
        // use lower number cause ic2 deletes power it sends that isn't received.
        return ((IEnergySink) part).getDemandedEnergy();
      }
View Full Code Here

    if ( !isInIC2() )
      return amount;

    for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
    {
      IPart part = getPart( dir );
      if ( part instanceof IEnergySink )
      {
        return ((IEnergySink) part).injectEnergy( directionFrom, amount, voltage );
      }
    }
View Full Code Here

    IGridNode n = getGridNode();
    if ( n != null )
    {
      for (ForgeDirection thisSide : ForgeDirection.VALID_DIRECTIONS)
      {
        IPart part = getHost().getPart( thisSide );
        if ( part != null )
        {
          if ( part.getGridNode() != null )
          {
            IReadOnlyCollection<IGridConnection> set = part.getGridNode().getConnections();
            for (IGridConnection gc : set)
            {
              if ( proxy.getNode().hasFlag( GridFlags.DENSE_CAPACITY ) && gc.getOtherSide( proxy.getNode() ).hasFlag( GridFlags.DENSE_CAPACITY ) )
                sideOut |= (gc.getUsedChannels() / 4) << (4 * thisSide.ordinal());
              else
 
View Full Code Here

  public IPart getRenderer(ItemStack is, IPartItem c)
  {
    int id = (Item.getIdFromItem( is.getItem() ) << Platform.DEF_OFFSET) | is.getItemDamage();

    IPart part = renderPart.get( id );
    if ( part == null )
    {
      part = c.createPartFromItemStack( is );
      if ( part != null )
        renderPart.put( id, part );
View Full Code Here

      if ( fp != null )
        fp.renderInventory( BusRenderHelper.instance, renderer );
    }
    else
    {
      IPart ip = getRenderer( item, (IPartItem) item.getItem() );
      if ( ip != null )
      {
        if ( type == ItemRenderType.ENTITY )
        {
          int depth = ip.cableConnectionRenderTo();
          GL11.glTranslatef( 0.0f, 0.0f, -0.04f * (8 - depth) - 0.06f );
        }

        ip.renderInventory( BusRenderHelper.instance, renderer );
      }
    }

    renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;

View Full Code Here

    return getSide( side );
  }

  public void rotateLeft()
  {
    IPart newSides[] = new IPart[6];

    newSides[ForgeDirection.UP.ordinal()] = getSide( ForgeDirection.UP );
    newSides[ForgeDirection.DOWN.ordinal()] = getSide( ForgeDirection.DOWN );

    newSides[ForgeDirection.EAST.ordinal()] = getSide( ForgeDirection.NORTH );
View Full Code Here

  public void updateDynamicRender()
  {
    requiresDynamicRender = false;
    for (ForgeDirection s : ForgeDirection.VALID_DIRECTIONS)
    {
      IPart p = getPart( s );
      if ( p != null )
        requiresDynamicRender = requiresDynamicRender || p.requireDynamicRender();
    }
  }
View Full Code Here

      IPartItem bi = (IPartItem) is.getItem();

      is = is.copy();
      is.stackSize = 1;

      IPart bp = bi.createPartFromItemStack( is );
      if ( bp != null )
      {
        if ( bp instanceof IPartCable )
        {
          boolean canPlace = true;
          for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS)
            if ( getPart( d ) != null && !getPart( d ).canBePlacedOn( ((IPartCable) bp).supportsBuses() ) )
              canPlace = false;

          if ( !canPlace )
            return false;

          return getPart( ForgeDirection.UNKNOWN ) == null;
        }
        else if ( !(bp instanceof IPartCable) && side != ForgeDirection.UNKNOWN )
        {
          IPart cable = getPart( ForgeDirection.UNKNOWN );
          if ( cable != null && !bp.canBePlacedOn( ((IPartCable) cable).supportsBuses() ) )
            return false;

          return getPart( side ) == null;
        }
View Full Code Here

TOP

Related Classes of appeng.api.parts.IPart

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.