001    package net.minecraft.src;
002    
003    import cpw.mods.fml.common.Side;
004    import cpw.mods.fml.common.asm.SideOnly;
005    import java.util.Random;
006    
007    public class BlockIce extends BlockBreakable
008    {
009        public BlockIce(int par1, int par2)
010        {
011            super(par1, par2, Material.ice, false);
012            this.slipperiness = 0.98F;
013            this.setTickRandomly(true);
014            this.setCreativeTab(CreativeTabs.tabBlock);
015        }
016    
017        @SideOnly(Side.CLIENT)
018    
019        /**
020         * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha
021         */
022        public int getRenderBlockPass()
023        {
024            return 1;
025        }
026    
027        @SideOnly(Side.CLIENT)
028    
029        /**
030         * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given
031         * coordinates.  Args: blockAccess, x, y, z, side
032         */
033        public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
034        {
035            return super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, 1 - par5);
036        }
037    
038        /**
039         * Called when the player destroys a block with an item that can harvest it. (i, j, k) are the coordinates of the
040         * block and l is the block's subtype/damage.
041         */
042        public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
043        {
044            par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1);
045            par2EntityPlayer.addExhaustion(0.025F);
046    
047            if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer.inventory))
048            {
049                ItemStack var9 = this.createStackedBlock(par6);
050    
051                if (var9 != null)
052                {
053                    this.dropBlockAsItem_do(par1World, par3, par4, par5, var9);
054                }
055            }
056            else
057            {
058                if (par1World.provider.isHellWorld)
059                {
060                    par1World.setBlockWithNotify(par3, par4, par5, 0);
061                    return;
062                }
063    
064                int var7 = EnchantmentHelper.getFortuneModifier(par2EntityPlayer.inventory);
065                this.dropBlockAsItem(par1World, par3, par4, par5, par6, var7);
066                Material var8 = par1World.getBlockMaterial(par3, par4 - 1, par5);
067    
068                if (var8.blocksMovement() || var8.isLiquid())
069                {
070                    par1World.setBlockWithNotify(par3, par4, par5, Block.waterMoving.blockID);
071                }
072            }
073        }
074    
075        /**
076         * Returns the quantity of items to drop on block destruction.
077         */
078        public int quantityDropped(Random par1Random)
079        {
080            return 0;
081        }
082    
083        /**
084         * Ticks the block if it's been scheduled
085         */
086        public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
087        {
088            if (par1World.getSavedLightValue(EnumSkyBlock.Block, par2, par3, par4) > 11 - Block.lightOpacity[this.blockID])
089            {
090                if (par1World.provider.isHellWorld)
091                {
092                    par1World.setBlockWithNotify(par2, par3, par4, 0);
093                    return;
094                }
095    
096                this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
097                par1World.setBlockWithNotify(par2, par3, par4, Block.waterStill.blockID);
098            }
099        }
100    
101        /**
102         * Returns the mobility information of the block, 0 = free, 1 = can't push but can move over, 2 = total immobility
103         * and stop pistons
104         */
105        public int getMobilityFlag()
106        {
107            return 0;
108        }
109    }