From 4f1308874d1507cfa1e47d56d2f0abcc92f4b701 Mon Sep 17 00:00:00 2001 From: Tobias Date: Thu, 5 Sep 2019 03:51:25 +0200 Subject: [PATCH] Fixes BloodAltar being able to obtain negative progress. (#1649) * Fixes BloodAltar being able to obtain negative progress. * Updated to use Math.max() --- src/main/java/WayofTime/bloodmagic/altar/BloodAltar.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/WayofTime/bloodmagic/altar/BloodAltar.java b/src/main/java/WayofTime/bloodmagic/altar/BloodAltar.java index 7a111dd0..66b1d2f2 100644 --- a/src/main/java/WayofTime/bloodmagic/altar/BloodAltar.java +++ b/src/main/java/WayofTime/bloodmagic/altar/BloodAltar.java @@ -3,16 +3,16 @@ package WayofTime.bloodmagic.altar; import WayofTime.bloodmagic.api.event.BloodMagicCraftedEvent; import WayofTime.bloodmagic.api.impl.BloodMagicAPI; import WayofTime.bloodmagic.api.impl.recipe.RecipeBloodAltar; +import WayofTime.bloodmagic.block.BlockLifeEssence; import WayofTime.bloodmagic.block.enums.BloodRuneType; import WayofTime.bloodmagic.core.data.Binding; import WayofTime.bloodmagic.core.data.SoulTicket; import WayofTime.bloodmagic.iface.IBindable; -import WayofTime.bloodmagic.util.Constants; import WayofTime.bloodmagic.orb.BloodOrb; import WayofTime.bloodmagic.orb.IBloodOrb; -import WayofTime.bloodmagic.util.helper.NetworkHelper; -import WayofTime.bloodmagic.block.BlockLifeEssence; import WayofTime.bloodmagic.tile.TileAltar; +import WayofTime.bloodmagic.util.Constants; +import WayofTime.bloodmagic.util.helper.NetworkHelper; import com.google.common.base.Enums; import net.minecraft.block.state.IBlockState; import net.minecraft.item.ItemStack; @@ -297,7 +297,7 @@ public class BloodAltar implements IFluidHandler { } } else if (!hasOperated && progress > 0) { - progress -= (int) (efficiencyMultiplier * drainRate); + progress = Math.max(0, progress - (int) (efficiencyMultiplier * drainRate)); if (internalCounter % 2 == 0 && world instanceof WorldServer) { WorldServer server = (WorldServer) world;