001 package net.minecraft.block; 002 003 import java.util.Random; 004 import net.minecraft.block.material.Material; 005 import net.minecraft.entity.player.EntityPlayer; 006 import net.minecraft.item.Item; 007 import net.minecraft.item.ItemStack; 008 import net.minecraft.stats.StatList; 009 import net.minecraft.world.World; 010 011 public class BlockDeadBush extends BlockFlower 012 { 013 protected BlockDeadBush(int par1, int par2) 014 { 015 super(par1, par2, Material.vine); 016 float var3 = 0.4F; 017 this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, 0.8F, 0.5F + var3); 018 } 019 020 /** 021 * Gets passed in the blockID of the block below and supposed to return true if its allowed to grow on the type of 022 * blockID passed in. Args: blockID 023 */ 024 protected boolean canThisPlantGrowOnThisBlockID(int par1) 025 { 026 return par1 == Block.sand.blockID; 027 } 028 029 /** 030 * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata 031 */ 032 public int getBlockTextureFromSideAndMetadata(int par1, int par2) 033 { 034 return this.blockIndexInTexture; 035 } 036 037 /** 038 * Returns the ID of the items to drop on destruction. 039 */ 040 public int idDropped(int par1, Random par2Random, int par3) 041 { 042 return -1; 043 } 044 045 /** 046 * Called when the player destroys a block with an item that can harvest it. (i, j, k) are the coordinates of the 047 * block and l is the block's subtype/damage. 048 */ 049 public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) 050 { 051 if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID) 052 { 053 par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); 054 this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(Block.deadBush, 1, par6)); 055 } 056 else 057 { 058 super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); 059 } 060 } 061 }