package net.minecraft.block;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.event.ForgeEventFactory;
public class BlockIce extends BlockBreakable
{
private static final String __OBFID = "CL_00000259";
public BlockIce()
{
super("ice", Material.ice, false);
this.slipperiness = 0.98F;
this.setTickRandomly(true);
this.setCreativeTab(CreativeTabs.tabBlock);
}
/**
* Returns which pass should this block be rendered on. 0 for solids and 1 for alpha
*/
@SideOnly(Side.CLIENT)
public int getRenderBlockPass()
{
return 1;
}
/**
* Returns true if the given side of this block type should be rendered, if the adjacent block is at the given
* coordinates. Args: blockAccess, x, y, z, side
*/
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess worldIn, int x, int y, int z, int side)
{
return super.shouldSideBeRendered(worldIn, x, y, z, 1 - side);
}
public void harvestBlock(World worldIn, EntityPlayer player, int x, int y, int z, int meta)
{
player.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(this)], 1);
player.addExhaustion(0.025F);
if (this.canSilkHarvest(worldIn, player, x, y, z, meta) && EnchantmentHelper.getSilkTouchModifier(player))
{
ArrayList<ItemStack> items = new ArrayList<ItemStack>();
ItemStack itemstack = this.createStackedBlock(meta);
if (itemstack != null) items.add(itemstack);
ForgeEventFactory.fireBlockHarvesting(items, worldIn, this, x, y, z, meta, 0, 1.0f, true, player);
for (ItemStack is : items)
this.dropBlockAsItem(worldIn, x, y, z, is);
}
else
{
if (worldIn.provider.isHellWorld)
{
worldIn.setBlockToAir(x, y, z);
return;
}
int i1 = EnchantmentHelper.getFortuneModifier(player);
harvesters.set(player);
this.dropBlockAsItem(worldIn, x, y, z, meta, i1);
harvesters.set(null);
Material material = worldIn.getBlock(x, y - 1, z).getMaterial();
if (material.blocksMovement() || material.isLiquid())
{
worldIn.setBlock(x, y, z, Blocks.flowing_water);
}
}
}
/**
* Returns the quantity of items to drop on block destruction.
*/
public int quantityDropped(Random random)
{
return 0;
}
/**
* Ticks the block if it's been scheduled
*/
public void updateTick(World worldIn, int x, int y, int z, Random random)
{
if (worldIn.getSavedLightValue(EnumSkyBlock.Block, x, y, z) > 11 - this.getLightOpacity())
{
if (worldIn.provider.isHellWorld)
{
worldIn.setBlockToAir(x, y, z);
return;
}
this.dropBlockAsItem(worldIn, x, y, z, worldIn.getBlockMetadata(x, y, z), 0);
worldIn.setBlock(x, y, z, Blocks.water);
}
}
public int getMobilityFlag()
{
return 0;
}
}