Added sentient armour gem recipe. Added ability for Tartaric gems to fill other gems.

This commit is contained in:
WayofTime 2016-01-26 07:56:17 -05:00
parent e2a007d932
commit 1242fefc30
8 changed files with 67 additions and 6 deletions

View file

@ -140,4 +140,32 @@ public class PlayerDemonWillHandler
return amount - remaining;
}
public static double addDemonWill(EntityPlayer player, double amount, ItemStack ignored)
{
ItemStack[] inventory = player.inventory.mainInventory;
double remaining = amount;
for (int i = 0; i < inventory.length; i++)
{
ItemStack stack = inventory[i];
if (stack != null && !stack.equals(ignored))
{
if (stack.getItem() instanceof IDemonWillGem)
{
double souls = ((IDemonWillGem) stack.getItem()).getWill(stack);
double fill = Math.min(((IDemonWillGem) stack.getItem()).getMaxWill(stack) - souls, remaining);
((IDemonWillGem) stack.getItem()).setWill(stack, fill + souls);
remaining -= fill;
if (remaining <= 0)
{
break;
}
}
}
}
return amount - remaining;
}
}