SHARE
TWEET

ItemCard

a guest Mar 18th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.izako.HunterX.items.tools;
  2.  
  3. import com.izako.HunterX.init.ModItems;
  4. import com.izako.HunterX.items.ItemBase;
  5. import com.izako.HunterX.items.entities.EntityCard;
  6.  
  7. import net.minecraft.creativetab.CreativeTabs;
  8. import net.minecraft.entity.player.EntityPlayer;
  9. import net.minecraft.entity.projectile.EntitySnowball;
  10. import net.minecraft.init.SoundEvents;
  11. import net.minecraft.item.ItemStack;
  12. import net.minecraft.stats.StatList;
  13. import net.minecraft.util.ActionResult;
  14. import net.minecraft.util.EnumActionResult;
  15. import net.minecraft.util.EnumHand;
  16. import net.minecraft.util.SoundCategory;
  17. import net.minecraft.world.World;
  18.  
  19. public class ItemCard extends ItemBase {
  20.  
  21.       public ItemCard(String name)
  22.         {
  23.             super(name);
  24.             this.maxStackSize = 54;
  25.             this.setCreativeTab(ModItems.HunterX);
  26.         }
  27.  
  28.         /**
  29.          * Called when the equipped item is right clicked.
  30.          */
  31.         public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn)
  32.         {
  33.             ItemStack itemstack = playerIn.getHeldItem(handIn);
  34.  
  35.             if (!playerIn.capabilities.isCreativeMode)
  36.             {
  37.                 itemstack.shrink(1);
  38.             }
  39.  
  40.             worldIn.playSound((EntityPlayer)null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
  41.  
  42.             if (!worldIn.isRemote)
  43.             {
  44.                 EntityCard entitycard = new EntityCard(worldIn, playerIn);
  45.                 entitycard.shoot(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F);
  46.                 worldIn.spawnEntity(entitycard);
  47.             }
  48.  
  49.             playerIn.addStat(StatList.getObjectUseStats(this));
  50.             return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemstack);
  51.         }
  52.  
  53. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top