Advertisement
Guest User

Shotgun

a guest
Jan 30th, 2017
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.45 KB | None | 0 0
  1. package theishiopian.gunmod.items;
  2.  
  3. import net.minecraft.creativetab.CreativeTabs;
  4. import net.minecraft.entity.EntityLivingBase;
  5. import net.minecraft.entity.player.EntityPlayer;
  6. import net.minecraft.entity.projectile.EntityArrow;
  7. import net.minecraft.entity.projectile.EntitySmallFireball;
  8. import net.minecraft.init.Items;
  9. import net.minecraft.item.Item;
  10. import net.minecraft.item.ItemArrow;
  11. import net.minecraft.item.ItemStack;
  12. import net.minecraft.util.ActionResult;
  13. import net.minecraft.util.EnumActionResult;
  14. import net.minecraft.util.EnumHand;
  15. import net.minecraft.util.math.MathHelper;
  16. import net.minecraft.world.World;
  17. import theishiopian.gunmod.entity.EntityBullet;
  18.  
  19. public class Shotgun extends Item
  20. {
  21.     public Shotgun()
  22.     {
  23.         this.setUnlocalizedName("shotgun");
  24.         this.setRegistryName("gun");
  25.         this.setCreativeTab(CreativeTabs.COMBAT);
  26.         this.setMaxStackSize(1);
  27.     }
  28.    
  29.     @Override
  30.     public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand)
  31.     {
  32.         if (!worldIn.isRemote)
  33.         {
  34.             for(int i = 0; i!=9; i++)
  35.             {
  36.                  EntityBullet bullet = new EntityBullet(worldIn, playerIn);
  37.                  bullet.setHeadingFromThrower(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0, 1, 7);
  38.                  bullet.world.spawnEntity(bullet);
  39.             }  
  40.         }
  41.        
  42.         playerIn.getCooldownTracker().setCooldown(this, 20);
  43.         return new ActionResult(EnumActionResult.PASS, playerIn.getHeldItem(hand));
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement