spenk

ItemSeed

Aug 22nd, 2013
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.16 KB | None | 0 0
  1. package net.bplaced.spenk.drugmod.items;
  2.  
  3. import net.bplaced.spenk.drugmod.DrugsMod;
  4. import net.minecraft.block.Block;
  5. import net.minecraft.creativetab.CreativeTabs;
  6. import net.minecraft.entity.player.EntityPlayer;
  7. import net.minecraft.item.Item;
  8. import net.minecraft.item.ItemStack;
  9. import net.minecraft.world.World;
  10.  
  11. import net.minecraftforge.common.EnumPlantType;
  12. import net.minecraftforge.common.ForgeDirection;
  13. import net.minecraftforge.common.IPlantable;
  14.  
  15. public class ItemCanabisSeed extends Item implements IPlantable
  16. {
  17.  
  18.     public ItemCanabisSeed(int par1)
  19.     {
  20.         super(par1);
  21.         setItemConfigurations();
  22.     }
  23.    
  24.     private void setItemConfigurations(){
  25.         setUnlocalizedName("Canabis seed");
  26.         setCreativeTab(DrugsMod.customTab);
  27.         func_111206_d("drugmod:canabis_seed");
  28.     }
  29.  
  30.     /**
  31.      * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
  32.      * True if something happen and false if it don't. This is for ITEMS, not BLOCKS
  33.      */
  34.     public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
  35.     {
  36.         if (par7 != 1)
  37.         {
  38.             return false;
  39.         }
  40.         else if (par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) && par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack))
  41.         {
  42.             int i1 = par3World.getBlockId(par4, par5, par6);
  43.             if (i1 == DrugsMod.blockSeedpot.blockID){
  44.                 return true;
  45.             }
  46.             else
  47.             {
  48.                 return false;
  49.             }
  50.         }
  51.         else
  52.         {
  53.             return false;
  54.         }
  55.     }
  56.  
  57.     @Override
  58.     public EnumPlantType getPlantType(World world, int x, int y, int z)
  59.     {
  60.         return  EnumPlantType.Crop;
  61.     }
  62.  
  63.     @Override
  64.     public int getPlantID(World world, int x, int y, int z)
  65.     {
  66.         return DrugsMod.blockPotCanabis.blockID;
  67.     }
  68.  
  69.     @Override
  70.     public int getPlantMetadata(World world, int x, int y, int z)
  71.     {
  72.         return 0;
  73.     }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment