Advertisement
Guest User

Untitled

a guest
Aug 21st, 2016
514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.49 KB | None | 0 0
  1. package melonslise.runicinscription.common.item;
  2.  
  3. import melonslise.runicinscription.RunicInscription;
  4. import melonslise.runicinscription.common.entity.player.PropertiesMana;
  5. import net.minecraft.entity.player.EntityPlayer;
  6. import net.minecraft.item.Item;
  7. import net.minecraft.item.ItemStack;
  8. import net.minecraft.world.World;
  9.  
  10. public class ItemScrollHeal extends Item
  11. {
  12.     @Override
  13.     public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player)
  14.     {
  15.         if (!world.isRemote)
  16.         {
  17.             PropertiesMana properties = PropertiesMana.get(player);
  18.            
  19.             if (properties.consumeMana(15) == true)
  20.             {
  21.                 player.heal(5);
  22.                
  23.                 world.playSoundAtEntity(player, RunicInscription.ID + ":BlessingCast", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
  24.                
  25.                 for (int a = 0; a < 10; ++a)
  26.                 {
  27.                     player.worldObj.spawnParticle("happyVillager", player.posX + 1.0D, player.posY - 1.0D + a * 0.2, player.posZ, 0.0D, 0.7D, 0.0D);
  28.    
  29.                     player.worldObj.spawnParticle("happyVillager", player.posX - 1.0D, player.posY - 1.0D + a * 0.2, player.posZ, 0.0D, 0.7D, 0.0D);
  30.    
  31.                     player.worldObj.spawnParticle("happyVillager", player.posX, player.posY - 1.0D + a * 0.2, player.posZ + 1.0D, 0.0D, 0.7D, 0.0D);
  32.  
  33.                     player.worldObj.spawnParticle("happyVillager", player.posX, player.posY - 1.0D + a * 0.2, player.posZ - 1.0D, 0.0D, 0.7D, 0.0D);
  34.                 }
  35.                
  36.                 if (!player.capabilities.isCreativeMode)
  37.                 {
  38.                     --itemStack.stackSize;
  39.                 }
  40.             }
  41.         }
  42.  
  43.         return itemStack;
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement