001    package net.minecraft.block;
002    
003    import cpw.mods.fml.relauncher.Side;
004    import cpw.mods.fml.relauncher.SideOnly;
005    import java.util.Random;
006    import net.minecraft.block.material.Material;
007    import net.minecraft.world.World;
008    
009    public class BlockMushroomCap extends Block
010    {
011        /** The mushroom type. 0 for brown, 1 for red. */
012        private int mushroomType;
013    
014        public BlockMushroomCap(int par1, Material par2Material, int par3, int par4)
015        {
016            super(par1, par3, par2Material);
017            this.mushroomType = par4;
018        }
019    
020        /**
021         * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
022         */
023        public int getBlockTextureFromSideAndMetadata(int par1, int par2)
024        {
025            return par2 == 10 && par1 > 1 ? this.blockIndexInTexture - 1 : (par2 >= 1 && par2 <= 9 && par1 == 1 ? this.blockIndexInTexture - 16 - this.mushroomType : (par2 >= 1 && par2 <= 3 && par1 == 2 ? this.blockIndexInTexture - 16 - this.mushroomType : (par2 >= 7 && par2 <= 9 && par1 == 3 ? this.blockIndexInTexture - 16 - this.mushroomType : ((par2 == 1 || par2 == 4 || par2 == 7) && par1 == 4 ? this.blockIndexInTexture - 16 - this.mushroomType : ((par2 == 3 || par2 == 6 || par2 == 9) && par1 == 5 ? this.blockIndexInTexture - 16 - this.mushroomType : (par2 == 14 ? this.blockIndexInTexture - 16 - this.mushroomType : (par2 == 15 ? this.blockIndexInTexture - 1 : this.blockIndexInTexture)))))));
026        }
027    
028        /**
029         * Returns the quantity of items to drop on block destruction.
030         */
031        public int quantityDropped(Random par1Random)
032        {
033            int var2 = par1Random.nextInt(10) - 7;
034    
035            if (var2 < 0)
036            {
037                var2 = 0;
038            }
039    
040            return var2;
041        }
042    
043        /**
044         * Returns the ID of the items to drop on destruction.
045         */
046        public int idDropped(int par1, Random par2Random, int par3)
047        {
048            return Block.mushroomBrown.blockID + this.mushroomType;
049        }
050    
051        @SideOnly(Side.CLIENT)
052    
053        /**
054         * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative)
055         */
056        public int idPicked(World par1World, int par2, int par3, int par4)
057        {
058            return Block.mushroomBrown.blockID + this.mushroomType;
059        }
060    }