Package appeng.client.render

Examples of appeng.client.render.BusRenderHelper


      nonForward = AEApi.instance().blocks().blockCraftingUnit.block().getIcon( 0, meta | (formed ? 8 : 0) );

    if ( formed && renderer.overrideBlockTexture == null )
    {
      renderer = BusRenderer.instance.renderer;
      BusRenderHelper i = BusRenderHelper.instance;
      BusRenderer.instance.renderer.isFacade = true;

      renderer.blockAccess = w;
      i.setPass( 0 );
      i.setOrientation( ForgeDirection.EAST, ForgeDirection.UP, ForgeDirection.SOUTH );

      try
      {
        ct.lightCache = i.useSimplifiedRendering( x, y, z, null, ct.lightCache );
      }
      catch (Throwable ignored)
      {

      }

      float highX = isConnected( w, x, y, z, ForgeDirection.EAST ) ? 16 : 13.01f;
      float lowX = isConnected( w, x, y, z, ForgeDirection.WEST ) ? 0 : 2.99f;

      float highY = isConnected( w, x, y, z, ForgeDirection.UP ) ? 16 : 13.01f;
      float lowY = isConnected( w, x, y, z, ForgeDirection.DOWN ) ? 0 : 2.99f;

      float highZ = isConnected( w, x, y, z, ForgeDirection.SOUTH ) ? 16 : 13.01f;
      float lowZ = isConnected( w, x, y, z, ForgeDirection.NORTH ) ? 0 : 2.99f;

      renderCorner( i, renderer, w, x, y, z, ForgeDirection.UP, ForgeDirection.EAST, ForgeDirection.NORTH );
      renderCorner( i, renderer, w, x, y, z, ForgeDirection.UP, ForgeDirection.EAST, ForgeDirection.SOUTH );
      renderCorner( i, renderer, w, x, y, z, ForgeDirection.UP, ForgeDirection.WEST, ForgeDirection.NORTH );
      renderCorner( i, renderer, w, x, y, z, ForgeDirection.UP, ForgeDirection.WEST, ForgeDirection.SOUTH );
      renderCorner( i, renderer, w, x, y, z, ForgeDirection.DOWN, ForgeDirection.EAST, ForgeDirection.NORTH );
      renderCorner( i, renderer, w, x, y, z, ForgeDirection.DOWN, ForgeDirection.EAST, ForgeDirection.SOUTH );
      renderCorner( i, renderer, w, x, y, z, ForgeDirection.DOWN, ForgeDirection.WEST, ForgeDirection.NORTH );
      renderCorner( i, renderer, w, x, y, z, ForgeDirection.DOWN, ForgeDirection.WEST, ForgeDirection.SOUTH );

      for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
      {
        i.setBounds( fso( side, lowX, ForgeDirection.WEST ), fso( side, lowY, ForgeDirection.DOWN ), fso( side, lowZ, ForgeDirection.NORTH ),
            fso( side, highX, ForgeDirection.EAST ), fso( side, highY, ForgeDirection.UP ), fso( side, highZ, ForgeDirection.SOUTH ) );
        i.prepareBounds( renderer );

        boolean LocalEmit = emitsLight;
        if ( blk instanceof BlockCraftingMonitor && !ct.getForward().equals( side ) )
          LocalEmit = false;

        handleSide( blk, meta, x, y, z, i, renderer, ct.getForward().equals( side ) ? theIcon : nonForward, LocalEmit, isMonitor, side, w );
      }

      BusRenderer.instance.renderer.isFacade = false;
      i.setFacesToRender( EnumSet.allOf( ForgeDirection.class ) );
      i.normalRendering();

      return true;
    }
    else
    {
View Full Code Here


  public void renderStatic(int x, int y, int z, IPartRenderHelper instance2, RenderBlocks renderer, IFacadeContainer fc, AxisAlignedBB busBounds,
      boolean renderStilt)
  {
    if ( facade != null )
    {
      BusRenderHelper instance = (BusRenderHelper) instance2;

      try
      {
        ItemStack randomItem = getTexture();

        RenderBlocksWorkaround rbw = null;
        if ( renderer instanceof RenderBlocksWorkaround )
        {
          rbw = (RenderBlocksWorkaround) renderer;
        }

        if ( renderStilt && busBounds == null )
        {
          if ( rbw != null )
          {
            rbw.isFacade = false;
            rbw.calculations = true;
          }

          IIcon myIcon = null;
          if ( isBC() )
          {
            IBC bc = (IBC) AppEng.instance.getIntegration( IntegrationType.BC );
            myIcon = bc.getFacadeTexture();
          }

          if ( myIcon == null )
            myIcon = facade.getIconIndex();

          instance.setTexture( myIcon );

          if ( isBC() )
            instance.setBounds( 6, 6, 10, 10, 10, 15 );
          else
            instance.setBounds( 7, 7, 10, 9, 9, 15 );

          instance.renderBlock( x, y, z, renderer );
          instance.setTexture( null );

        }

        if ( randomItem != null )
        {
          if ( randomItem.getItem() instanceof ItemBlock )
          {
            ItemBlock ib = (ItemBlock) randomItem.getItem();
            Block blk = Block.getBlockFromItem( ib );

            if ( AEApi.instance().partHelper().getCableRenderMode().transparentFacades )
            {
              if ( rbw != null )
                rbw.opacity = 0.3f;
              instance.renderForPass( 1 );
            }
            else
            {
              if ( blk.canRenderInPass( 1 ) )
              {
                instance.renderForPass( 1 );
              }
            }

            int color = 0xffffff;

            try
            {
              color = ib.getColorFromItemStack( randomItem, 0 );
            }
            catch (Throwable ignored)
            {
            }

            renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
            instance.setBounds( 0, 0, 16 - getFacadeThickness(), 16, 16, 16 );
            instance.prepareBounds( renderer );

            if ( rbw != null )
            {
              rbw.isFacade = true;

              rbw.calculations = true;
              rbw.faces = EnumSet.noneOf( ForgeDirection.class );

              if ( prevLight != null && rbw.similarLighting( blk, rbw.blockAccess, x, y, z, prevLight ) )
                rbw.populate( prevLight );
              else
              {
                instance.setRenderColor( color );
                rbw.renderStandardBlock( instance.getBlock(), x, y, z );
                instance.setRenderColor( 0xffffff );
                prevLight = rbw.getLightingCache();
              }

              rbw.calculations = false;
              rbw.faces = calculateFaceOpenFaces( rbw.blockAccess, fc, x, y, z, side );

              ((RenderBlocksWorkaround) renderer).setTexture(
                  blk.getIcon( ForgeDirection.DOWN.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
                  blk.getIcon( ForgeDirection.UP.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
                  blk.getIcon( ForgeDirection.NORTH.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
                  blk.getIcon( ForgeDirection.SOUTH.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
                  blk.getIcon( ForgeDirection.WEST.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
                  blk.getIcon( ForgeDirection.EAST.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ) );
            }
            else
            {
              instance.setTexture( blk.getIcon( ForgeDirection.DOWN.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
                  blk.getIcon( ForgeDirection.UP.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
                  blk.getIcon( ForgeDirection.NORTH.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
                  blk.getIcon( ForgeDirection.SOUTH.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
                  blk.getIcon( ForgeDirection.WEST.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ),
                  blk.getIcon( ForgeDirection.EAST.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ) );
            }

            if ( busBounds == null )
            {
              if ( side == ForgeDirection.UP || side == ForgeDirection.DOWN )
              {
                instance.renderBlockCurrentBounds( x, y, z, renderer );
              }
              else if ( side == ForgeDirection.NORTH || side == ForgeDirection.SOUTH )
              {
                if ( fc.getFacade( ForgeDirection.UP ) != null )
                  renderer.renderMaxY -= getFacadeThickness() / 16.0;

                if ( fc.getFacade( ForgeDirection.DOWN ) != null )
                  renderer.renderMinY += getFacadeThickness() / 16.0;

                instance.renderBlockCurrentBounds( x, y, z, renderer );
              }
              else
              {
                if ( fc.getFacade( ForgeDirection.UP ) != null )
                  renderer.renderMaxY -= getFacadeThickness() / 16.0;

                if ( fc.getFacade( ForgeDirection.DOWN ) != null )
                  renderer.renderMinY += getFacadeThickness() / 16.0;

                if ( fc.getFacade( ForgeDirection.SOUTH ) != null )
                  renderer.renderMaxZ -= getFacadeThickness() / 16.0;

                if ( fc.getFacade( ForgeDirection.NORTH ) != null )
                  renderer.renderMinZ += getFacadeThickness() / 16.0;

                instance.renderBlockCurrentBounds( x, y, z, renderer );
              }
            }
            else
            {
              if ( side == ForgeDirection.UP || side == ForgeDirection.DOWN )
              {
                renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, 0.0, 0.0, busBounds.maxZ, 1.0, 1.0, 1.0 );
                renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, 0.0, 0.0, 0.0, 1.0, 1.0, busBounds.minZ );
                renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, 0.0, 0.0, busBounds.minZ, busBounds.minX, 1.0, busBounds.maxZ );
                renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, busBounds.maxX, 0.0, busBounds.minZ, 1.0, 1.0, busBounds.maxZ );
              }
              else if ( side == ForgeDirection.NORTH || side == ForgeDirection.SOUTH )
              {
                if ( fc.getFacade( ForgeDirection.UP ) != null )
                  renderer.renderMaxY -= getFacadeThickness() / 16.0;

                if ( fc.getFacade( ForgeDirection.DOWN ) != null )
                  renderer.renderMinY += getFacadeThickness() / 16.0;

                renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, busBounds.maxX, 0.0, 0.0, 1.0, 1.0, 1.0 );
                renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, 0.0, 0.0, 0.0, busBounds.minX, 1.0, 1.0 );
                renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, busBounds.minX, 0.0, 0.0, busBounds.maxX, busBounds.minY, 1.0 );
                renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, busBounds.minX, busBounds.maxY, 0.0, busBounds.maxX, 1.0, 1.0 );
              }
              else
              {
                if ( fc.getFacade( ForgeDirection.UP ) != null )
                  renderer.renderMaxY -= getFacadeThickness() / 16.0;

                if ( fc.getFacade( ForgeDirection.DOWN ) != null )
                  renderer.renderMinY += getFacadeThickness() / 16.0;

                if ( fc.getFacade( ForgeDirection.SOUTH ) != null )
                  renderer.renderMaxZ -= getFacadeThickness() / 16.0;

                if ( fc.getFacade( ForgeDirection.NORTH ) != null )
                  renderer.renderMinZ += getFacadeThickness() / 16.0;

                renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, 0.0, 0.0, busBounds.maxZ, 1.0, 1.0, 1.0 );
                renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, 0.0, 0.0, 0.0, 1.0, 1.0, busBounds.minZ );
                renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, 0.0, 0.0, busBounds.minZ, 1.0, busBounds.minY, busBounds.maxZ );
                renderSegmentBlockCurrentBounds( instance, x, y, z, renderer, 0.0, busBounds.maxY, busBounds.minZ, 1.0, 1.0, busBounds.maxZ );
              }
            }

            if ( rbw != null )
            {
              rbw.opacity = 1.0f;
              rbw.faces = EnumSet.allOf( ForgeDirection.class );
            }

            instance.renderForPass( 0 );
            instance.setTexture( null );
            Tessellator.instance.setColorOpaque_F( 1, 1, 1 );
          }
        }
      }
      catch (Throwable t)
View Full Code Here

TOP

Related Classes of appeng.client.render.BusRenderHelper

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.