Package vazkii.botania.common.block.tile

Examples of vazkii.botania.common.block.tile.TileRuneAltar


  ModelSpinningCubes cubes = new ModelSpinningCubes();
  RenderBlocks renderBlocks = new RenderBlocks();

  @Override
  public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partticks) {
    TileRuneAltar altar = (TileRuneAltar) tileentity;

    GL11.glPushMatrix();
    GL11.glColor4f(1F, 1F, 1F, 1F);
    GL11.glTranslated(x, y, z);

    int items = 0;
    for(int i = 0; i < altar.getSizeInventory(); i++)
      if(altar.getStackInSlot(i) == null)
        break;
      else items++;
    float[] angles = new float[altar.getSizeInventory()];

    float anglePer = 360F / items;
    float totalAngle = 0F;
    for(int i = 0; i < angles.length; i++)
      angles[i] = totalAngle += anglePer;

    double time = ClientTickHandler.ticksInGame + partticks;

    for(int i = 0; i < altar.getSizeInventory(); i++) {
      GL11.glPushMatrix();
      GL11.glScalef(0.5F, 0.5F, 0.5F);
      GL11.glTranslatef(1F, 2.5F, 1F);
      GL11.glRotatef(angles[i] + (float) time, 0F, 1F, 0F);
      GL11.glTranslatef(2.25F, 0F, 0.5F);
      GL11.glRotatef(90F, 0F, 1F, 0F);
      GL11.glTranslated(0D, 0.15 * Math.sin((time + i * 10) / 5D), 0F);
      ItemStack stack = altar.getStackInSlot(i);
      Minecraft mc = Minecraft.getMinecraft();
      if(stack != null) {
        mc.renderEngine.bindTexture(stack.getItem() instanceof ItemBlock ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture);

        GL11.glScalef(2F, 2F, 2F);
        if(!ForgeHooksClient.renderEntityItem(new EntityItem(altar.getWorldObj(), altar.xCoord, altar.yCoord, altar.zCoord, stack), stack, 0F, 0F, altar.getWorldObj().rand, mc.renderEngine, renderBlocks, 1)) {
          GL11.glScalef(0.5F, 0.5F, 0.5F);
          if(stack.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(stack.getItem()).getRenderType())) {
            GL11.glScalef(0.5F, 0.5F, 0.5F);
            GL11.glTranslatef(1F, 1.1F, 0F);
            renderBlocks.renderBlockAsItem(Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 1F);
            GL11.glTranslatef(-1F, -1.1F, 0F);
            GL11.glScalef(2F, 2F, 2F);
          } else {
            int renderPass = 0;
            do {
              IIcon icon = stack.getItem().getIcon(stack, renderPass);
              if(icon != null) {
                Color color = new Color(stack.getItem().getColorFromItemStack(stack, renderPass));
                GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
                float f = icon.getMinU();
                float f1 = icon.getMaxU();
                float f2 = icon.getMinV();
                float f3 = icon.getMaxV();
                ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
                GL11.glColor3f(1F, 1F, 1F);
              }
              renderPass++;
            } while(renderPass < stack.getItem().getRenderPasses(stack.getItemDamage()));
          }
        }
      }
      GL11.glPopMatrix();
    }

    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glPushMatrix();
    GL11.glTranslatef(0.5F, 1.8F, 0.5F);
    GL11.glRotatef(180F, 1F, 0F, 1F);
    int repeat = 15;
    cubes.renderSpinningCubes(2, repeat, repeat);
    GL11.glPopMatrix();

    GL11.glTranslatef(0F, 1.2F, 2F);
    float scale = altar.getTargetMana() == 0 ? 0 : (float) altar.getCurrentMana() / (float) altar.getTargetMana() / 75F;

    if(scale != 0) {
      int seed = altar.xCoord ^ altar.yCoord ^ altar.zCoord;
      GL11.glTranslatef(0.5F, 0.7F, 0.5F);
      RenderHelper.renderStar(0x00E4D7, scale, scale, scale, seed);
View Full Code Here


      icons[i] = IconHelper.forBlock(par1IconRegister, this, i);
  }

  @Override
  public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
    TileRuneAltar altar = (TileRuneAltar) par1World.getTileEntity(par2, par3, par4);

   
    if(par5EntityPlayer.isSneaking()) {
      if(altar.manaToGet == 0)
        for(int i = altar.getSizeInventory() - 1; i >= 0; i--) {
          ItemStack stackAt = altar.getStackInSlot(i);
          if(stackAt != null) {
            ItemStack copy = stackAt.copy();
            if(!par5EntityPlayer.inventory.addItemStackToInventory(copy))
              par5EntityPlayer.dropPlayerItemWithRandomChoice(copy, false);
            altar.setInventorySlotContents(i, null);
            par1World.func_147453_f(par2, par3, par4, this);
            break;
          }
        }
    } else {
      ItemStack stack = par5EntityPlayer.getCurrentEquippedItem();
      if(stack != null)
        return altar.addItem(par5EntityPlayer, stack);
    }
    return false;
  }
View Full Code Here

    return icons[Math.min(2, par1)];
  }

  @Override
  public TileEntity createNewTileEntity(World world, int meta) {
    return new TileRuneAltar();
  }
View Full Code Here

    return true;
  }

  @Override
  public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) {
    TileRuneAltar altar = (TileRuneAltar) par1World.getTileEntity(par2, par3, par4);
    return altar.signal;
  }
View Full Code Here

    return true;
  }

  @Override
  public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) {
    TileRuneAltar altar = (TileRuneAltar) par1World.getTileEntity(par2, par3, par4);
    return altar.signal;
  }
View Full Code Here

TOP

Related Classes of vazkii.botania.common.block.tile.TileRuneAltar

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.