Changed it so that the Mending enchantment consumes the EXP before the Tome of Peritia does
This commit is contained in:
parent
172cf86348
commit
aba4332699
|
@ -4,6 +4,7 @@ Version 2.0.0-35
|
||||||
- Changed Living Armour so that it is now damagable. The Living Armour Chestplate will be damaged, but will not break. If it gets to ~0 durability, it will damage your LP network heavily.
|
- Changed Living Armour so that it is now damagable. The Living Armour Chestplate will be damaged, but will not break. If it gets to ~0 durability, it will damage your LP network heavily.
|
||||||
- Living Armour is now repairable in an anvil with Binding Reagent.
|
- Living Armour is now repairable in an anvil with Binding Reagent.
|
||||||
- Started adding in the Alchemy Table... not really started.
|
- Started adding in the Alchemy Table... not really started.
|
||||||
|
- Changed it so that the Mending enchantment consumes the EXP before the Tome of Peritia does
|
||||||
|
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
Version 2.0.0-34
|
Version 2.0.0-34
|
||||||
|
|
|
@ -33,6 +33,13 @@ public class ItemExperienceBook extends Item implements IVariantProvider
|
||||||
setCreativeTab(BloodMagic.tabBloodMagic);
|
setCreativeTab(BloodMagic.tabBloodMagic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public boolean hasEffect(ItemStack stack)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced)
|
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced)
|
||||||
|
|
|
@ -841,7 +841,7 @@ public class EventHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||||
public void onExperiencePickup(PlayerPickupXpEvent event)
|
public void onExperiencePickup(PlayerPickupXpEvent event)
|
||||||
{
|
{
|
||||||
EntityPlayer player = event.getEntityPlayer();
|
EntityPlayer player = event.getEntityPlayer();
|
||||||
|
@ -866,6 +866,15 @@ public class EventHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ItemStack itemstack = EnchantmentHelper.getEnchantedItem(Enchantments.MENDING, player);
|
||||||
|
|
||||||
|
if (itemstack != null && itemstack.isItemDamaged())
|
||||||
|
{
|
||||||
|
int i = Math.min(xpToDurability(event.getOrb().xpValue), itemstack.getItemDamage());
|
||||||
|
event.getOrb().xpValue -= durabilityToXp(i);
|
||||||
|
itemstack.setItemDamage(itemstack.getItemDamage() - i);
|
||||||
|
}
|
||||||
|
|
||||||
if (!player.worldObj.isRemote)
|
if (!player.worldObj.isRemote)
|
||||||
{
|
{
|
||||||
for (ItemStack stack : player.inventory.mainInventory)
|
for (ItemStack stack : player.inventory.mainInventory)
|
||||||
|
@ -879,4 +888,14 @@ public class EventHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int xpToDurability(int xp)
|
||||||
|
{
|
||||||
|
return xp * 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int durabilityToXp(int durability)
|
||||||
|
{
|
||||||
|
return durability / 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue