Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.minecraft.src;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Random;
- public class BlockTallGrass extends BlockFlower
- {
- protected BlockTallGrass(int par1, int par2)
- {
- super(par1, par2, Material.vine);
- float var3 = 0.4F;
- this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, 0.8F, 0.5F + var3);
- }
- /**
- * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
- */
- public int getBlockTextureFromSideAndMetadata(int par1, int par2)
- {
- return par2 == 1 ? this.blockIndexInTexture : (par2 == 2 ? this.blockIndexInTexture + 16 + 1 : (par2 == 0 ? this.blockIndexInTexture + 16 : this.blockIndexInTexture));
- }
- public int getBlockColor()
- {
- double var1 = 0.5D;
- double var3 = 1.0D;
- return ColorizerGrass.getGrassColor(var1, var3);
- }
- /**
- * Returns the color this block should be rendered. Used by leaves.
- */
- public int getRenderColor(int par1)
- {
- return par1 == 0 ? 16777215 : ColorizerFoliage.getFoliageColorBasic();
- }
- /**
- * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called
- * when first determining what to render.
- */
- public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
- {
- int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
- return var5 == 0 ? 16777215 : par1IBlockAccess.getBiomeGenForCoords(par2, par4).getBiomeGrassColor();
- }
- /**
- * Returns the ID of the items to drop on destruction.
- */
- public int idDropped(int par1, Random par2Random, int par3)
- {
- return par2Random.nextInt(8) == 0 ? Item.seeds.shiftedIndex : -1;
- }
- /**
- * Returns the usual quantity dropped by the block plus a bonus of 1 to 'i' (inclusive).
- */
- public int quantityDroppedWithBonus(int par1, Random par2Random)
- {
- return 1 + par2Random.nextInt(par1 * 2 + 1);
- }
- /**
- * Called when the player destroys a block with an item that can harvest it. (i, j, k) are the coordinates of the
- * block and l is the block's subtype/damage.
- */
- public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
- {
- if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.shiftedIndex)
- {
- par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1);
- this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(Block.tallGrass, 1, par6));
- }
- else
- {
- super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
- }
- }
- /**
- * Get the block's damage value (for use with pick block).
- */
- public int getDamageValue(World par1World, int par2, int par3, int par4)
- {
- return par1World.getBlockMetadata(par2, par3, par4);
- }
- /**
- * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
- */
- public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
- {
- for (int var4 = 1; var4 < 3; ++var4)
- {
- par3List.add(new ItemStack(par1, 1, var4));
- }
- }
- public int quantityDropped(int l, int i1, Random random)
- {
- return random.nextInt(5) != 0 ? 0 : 1; //1 / # = chance | EX: 2 = 50% chance (1/2 = .5 chance)
- //Random from 0 - (#-1)
- //if the random number = 0
- //drops 1 item
- }
- public ArrayList getBlockDropped(World world, int i, int j, int k, int l, int i1) //basicly just add any items you wana put to drop at a random rate here.
- {
- ArrayList arraylist = new ArrayList();
- int count = quantityDropped(l, i1, world.rand);
- for( int T1 = 0; T1 < count; T1++)
- {
- if (l == 0)
- {
- arraylist.add(new ItemStack(mod_sweetTooth.Pseeds, 2, 3)); //quantity, damage
- }
- }
- return arraylist;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement