Package appeng.tile.storage

Examples of appeng.tile.storage.TileChest$ChestMonitorHandler


  }

  @Override
  public boolean onActivated(World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ)
  {
    TileChest tg = getTileEntity( w, x, y, z );
    if ( tg != null && !p.isSneaking() )
    {
      if ( Platform.isClient() )
        return true;

      if ( side != tg.getUp().ordinal() )
      {
        Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_CHEST );
      }
      else
      {
        ItemStack cell = tg.getStackInSlot( 1 );
        if ( cell != null )
        {
          ICellHandler ch = AEApi.instance().registries().cell().getHandler( cell );

          tg.openGui( p, ch, cell, side );
        }
        else
          p.addChatMessage( PlayerMessages.ChestCannotReadStorageCell.get() );
      }
View Full Code Here


  }

  @Override
  public boolean renderInWorld(AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
  {
    TileChest sp = imb.getTileEntity( world, x, y, z );
    renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );

    ForgeDirection up = sp.getUp();
    ForgeDirection forward = sp.getForward();
    ForgeDirection west = Platform.crossProduct( forward, up );

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

    int stat = sp.getCellStatus( 0 );
    boolean result = renderer.renderStandardBlock( imb, x, y, z );

    selectFace( renderer, west, up, forward, 5, 16 - 5, 9, 12 );

    int offsetU = -4;
    int offsetV = 8;
    if ( stat == 0 )
      offsetV = 3;

    int b = world.getLightBrightnessForSkyBlocks( x + forward.offsetX, y + forward.offsetY, z + forward.offsetZ, 0 );
    Tessellator.instance.setBrightness( b );
    Tessellator.instance.setColorOpaque_I( 0xffffff );

    FlippableIcon flippableIcon = new FlippableIcon( new OffsetIcon( ExtraBlockTextures.MEStorageCellTextures.getIcon(), offsetU, offsetV ) );
    if ( forward == ForgeDirection.EAST && (up == ForgeDirection.NORTH || up == ForgeDirection.SOUTH) )
      flippableIcon.setFlip( true, false );
    else if ( forward == ForgeDirection.NORTH && up == ForgeDirection.EAST )
      flippableIcon.setFlip( false, true );
    else if ( forward == ForgeDirection.NORTH && up == ForgeDirection.WEST )
      flippableIcon.setFlip( true, false );
    else if ( forward == ForgeDirection.DOWN && up == ForgeDirection.EAST )
      flippableIcon.setFlip( false, true );
    else if ( forward == ForgeDirection.DOWN )
      flippableIcon.setFlip( true, false );

    /*
     * 1.7.2
     *
     * else if ( forward == ForgeDirection.EAST && up == ForgeDirection.UP ) flippableIcon.setFlip( true, false ); else if (
     * forward == ForgeDirection.NORTH && up == ForgeDirection.UP ) flippableIcon.setFlip( true, false );
     */

    renderFace( x, y, z, imb, flippableIcon, renderer, forward );

    if ( stat != 0 )
    {
      b = 0;
      if ( sp.isPowered() )
      {
        b = 15 << 20 | 15 << 4;
      }

      Tessellator.instance.setBrightness( b );
      if ( stat == 1 )
        Tessellator.instance.setColorOpaque_I( 0x00ff00 );
      if ( stat == 2 )
        Tessellator.instance.setColorOpaque_I( 0xffaa00 );
      if ( stat == 3 )
        Tessellator.instance.setColorOpaque_I( 0xff0000 );
      selectFace( renderer, west, up, forward, 9, 10, 11, 12 );
      renderFace( x, y, z, imb, ExtraBlockTextures.White.getIcon(), renderer, forward );
    }

    b = world.getLightBrightnessForSkyBlocks( x + up.offsetX, y + up.offsetY, z + up.offsetZ, 0 );
    if ( sp.isPowered() )
    {
      b = 15 << 20 | 15 << 4;
    }

    Tessellator.instance.setBrightness( b );
    Tessellator.instance.setColorOpaque_I( 0xffffff );
    renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );

    ICellHandler ch = AEApi.instance().registries().cell().getHandler( sp.getStorageType() );

    Tessellator.instance.setColorOpaque_I( sp.getColor().whiteVariant );
    IIcon ico = ch == null ? null : ch.getTopTexture_Light();
    renderFace( x, y, z, imb, ico == null ? ExtraBlockTextures.MEChest.getIcon() : ico, renderer, up );

    if ( ico != null )
    {
      Tessellator.instance.setColorOpaque_I( sp.getColor().mediumVariant );
      ico = ch == null ? null : ch.getTopTexture_Medium();
      renderFace( x, y, z, imb, ico == null ? ExtraBlockTextures.MEChest.getIcon() : ico, renderer, up );

      Tessellator.instance.setColorOpaque_I( sp.getColor().blackVariant );
      ico = ch == null ? null : ch.getTopTexture_Dark();
      renderFace( x, y, z, imb, ico == null ? ExtraBlockTextures.MEChest.getIcon() : ico, renderer, up );
    }

    renderer.overrideBlockTexture = null;
View Full Code Here

TOP

Related Classes of appeng.tile.storage.TileChest$ChestMonitorHandler

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.