Make sure the multiplier isn't ever negative.

This commit is contained in:
Lizbeth Rika committed 2015-01-28 21:48:34 +00:00
1 parent 07836b1f3e
commit 6d1f5ed626
1 file changed
+2 -2
@@ -207,7 +207,7 @@ public final class ManaItemHandler {
* @return The amount of mana received from the request.
*/
public static int requestManaForTool(ItemStack stack, EntityPlayer player, int manaToGet, boolean remove) {
float multiplier = 1F - getFullDiscountForTools(player);
float multiplier = Math.max(0F, 1F - getFullDiscountForTools(player));
int cost = (int) ((float) manaToGet * multiplier);
return (int) ((float) requestMana(stack, player, cost, remove) / multiplier);
}
@@ -221,7 +221,7 @@ public final class ManaItemHandler {
* @return If the request was succesful.
*/
public static boolean requestManaExactForTool(ItemStack stack, EntityPlayer player, int manaToGet, boolean remove) {
float multiplier = 1F - getFullDiscountForTools(player);
float multiplier = Math.max(0F, 1F - getFullDiscountForTools(player));
int cost = (int) ((float) manaToGet * multiplier);
return requestManaExact(stack, player, cost, remove);
}