TechMage66

ItemBookFireball

Feb 9th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.30 KB | None | 0 0
  1. package com.techmage.magetech.item;
  2.  
  3. import com.techmage.magetech.handler.SoulsHandler;
  4. import net.minecraft.entity.player.EntityPlayer;
  5. import net.minecraft.entity.projectile.EntitySmallFireball;
  6. import net.minecraft.item.ItemStack;
  7. import net.minecraft.util.Vec3;
  8. import net.minecraft.world.World;
  9.  
  10. public class ItemBookFireball extends ItemMageTech
  11. {
  12.     public static final int soulCost = 100;
  13.  
  14.     public ItemBookFireball()
  15.     {
  16.         super();
  17.  
  18.         this.setMaxStackSize(1);
  19.     }
  20.  
  21.     @Override
  22.     public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)
  23.     {
  24.         if (SoulsHandler.hasEnoughSouls(playerIn, soulCost))
  25.         {
  26.             SoulsHandler.useSouls(playerIn, soulCost);
  27.  
  28.             Vec3 look = playerIn.getLookVec();
  29.             EntitySmallFireball fireball = new EntitySmallFireball(worldIn, playerIn, 1, 1, 1);
  30.  
  31.             fireball.setPosition(playerIn.posX + look.xCoord * 5, playerIn.posY + 1 + look.yCoord * 5, playerIn.posZ + look.zCoord * 5);
  32.             fireball.accelerationX = look.xCoord * 0.1;
  33.             fireball.accelerationY = look.yCoord * 0.1;
  34.             fireball.accelerationZ = look.zCoord * 0.1;
  35.  
  36.             worldIn.spawnEntityInWorld(fireball);
  37.         }
  38.  
  39.         return itemStackIn;
  40.     }
  41. }
Add Comment
Please, Sign In to add comment