Package appeng.tile.misc

Examples of appeng.tile.misc.TileInscriber


  public boolean onActivated(World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ)
  {
    if ( p.isSneaking() )
      return false;

    TileInscriber tg = getTileEntity( w, x, y, z );
    if ( tg != null )
    {
      if ( Platform.isServer() )
        Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_INSCRIBER );
      return true;
View Full Code Here


  }

  @Override
  public void renderTile(AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer)
  {
    TileInscriber inv = (TileInscriber) tile;

    GL11.glPushMatrix();
    applyTESRRotation( x, y, z, tile.getForward(), tile.getUp() );

    GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
    GL11.glDisable( GL11.GL_LIGHTING );
    GL11.glDisable( GL12.GL_RESCALE_NORMAL );

    Minecraft mc = Minecraft.getMinecraft();
    mc.renderEngine.bindTexture( TextureMap.locationBlocksTexture );

    int br = tile.getWorldObj().getLightBrightnessForSkyBlocks( tile.xCoord, tile.yCoord, tile.zCoord, 0 );// << 20 | light << 4;
    int var11 = br % 65536;
    int var12 = br / 65536;
    OpenGlHelper.setLightmapTextureCoords( OpenGlHelper.lightmapTexUnit, var11, var12 );

    float TwoPx = 2.0f / 16.0f;
    float middle = 0.5f;

    float press = 0.2f;
    float base = 0.4f;

    long absoluteProgress = 0;
    if ( inv.smash )
    {
      long currentTime = System.currentTimeMillis();
      absoluteProgress = currentTime - inv.clientStart;
      if ( absoluteProgress > 800 )
        inv.smash = false;
    }

    float relativeProgress = absoluteProgress % 800 / 400.0f;
    float progress = relativeProgress;

    if ( progress > 1.0f )
      progress = 1.0f - (progress - 1.0f);
    press -= progress / 5.0f;

    IIcon ic = ExtraBlockTextures.BlockInscriberInside.getIcon();
    tess.startDrawingQuads();

    middle += 0.02f;
    tess.addVertexWithUV( TwoPx, middle + press, TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 2 ) );
    tess.addVertexWithUV( 1.0 - TwoPx, middle + press, TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 2 ) );
    tess.addVertexWithUV( 1.0 - TwoPx, middle + press, 1.0 - TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 13 ) );
    tess.addVertexWithUV( TwoPx, middle + press, 1.0 - TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 13 ) );

    tess.addVertexWithUV( TwoPx, middle + press, 1.0 - TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 ) );
    tess.addVertexWithUV( 1.0 - TwoPx, middle + press, 1.0 - TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 ) );
    tess.addVertexWithUV( 1.0 - TwoPx, middle + base, 1.0 - TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 - 16 * (press - base) ) );
    tess.addVertexWithUV( TwoPx, middle + base, 1.0 - TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 - 16 * (press - base) ) );

    middle -= 2.0f * 0.02f;
    tess.addVertexWithUV( 1.0 - TwoPx, middle - press, TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 2 ) );
    tess.addVertexWithUV( TwoPx, middle - press, TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 2 ) );
    tess.addVertexWithUV( TwoPx, middle - press, 1.0 - TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 13 ) );
    tess.addVertexWithUV( 1.0 - TwoPx, middle - press, 1.0 - TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 13 ) );

    tess.addVertexWithUV( 1.0 - TwoPx, middle - press, 1.0 - TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 ) );
    tess.addVertexWithUV( TwoPx, middle - press, 1.0 - TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 ) );
    tess.addVertexWithUV( TwoPx, middle - base, 1.0 - TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 - 16 * (press - base) ) );
    tess.addVertexWithUV( 1.0 - TwoPx, middle + -base, 1.0 - TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 - 16 * (press - base) ) );

    tess.draw();

    GL11.glPopMatrix();

    int items = 0;
    if ( inv.getStackInSlot( 0 ) != null )
      items++;
    if ( inv.getStackInSlot( 1 ) != null )
      items++;
    if ( inv.getStackInSlot( 2 ) != null )
      items++;

    if ( relativeProgress > 1.0f || items == 0 )
    {
      ItemStack is = inv.getStackInSlot( 3 );

      if ( is == null )
      {
        InscriberRecipe ir = inv.getTask();
        if ( ir != null )
          is = ir.output.copy();
      }

      renderItem( is, 0.0f, block, tile, tess, x, y, z, f, renderer );
    }
    else
    {
      renderItem( inv.getStackInSlot( 0 ), press, block, tile, tess, x, y, z, f, renderer );
      renderItem( inv.getStackInSlot( 1 ), -press, block, tile, tess, x, y, z, f, renderer );
      renderItem( inv.getStackInSlot( 2 ), 0.0f, block, tile, tess, x, y, z, f, renderer );
    }

  }
View Full Code Here

TOP

Related Classes of appeng.tile.misc.TileInscriber

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.