Advertisement
Guest User

Block_tallGrass

a guest
Oct 5th, 2012
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.40 KB | None | 0 0
  1. package net.minecraft.src;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.List;
  5. import java.util.Random;
  6.  
  7. public class BlockTallGrass extends BlockFlower
  8. {
  9.     protected BlockTallGrass(int par1, int par2)
  10.     {
  11.         super(par1, par2, Material.vine);
  12.         float var3 = 0.4F;
  13.         this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, 0.8F, 0.5F + var3);
  14.     }
  15.  
  16.     /**
  17.      * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
  18.      */
  19.     public int getBlockTextureFromSideAndMetadata(int par1, int par2)
  20.     {
  21.         return par2 == 1 ? this.blockIndexInTexture : (par2 == 2 ? this.blockIndexInTexture + 16 + 1 : (par2 == 0 ? this.blockIndexInTexture + 16 : this.blockIndexInTexture));
  22.     }
  23.  
  24.     public int getBlockColor()
  25.     {
  26.         double var1 = 0.5D;
  27.         double var3 = 1.0D;
  28.         return ColorizerGrass.getGrassColor(var1, var3);
  29.     }
  30.  
  31.     /**
  32.      * Returns the color this block should be rendered. Used by leaves.
  33.      */
  34.     public int getRenderColor(int par1)
  35.     {
  36.         return par1 == 0 ? 16777215 : ColorizerFoliage.getFoliageColorBasic();
  37.     }
  38.  
  39.     /**
  40.      * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called
  41.      * when first determining what to render.
  42.      */
  43.     public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
  44.     {
  45.         int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
  46.         return var5 == 0 ? 16777215 : par1IBlockAccess.getBiomeGenForCoords(par2, par4).getBiomeGrassColor();
  47.     }
  48.  
  49.     /**
  50.      * Returns the ID of the items to drop on destruction.
  51.      */
  52.     public int idDropped(int par1, Random par2Random, int par3)
  53.     {
  54.         return par2Random.nextInt(8) == 0 ? Item.seeds.shiftedIndex : -1;
  55.     }
  56.  
  57.     /**
  58.      * Returns the usual quantity dropped by the block plus a bonus of 1 to 'i' (inclusive).
  59.      */
  60.     public int quantityDroppedWithBonus(int par1, Random par2Random)
  61.     {
  62.         return 1 + par2Random.nextInt(par1 * 2 + 1);
  63.     }
  64.  
  65.     /**
  66.      * Called when the player destroys a block with an item that can harvest it. (i, j, k) are the coordinates of the
  67.      * block and l is the block's subtype/damage.
  68.      */
  69.     public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
  70.     {
  71.         if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.shiftedIndex)
  72.         {
  73.             par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1);
  74.             this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(Block.tallGrass, 1, par6));
  75.         }
  76.         else
  77.         {
  78.             super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
  79.         }
  80.     }
  81.  
  82.     /**
  83.      * Get the block's damage value (for use with pick block).
  84.      */
  85.     public int getDamageValue(World par1World, int par2, int par3, int par4)
  86.     {
  87.         return par1World.getBlockMetadata(par2, par3, par4);
  88.     }
  89.  
  90.     /**
  91.      * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
  92.      */
  93.     public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
  94.     {
  95.         for (int var4 = 1; var4 < 3; ++var4)
  96.         {
  97.             par3List.add(new ItemStack(par1, 1, var4));
  98.         }
  99.     }  
  100.     public int quantityDropped(int l, int i1, Random random)
  101.     {
  102.         return random.nextInt(5) != 0 ? 0 : 1;     //1 / # = chance | EX: 2 = 50% chance (1/2 = .5 chance)
  103.                           //Random from 0 - (#-1)
  104.                           //if the random number = 0
  105.                           //drops 1 item
  106.     }
  107.     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.
  108.     {
  109.        
  110.             ArrayList arraylist = new ArrayList();
  111.            
  112.            int count = quantityDropped(l, i1, world.rand);
  113.            for( int T1 = 0; T1 < count; T1++)
  114.             {
  115.                 if (l == 0)
  116.                 {
  117.                     arraylist.add(new ItemStack(mod_sweetTooth.Pseeds, 2, 3)); //quantity, damage
  118.                 }
  119.  
  120.             }
  121.         return arraylist;
  122.            
  123.     }
  124.                      
  125.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement