Package appeng.api.parts

Examples of appeng.api.parts.IPart


    IFacadePart fp = getFacadeContainer().getFacade( side );
    if ( fp != null )
      return true;

    // buses can be too.
    IPart part = getPart( side );
    return part != null && part.isSolid();
  }
View Full Code Here


  }

  @Override
  public int isProvidingWeakPower(ForgeDirection side)
  {
    IPart part = getPart( side );
    return part != null ? part.isProvidingWeakPower() : 0;
  }
View Full Code Here

  }

  @Override
  public int isProvidingStrongPower(ForgeDirection side)
  {
    IPart part = getPart( side );
    return part != null ? part.isProvidingStrongPower() : 0;
  }
View Full Code Here

  public void writeToStream(ByteBuf data) throws IOException
  {
    int sides = 0;
    for (int x = 0; x < 7; x++)
    {
      IPart p = getPart( ForgeDirection.getOrientation( x ) );
      if ( p != null )
      {
        sides = sides | (1 << x);
      }
    }

    data.writeByte( (byte) sides );

    for (int x = 0; x < 7; x++)
    {
      ItemStack is = null;
      IPart p = getPart( ForgeDirection.getOrientation( x ) );
      if ( p != null )
      {
        is = p.getItemStack( PartItemStack.Network );

        data.writeShort( Item.getIdFromItem( is.getItem() ) );
        data.writeShort( is.getItemDamage() );

        p.writeToStream( data );
      }
    }

    getFacadeContainer().writeToStream( data );
  }
View Full Code Here

    for (int x = 0; x < 7; x++)
    {
      ForgeDirection side = ForgeDirection.getOrientation( x );
      if ( ((sides & (1 << x)) == (1 << x)) )
      {
        IPart p = getPart( side );

        short itemID = data.readShort();
        short dmgValue = data.readShort();

        Item myItem = Item.getItemById( itemID );

        ItemStack current = p != null ? p.getItemStack( PartItemStack.Network ) : null;
        if ( current != null && current.getItem() == myItem && current.getItemDamage() == dmgValue )
        {
          if ( p.readFromStream( data ) )
            updateBlock = true;
        }
        else
        {
          removePart( side, false );
          side = addPart( new ItemStack( myItem, 1, dmgValue ), side, null );
          if ( side != null )
          {
            p = getPart( side );
            p.readFromStream( data );
          }
          else
            throw new RuntimeException( "Invalid Stream For CableBus Container." );
        }
      }
View Full Code Here

    IFacadeContainer fc = getFacadeContainer();
    for (ForgeDirection s : ForgeDirection.values())
    {
      fc.writeToNBT( data );

      IPart part = getPart( s );
      if ( part != null )
      {
        NBTTagCompound def = new NBTTagCompound();
        part.getItemStack( PartItemStack.World ).writeToNBT( def );

        NBTTagCompound extra = new NBTTagCompound();
        part.writeToNBT( extra );

        data.setTag( "def:" + getSide( part ).ordinal(), def );
        data.setTag( "extra:" + getSide( part ).ordinal(), extra );
      }
    }
View Full Code Here

      NBTTagCompound def = data.getCompoundTag( "def:" + side.ordinal() );
      NBTTagCompound extra = data.getCompoundTag( "extra:" + side.ordinal() );
      if ( def != null && extra != null )
      {
        IPart p = getPart( side );
        ItemStack iss = ItemStack.loadItemStackFromNBT( def );
        if ( iss == null )
          continue;

        ItemStack current = p == null ? null : p.getItemStack( PartItemStack.World );

        if ( Platform.isSameItemType( iss, current ) )
          p.readFromNBT( extra );
        else
        {
          removePart( side, true );
          side = addPart( iss, side, null );
          if ( side != null )
          {
            p = getPart( side );
            p.readFromNBT( extra );
          }
          else
          {
            AELog.warning( "Invalid NBT For CableBus Container: " + iss.getItem().getClass().getName() + " is not a valid part; it was ignored." );
          }
View Full Code Here

  public List getDrops(List drops)
  {
    for (ForgeDirection s : ForgeDirection.values())
    {
      IPart part = getPart( s );
      if ( part != null )
      {
        drops.add( part.getItemStack( PartItemStack.Break ) );
        part.getDrops( drops, false );
      }

      if ( s != ForgeDirection.UNKNOWN )
      {
        IFacadePart fp = getFacadeContainer().getFacade( s );
View Full Code Here

  public List getNoDrops(List drops)
  {
    for (ForgeDirection s : ForgeDirection.values())
    {
      IPart part = getPart( s );
      if ( part != null )
      {
        part.getDrops( drops, false );
      }
    }

    return drops;
  }
View Full Code Here

  }

  @Override
  public AECableType getCableConnectionType(ForgeDirection dir)
  {
    IPart part = getPart( dir );
    if ( part != null && part instanceof IGridHost )
    {
      AECableType t = ((IGridHost) part).getCableConnectionType( dir );
      if ( t != null && t != AECableType.NONE )
        return t;
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.