Examples of TileAltar


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

  @Override
  public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
    GL11.glPushMatrix();
    GL11.glTranslatef(-0.5F, -0.6F, -0.5F);
    GL11.glScalef(0.9F, 0.9F, 0.9F);
    TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileAltar(), 0.0D, 0.0D, 0.0D, 0.0F);
    GL11.glPopMatrix();
  }
View Full Code Here

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

  ModelAltar model = new ModelAltar();
  RenderItem renderItem = new RenderItem();

  @Override
  public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float pticks) {
    TileAltar altar = (TileAltar) tileentity;

    GL11.glPushMatrix();
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor4f(1F, 1F, 1F, 1F);
    Minecraft.getMinecraft().renderEngine.bindTexture(altar.isMossy ? textureMossy : texture);

    GL11.glTranslated(d0 + 0.5, d1 + 1.5, d2 + 0.5);
    GL11.glScalef(1F, -1F, -1F);
    model.render();
    GL11.glScalef(1F, -1F, -1F);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);

    if(altar.hasWater) {
      GL11.glPushMatrix();
      float s = 1F / 256F * 10F;
      float v = 1F / 8F;
      float w = -v * 2.5F;

      int petals = 0;
      for(int i = 0; i < altar.getSizeInventory(); i++)
        if(altar.getStackInSlot(i) != null)
          petals++;
        else break;

      if(petals > 0) {
        final float modifier = 6F;
        final float rotationModifier = 0.25F;
        final float radiusBase = 1.2F;
        final float radiusMod = 0.1F;

        double ticks = (ClientTickHandler.ticksInGame + pticks) * 0.5;
        float offsetPerPetal = 360 / petals;

        GL11.glPushMatrix();
        GL11.glTranslatef(-0.05F, -0.5F, 0F);
        GL11.glScalef(v, v, v);
        for(int i = 0; i < petals; i++) {
          float offset = offsetPerPetal * i;
          float deg = (int) (ticks / rotationModifier % 360F + offset);
          float rad = deg * (float) Math.PI / 180F;
          float radiusX = (float) (radiusBase + radiusMod * Math.sin(ticks / modifier));
          float radiusZ = (float) (radiusBase + radiusMod * Math.cos(ticks / modifier));
          float x =  (float) (radiusX * Math.cos(rad));
          float z = (float) (radiusZ * Math.sin(rad));
          float y = (float) Math.cos((ticks + 50 * i) / 5F) / 10F;

          GL11.glPushMatrix();
          GL11.glTranslatef(x, y, z);
          float xRotate = (float) Math.sin(ticks * rotationModifier) / 2F;
          float yRotate = (float) Math.max(0.6F, Math.sin(ticks * 0.1F) / 2F + 0.5F);
          float zRotate = (float) Math.cos(ticks * rotationModifier) / 2F;

          v /= 2F;
          GL11.glTranslatef(v, v, v);
          GL11.glRotatef(deg, xRotate, yRotate, zRotate);
          GL11.glTranslatef(-v, -v, -v);
          v *= 2F;

          GL11.glColor4f(1F, 1F, 1F, 1F);

          ItemStack stack = altar.getStackInSlot(i);
          Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
          IIcon icon = stack.getItem().getIcon(stack, 0);
          if(icon != null) {
            Color color = new Color(stack.getItem().getColorFromItemStack(stack, 0));
            GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
View Full Code Here

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

  }

  @Override
  public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) {
    if(par5Entity instanceof EntityItem) {
      TileAltar tile = (TileAltar) par1World.getTileEntity(par2, par3, par4);
      tile.collideEntityItem((EntityItem) par5Entity);
    }
  }
View Full Code Here

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

  }

  @Override
  public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
    ItemStack stack = par5EntityPlayer.getCurrentEquippedItem();
    TileAltar tile = (TileAltar) par1World.getTileEntity(par2, par3, par4);

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

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

    return LibRenderIDs.idAltar;
  }

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

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

    return true;
  }

  @Override
  public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) {
    TileAltar altar = (TileAltar) par1World.getTileEntity(par2, par3, par4);
    return altar.hasWater ? 15 : 0;
  }
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.