Advertisement
Guest User

Untitled

a guest
Aug 4th, 2017
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. package com.triphion.ancient.items;
  2.  
  3. import com.triphion.ancient.Reference;
  4. import com.triphion.ancient.init.ModItems;
  5.  
  6. import net.minecraft.block.Block;
  7. import net.minecraft.entity.player.EntityPlayer;
  8. import net.minecraft.entity.projectile.EntityDragonFireball;
  9. import net.minecraft.entity.projectile.EntityLargeFireball;
  10. import net.minecraft.entity.projectile.EntitySmallFireball;
  11. import net.minecraft.item.Item;
  12. import net.minecraft.item.ItemStack;
  13. import net.minecraft.item.ItemTool;
  14. import net.minecraft.util.ActionResult;
  15. import net.minecraft.util.EnumActionResult;
  16. import net.minecraft.util.EnumHand;
  17. import net.minecraft.util.ResourceLocation;
  18. import net.minecraft.util.math.RayTraceResult;
  19. import net.minecraft.util.math.Vec3d;
  20. import net.minecraft.world.World;
  21.  
  22. public class ItemDragonsWrath extends Item {
  23. public ItemDragonsWrath(String unlocalizedName) {
  24. this.setUnlocalizedName(unlocalizedName);
  25. this.setRegistryName(new ResourceLocation(Reference.MODID, unlocalizedName));
  26. this.setMaxStackSize(1);
  27. this.setMaxDamage(64);
  28. }
  29.  
  30. @Override
  31. public ActionResult<ItemStack> onItemRightClick(Itemstack Stack, World worldIn, EntityPlayer playerIn, EnumHand handIn) {
  32. if(!worldIn.isRemote){
  33. Vec3d look = playerIn.getLookVec();
  34. EntityDragonFireball fireBall = new EntityDragonFireball(worldIn, playerIn, 0, 0, 0);
  35. fireBall.setSprinting(true);
  36. fireBall.setPosition(playerIn.posX + look.xCoord * 1.3, playerIn.posY + look.yCoord + (playerIn.getEyeHeight() / 1), playerIn.posZ + look.zCoord * 1.3);
  37. fireBall.accelerationX = look.xCoord * 0.1;
  38. fireBall.accelerationY = look.yCoord * 0.1;
  39. fireBall.accelerationZ = look.zCoord * 0.1;
  40. worldIn.spawnEntity(fireBall); }
  41. else{
  42. return new ActionResult(EnumActionResult.FAIL, new ItemStack(this));
  43. }
  44. Stack.damageItem(1, playerIn);
  45. return new ActionResult(EnumActionResult.SUCCESS, new ItemStack(this));
  46. }
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement