use of WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeExperience in project BloodMagic by WayofTime.
the class StatTrackerHandler method onExperiencePickup.
// Tracks: Experienced
@SubscribeEvent(priority = EventPriority.LOW)
public static void onExperiencePickup(PlayerPickupXpEvent event) {
EntityPlayer player = event.getEntityPlayer();
if (LivingArmour.hasFullSet(player)) {
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
if (armour != null) {
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(BloodMagic.MODID + ".upgrade.experienced", chestStack);
if (upgrade instanceof LivingArmourUpgradeExperience) {
double modifier = ((LivingArmourUpgradeExperience) upgrade).getExperienceModifier();
double exp = event.getOrb().xpValue * (1 + modifier);
event.getOrb().xpValue = (int) Math.floor(exp) + (Math.random() < exp % 1 ? 1 : 0);
}
StatTrackerExperience.incrementCounter(armour, event.getOrb().xpValue);
}
}
}
Aggregations