Advertisement
Guest User

Untitled

a guest
Oct 26th, 2015
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.93 KB | None | 0 0
  1. package com.mtndewey.ninjamod.item;
  2.  
  3. import net.minecraft.entity.player.EntityPlayer;
  4. import net.minecraft.item.Item;
  5. import net.minecraft.item.ItemStack;
  6. import net.minecraft.world.World;
  7.  
  8. import com.mtndewey.ninjamod.NinjaMod;
  9. import com.mtndewey.ninjamod.entity.EntityNinjaStar;
  10.  
  11. public class ItemNinjaStar extends Item {
  12.  
  13.     public ItemNinjaStar() {
  14.  
  15.         super();
  16.         this.maxStackSize = 64;
  17.         this.setCreativeTab(NinjaMod.tabNinja);
  18.     }
  19.  
  20.     @Override
  21.     public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
  22.         if (!par3EntityPlayer.capabilities.isCreativeMode) {
  23.             --par1ItemStack.stackSize;
  24.         }
  25.         par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F,
  26.                 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
  27.  
  28.         if (!par2World.isRemote) {
  29.             par2World.spawnEntityInWorld(new EntityNinjaStar(par2World,
  30.                     par3EntityPlayer));
  31.         }
  32.  
  33.         return par1ItemStack;
  34.     }
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement