Examples of IOrientable


Examples of appeng.api.util.IOrientable

    preRenderInWorld( block, world, x, y, z, renderer );

    tma.lightCache = BusRenderHelper.instance.useSimplifiedRendering( x, y, z, this, tma.lightCache );

    BusRenderer.instance.renderer.isFacade = true;
    IOrientable te = getOrientable( block, world, x, y, z );

    ForgeDirection fdy = te.getUp();
    ForgeDirection fdz = te.getForward();
    ForgeDirection fdx = Platform.crossProduct( fdz, fdy ).getOpposite();

    renderer.renderAllFaces = true;

    renderCableAt( 0.11D, world, x, y, z, block, renderer, 0.141D, false );
View Full Code Here

Examples of appeng.api.util.IOrientable

  @Override
  public boolean renderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
  {
    BlockQuartzTorch blk = (BlockQuartzTorch) block;

    IOrientable te = ((IOrientableBlock) block).getOrientable( world, x, y, z );

    float Point2 = 6.0f / 16.0f;
    float Point3 = 7.0f / 16.0f;
    float Point13 = 10.0f / 16.0f;
    float Point12 = 9.0f / 16.0f;

    float singlePixel = 1.0f / 16.0f;
    float renderBottom = 5.0f / 16.0f;
    float renderTop = 10.0f / 16.0f;

    float bottom = 7.0f / 16.0f;
    float top = 8.0f / 16.0f;

    float xOff = 0.0f;
    float yOff = 0.0f;
    float zOff = 0.0f;

    renderer.renderAllFaces = true;
    if ( te != null )
    {
      ForgeDirection forward = te.getUp();
      xOff = forward.offsetX * -(4.0f / 16.0f);
      yOff = forward.offsetY * -(4.0f / 16.0f);
      zOff = forward.offsetZ * -(4.0f / 16.0f);
    }

    renderer.setRenderBounds( Point3 + xOff, renderBottom + yOff, Point3 + zOff, Point12 + xOff, renderTop + yOff, Point12 + zOff );
    super.renderInWorld( block, world, x, y, z, renderer );

    int r = (x + y + z) % 2;
    if ( r == 0 )
    {
      renderer.setRenderBounds( Point3 + xOff, renderTop + yOff, Point3 + zOff, Point3 + singlePixel + xOff, renderTop + singlePixel + yOff, Point3 + singlePixel + zOff );
      super.renderInWorld( block, world, x, y, z, renderer );

      renderer.setRenderBounds( Point12 - singlePixel + xOff, renderBottom - singlePixel + yOff, Point12 - singlePixel + zOff, Point12 + xOff, renderBottom + yOff, Point12 + zOff );
      super.renderInWorld( block, world, x, y, z, renderer );
    }
    else
    {
      renderer.setRenderBounds( Point3 + xOff, renderBottom - singlePixel + yOff, Point3 + zOff, Point3 + singlePixel + xOff, renderBottom + yOff, Point3 + singlePixel + zOff );
      super.renderInWorld( block, world, x, y, z, renderer );

      renderer.setRenderBounds( Point12 - singlePixel + xOff, renderTop + yOff, Point12 - singlePixel + zOff, Point12 + xOff, renderTop + singlePixel + yOff, Point12 + zOff );
      super.renderInWorld( block, world, x, y, z, renderer );
    }

    blk.getRendererInstance().setTemporaryRenderIcon( Blocks.hopper.getIcon( 0, 0 ) );

    renderer.setRenderBounds( Point2 + xOff, bottom + yOff, Point2 + zOff, Point13 + xOff, top + yOff, Point3 + zOff );
    boolean out = renderer.renderStandardBlock( blk, x, y, z );

    renderer.setRenderBounds( Point2 + xOff, bottom + yOff, Point12 + zOff, Point13 + xOff, top + yOff, Point13 + zOff );
    renderer.renderStandardBlock( blk, x, y, z );

    renderer.setRenderBounds( Point2 + xOff, bottom + yOff, Point3 + zOff, Point3 + xOff, top + yOff, Point12 + zOff );
    renderer.renderStandardBlock( blk, x, y, z );

    renderer.setRenderBounds( Point12 + xOff, bottom + yOff, Point3 + zOff, Point13 + xOff, top + yOff, Point12 + zOff );
    renderer.renderStandardBlock( blk, x, y, z );

    if ( te != null )
    {
      ForgeDirection forward = te.getUp();
      switch (forward)
      {
      case EAST:
        renderer.setRenderBounds( 0, bottom + yOff, bottom + zOff, Point2 + xOff, top + yOff, top + zOff );
        renderer.renderStandardBlock( blk, x, y, z );
View Full Code Here

Examples of appeng.api.util.IOrientable

  {
    preRenderInWorld( block, world, x, y, z, renderer );

    BlockCharger blk = (BlockCharger) block;

    IOrientable te = getOrientable( block, world, x, y, z );

    ForgeDirection fdy = te.getUp();
    ForgeDirection fdz = te.getForward();
    ForgeDirection fdx = Platform.crossProduct( fdz, fdy ).getOpposite();

    renderer.renderAllFaces = true;
    renderBlockBounds( renderer, 6, 1, 0, 10, 15, 2, fdx, fdy, fdz );
    boolean out = renderer.renderStandardBlock( blk, x, y, z );
View Full Code Here

Examples of appeng.api.util.IOrientable

  {
    preRenderInWorld( block, world, x, y, z, renderer );

    BlockInscriber blk = (BlockInscriber) block;

    IOrientable te = getOrientable( block, world, x, y, z );

    ForgeDirection fdy = te.getUp();
    ForgeDirection fdz = te.getForward();
    ForgeDirection fdx = Platform.crossProduct( fdz, fdy ).getOpposite();

    renderer.renderAllFaces = true;

    // sides...
View Full Code Here

Examples of appeng.api.util.IOrientable

    if ( AppEng.instance.isIntegrationEnabled( IntegrationType.RB ) )
    {
      TileEntity te = w.getTileEntity( x, y, z );
      if ( te != null )
      {
        IOrientable out = ((IRB) AppEng.instance.getIntegration( IntegrationType.RB )).getOrientable( te );
        if ( out != null )
          return out;
      }
    }
View Full Code Here

Examples of appeng.api.util.IOrientable

    isReady = true;

    // send orientation based directionality to the node.
    if ( gp instanceof IOrientable )
    {
      IOrientable ori = (IOrientable) gp;
      if ( ori.canBeRotated() )
        ori.setOrientation( ori.getForward(), ori.getUp() );
    }

    getNode();
  }
View Full Code Here

Examples of appeng.api.util.IOrientable

  {
    ForgeDirection forward = ForgeDirection.SOUTH;
    ForgeDirection up = ForgeDirection.UP;

    BlockRenderInfo info = block.getRendererInstance();
    IOrientable te = getOrientable( block, world, x, y, z );
    if ( te != null )
    {
      forward = te.getForward();
      up = te.getUp();

      renderer.uvRotateBottom = info.getTexture( ForgeDirection.DOWN ).setFlip( getOrientation( ForgeDirection.DOWN, forward, up ) );
      renderer.uvRotateTop = info.getTexture( ForgeDirection.UP ).setFlip( getOrientation( ForgeDirection.UP, forward, up ) );

      renderer.uvRotateEast = info.getTexture( ForgeDirection.EAST ).setFlip( getOrientation( ForgeDirection.EAST, forward, up ) );
View Full Code Here

Examples of appeng.api.util.IOrientable

  public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World w, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata)
  {
    ForgeDirection up = ForgeDirection.UNKNOWN;
    ForgeDirection forward = ForgeDirection.UNKNOWN;

    IOrientable ori = null;

    if ( blockType.hasBlockTileEntity() )
    {
      if ( blockType instanceof BlockLightDetector )
      {
        up = ForgeDirection.getOrientation( side );
        if ( up == ForgeDirection.UP || up == ForgeDirection.DOWN )
          forward = ForgeDirection.SOUTH;
        else
          forward = ForgeDirection.UP;
      }
      else if ( blockType instanceof BlockWireless || blockType instanceof BlockSkyCompass )
      {
        forward = ForgeDirection.getOrientation( side );
        if ( forward == ForgeDirection.UP || forward == ForgeDirection.DOWN )
          up = ForgeDirection.SOUTH;
        else
          up = ForgeDirection.UP;
      }
      else
      {
        up = ForgeDirection.UP;

        byte rotation = (byte) (MathHelper.floor_double( (player.rotationYaw * 4F) / 360F + 2.5D ) & 3);

        switch (rotation)
        {
        default:
        case 0:
          forward = ForgeDirection.SOUTH;
          break;
        case 1:
          forward = ForgeDirection.WEST;
          break;
        case 2:
          forward = ForgeDirection.NORTH;
          break;
        case 3:
          forward = ForgeDirection.EAST;
          break;
        }

        if ( player.rotationPitch > 65 )
        {
          up = forward.getOpposite();
          forward = ForgeDirection.UP;
        }
        else if ( player.rotationPitch < -65 )
        {
          up = forward.getOpposite();
          forward = ForgeDirection.DOWN;
        }
      }
    }

    if ( blockType instanceof IOrientableBlock )
    {
      ori = ((IOrientableBlock) blockType).getOrientable( w, x, y, z );
      up = ForgeDirection.getOrientation( side );
      forward = ForgeDirection.SOUTH;
      if ( up.offsetY == 0 )
        forward = ForgeDirection.UP;

      ori.setOrientation( forward, up );
    }

    if ( !blockType.isValidOrientation( w, x, y, z, forward, up ) )
      return false;

    if ( super.placeBlockAt( stack, player, w, x, y, z, side, hitX, hitY, hitZ, metadata ) )
    {
      if ( blockType.hasBlockTileEntity() && !(blockType instanceof BlockLightDetector) )
      {
        AEBaseTile tile = blockType.getTileEntity( w, x, y, z );
        ori = tile;

        if ( tile == null )
          return true;

        if ( ori.canBeRotated() && !blockType.hasCustomRotation() )
        {
          if ( ori.getForward() == null || ori.getUp() == null || // null
              tile.getForward() == ForgeDirection.UNKNOWN || ori.getUp() == ForgeDirection.UNKNOWN )
            ori.setOrientation( forward, up );
        }

        if ( tile instanceof IGridProxyable )
        {
          ((IGridProxyable) tile).getProxy().setOwner( player );
        }

        tile.onPlacement( stack, player, side );
      }
      else if ( blockType instanceof IOrientableBlock )
      {
        ori.setOrientation( forward, up );
      }

      return true;
    }
    return false;
View Full Code Here

Examples of appeng.api.util.IOrientable

  }

  @Override
  final public boolean rotateBlock(World w, int x, int y, int z, ForgeDirection axis)
  {
    IOrientable rotatable = null;

    if ( hasBlockTileEntity() )
    {
      rotatable = (AEBaseTile) getTileEntity( w, x, y, z );
    }
    else if ( this instanceof IOrientableBlock )
    {
      rotatable = ((IOrientableBlock) this).getOrientable( w, x, y, z );
    }

    if ( rotatable != null && rotatable.canBeRotated() )
    {
      if ( hasCustomRotation() )
      {
        customRotateBlock( rotatable, axis );
        return true;
      }
      else
      {
        ForgeDirection forward = rotatable.getForward();
        ForgeDirection up = rotatable.getUp();

        for (int rs = 0; rs < 4; rs++)
        {
          forward = Platform.rotateAround( forward, axis );
          up = Platform.rotateAround( up, axis );

          if ( this.isValidOrientation( w, x, y, z, forward, up ) )
          {
            rotatable.setOrientation( forward, up );
            return true;
          }
        }
      }
    }
View Full Code Here

Examples of appeng.api.util.IOrientable

    return ForgeDirection.UNKNOWN;
  }

  int mapRotation(IBlockAccess w, int x, int y, int z, int s)
  {
    IOrientable ori = null;

    if ( hasBlockTileEntity() )
    {
      ori = (AEBaseTile) getTileEntity( w, x, y, z );
    }
    else if ( this instanceof IOrientableBlock )
    {
      ori = ((IOrientableBlock) this).getOrientable( w, x, y, z );
    }

    if ( ori != null && ori.canBeRotated() )
    {
      return mapRotation( ori, ForgeDirection.getOrientation( s ) ).ordinal();
    }

    return s;
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.