From 59f5fe94077d127e5afd2c2d0dd7fa35e8b8001e Mon Sep 17 00:00:00 2001 From: Nicholas Ignoffo Date: Sun, 14 Apr 2019 08:48:47 -0700 Subject: [PATCH] Fix incompatibility with Unmending mod (#1566) --- .../bloodmagic/util/handler/event/GenericHandler.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/WayofTime/bloodmagic/util/handler/event/GenericHandler.java b/src/main/java/WayofTime/bloodmagic/util/handler/event/GenericHandler.java index bcd12000..d1431db8 100644 --- a/src/main/java/WayofTime/bloodmagic/util/handler/event/GenericHandler.java +++ b/src/main/java/WayofTime/bloodmagic/util/handler/event/GenericHandler.java @@ -78,6 +78,7 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerPickupXpEvent; import net.minecraftforge.event.world.ExplosionEvent; import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -433,10 +434,12 @@ public class GenericHandler { EntityPlayer player = event.getEntityPlayer(); ItemStack itemstack = EnchantmentHelper.getEnchantedItem(Enchantments.MENDING, player); - if (!itemstack.isEmpty() && itemstack.isItemDamaged()) { - int i = Math.min(xpToDurability(event.getOrb().xpValue), itemstack.getItemDamage()); - event.getOrb().xpValue -= durabilityToXp(i); - itemstack.setItemDamage(itemstack.getItemDamage() - i); + if (Loader.isModLoaded("unmending")) { + if (!itemstack.isEmpty() && itemstack.isItemDamaged()) { + int i = Math.min(xpToDurability(event.getOrb().xpValue), itemstack.getItemDamage()); + event.getOrb().xpValue -= durabilityToXp(i); + itemstack.setItemDamage(itemstack.getItemDamage() - i); + } } if (!player.getEntityWorld().isRemote) {