package net.minecraft.block;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.util.IIcon;
import net.minecraft.world.ColorizerGrass;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.IShearable;
public class BlockTallGrass extends BlockBush implements IGrowable, IShearable
{
private static final String[] field_149871_a = new String[] {"deadbush", "tallgrass", "fern"};
@SideOnly(Side.CLIENT)
private IIcon[] field_149870_b;
private static final String __OBFID = "CL_00000321";
protected BlockTallGrass()
{
super(Material.vine);
float f = 0.4F;
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.8F, 0.5F + f);
}
/**
* Gets the block's texture. Args: side, meta
*/
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta)
{
if (meta >= this.field_149870_b.length)
{
meta = 0;
}
return this.field_149870_b[meta];
}
@SideOnly(Side.CLIENT)
public int getBlockColor()
{
double d0 = 0.5D;
double d1 = 1.0D;
return ColorizerGrass.getGrassColor(d0, d1);
}
/**
* Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants.
*/
public boolean canBlockStay(World worldIn, int x, int y, int z)
{
return super.canBlockStay(worldIn, x, y, z);
}
/**
* Returns the color this block should be rendered. Used by leaves.
*/
@SideOnly(Side.CLIENT)
public int getRenderColor(int meta)
{
return meta == 0 ? 16777215 : ColorizerGrass.getGrassColor(0.5D, 1.0D);
}
/**
* Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called
* when first determining what to render.
*/
@SideOnly(Side.CLIENT)
public int colorMultiplier(IBlockAccess worldIn, int x, int y, int z)
{
int l = worldIn.getBlockMetadata(x, y, z);
return l == 0 ? 16777215 : worldIn.getBiomeGenForCoords(x, z).getBiomeGrassColor(x, y, z);
}
public Item getItemDropped(int meta, Random random, int fortune)
{
return null;
}
/**
* Returns the usual quantity dropped by the block plus a bonus of 1 to 'i' (inclusive).
*/
public int quantityDroppedWithBonus(int maxBonus, Random random)
{
return 1 + random.nextInt(maxBonus * 2 + 1);
}
public void harvestBlock(World worldIn, EntityPlayer player, int x, int y, int z, int meta)
{
{
super.harvestBlock(worldIn, player, x, y, z, meta);
}
}
/**
* Get the block's damage value (for use with pick block).
*/
public int getDamageValue(World worldIn, int x, int y, int z)
{
return worldIn.getBlockMetadata(x, y, z);
}
/**
* returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
*/
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item itemIn, CreativeTabs tab, List list)
{
for (int i = 1; i < 3; ++i)
{
list.add(new ItemStack(itemIn, 1, i));
}
}
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister reg)
{
this.field_149870_b = new IIcon[field_149871_a.length];
for (int i = 0; i < this.field_149870_b.length; ++i)
{
this.field_149870_b[i] = reg.registerIcon(field_149871_a[i]);
}
}
public boolean canFertilize(World worldIn, int x, int y, int z, boolean isClient)
{
int l = worldIn.getBlockMetadata(x, y, z);
return l != 0;
}
public boolean shouldFertilize(World worldIn, Random random, int x, int y, int z)
{
return true;
}
public void fertilize(World worldIn, Random random, int x, int y, int z)
{
int l = worldIn.getBlockMetadata(x, y, z);
byte b0 = 2;
if (l == 2)
{
b0 = 3;
}
if (Blocks.double_plant.canPlaceBlockAt(worldIn, x, y, z))
{
Blocks.double_plant.func_149889_c(worldIn, x, y, z, b0, 2);
}
}
@Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int meta, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
if (world.rand.nextInt(8) != 0) return ret;
ItemStack seed = ForgeHooks.getGrassSeed(world);
if (seed != null) ret.add(seed);
return ret;
}
@Override
public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z)
{
return true;
}
@Override
public ArrayList<ItemStack> onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z)));
return ret;
}
}