// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode fieldsfirst 

package net.minecraft.src;

import java.util.Random;

// Referenced classes of package net.minecraft.src:
//            BlockContainer, Material, mod_decor, Block, 
//            EntityLiving, MathHelper, World, EntityYashik, 
//            IInventory, EntityPlayer, TileEntity

public class Yashik extends BlockContainer
{

    public Yashik(int i, int j)
    {
        super(i, j, Material.wood);
        blockIndexInTexture = j;
    }

    public int idDropped(int i, int j)
    {
        return mod_decor.yashik.blockID;
    }

    public int quantityDropped(Random random)
    {
        return 1;
    }

    public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving)
    {
        int l = MathHelper.floor_double((double)((entityliving.rotationYaw * 4F) / 360F) + 2.5D) & 3;
        world.setBlockMetadataWithNotify(i, j, k, l);
    }

    public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer)
    {
        EntityYashik entityyashik = (EntityYashik)world.getBlockTileEntity(i, j, k);
        if(entityyashik == null)
        {
            return true;
        }
        if(world.isBlockNormalCube(i, j + 1, k))
        {
            return true;
        }
        if(world.getBlockId(i - 1, j, k) == blockID && world.isBlockNormalCube(i - 1, j + 1, k))
        {
            return true;
        }
        if(world.getBlockId(i + 1, j, k) == blockID && world.isBlockNormalCube(i + 1, j + 1, k))
        {
            return true;
        }
        if(world.getBlockId(i, j, k - 1) == blockID && world.isBlockNormalCube(i, j + 1, k - 1))
        {
            return true;
        }
        if(world.getBlockId(i, j, k + 1) == blockID && world.isBlockNormalCube(i, j + 1, k + 1))
        {
            return true;
        }
        if(world.multiplayerWorld)
        {
            return true;
        } else
        {
            entityplayer.displayGUIChest((IInventory)entityyashik);
            return true;
        }
    }

    public TileEntity getBlockEntity()
    {
        return new EntityYashik();
    }
}
