Make sure sacrifice packs don't store more than capacity

This commit is contained in:
Nick 2016-01-22 02:21:10 -08:00
parent 3920e0926f
commit a769e9d0a7
2 changed files with 12 additions and 2 deletions

View file

@ -69,6 +69,13 @@ public class ItemPackSacrifice extends ItemArmor implements IAltarManipulator
return stack;
}
@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack stack)
{
if (getStoredLP(stack) > CAPACITY)
setStoredLP(stack, CAPACITY);
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
{
@ -93,7 +100,7 @@ public class ItemPackSacrifice extends ItemArmor implements IAltarManipulator
if (toAdd > CAPACITY)
toAdd = CAPACITY;
setStoredLP(stack, getStoredLP(stack) + toAdd);
setStoredLP(stack, Math.min(getStoredLP(stack) + toAdd, CAPACITY));
}
public void setStoredLP(ItemStack stack, int lp)