Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.techmage.magetech;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.item.ItemStack;
- public class HandlerSouls
- {
- public static boolean hasEnoughSouls(EntityPlayer player, int amount)
- {
- if (findNextUrnWithStoredSouls(player, amount) != null)
- return true;
- return false;
- }
- public static void useSouls(EntityPlayer player, int amount)
- {
- findNextUrnWithStoredSouls(player, amount).useSouls(amount);
- }
- private static ItemUrn findNextUrnWithStoredSouls(EntityPlayer player, int amount)
- {
- for (int index = 0; index < player.inventory.getSizeInventory(); index ++)
- {
- ItemStack stack = player.inventory.getStackInSlot(index);
- if (stack != null)
- {
- if(stack.getItem() == ModItems.urn)
- {
- if (((ItemUrn) stack.getItem()).getStoredSouls >= amount)
- return (ItemUrn) stack.getItem();
- }
- }
- }
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement