Guest User

Untitled

a guest
Jul 27th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.16 KB | None | 0 0
  1. package melonslise.runicinscription.common.item;
  2.  
  3. import melonslise.runicinscription.RunicInscription;
  4. import melonslise.runicinscription.common.entity.EntityFirebolt;
  5. import net.minecraft.entity.player.EntityPlayer;
  6. import net.minecraft.item.Item;
  7. import net.minecraft.item.ItemStack;
  8. import net.minecraft.util.ActionResult;
  9. import net.minecraft.util.EnumActionResult;
  10. import net.minecraft.util.EnumHand;
  11. import net.minecraft.util.math.Vec3d;
  12. import net.minecraft.world.World;
  13.  
  14. public class ItemBase extends Item
  15. {
  16.     public ItemBase(String name)
  17.     {
  18.         this.setRegistryName(name);
  19.         this.setUnlocalizedName(name);
  20.         this.setCreativeTab(RunicInscription.creativeTab);
  21.     }
  22.  
  23.     @Override
  24.     public ActionResult<ItemStack> onItemRightClick(ItemStack itemStack, World world, EntityPlayer player, EnumHand hand) // TODO Remove
  25.     {
  26.         if(!world.isRemote)
  27.         {
  28.             Vec3d vector = player.getLookVec();
  29.             EntityFirebolt projectile = new EntityFirebolt(world, player, 1);
  30.             projectile.setLocation(player.posX, player.posY + player.getEyeHeight(), player.posZ);
  31.             world.spawnEntityInWorld(projectile);
  32.         }
  33.         return new ActionResult(EnumActionResult.SUCCESS, itemStack);
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment