Fixed #774, a bug that caused the Tome of Peritia to be wonky again.

This commit is contained in:
WayofTime 2016-06-13 14:40:27 -04:00
parent f8859dbf56
commit da060639e9
3 changed files with 13 additions and 6 deletions

View file

@ -2,6 +2,8 @@
Version 2.0.2-44 Version 2.0.2-44
------------------------------------------------------ ------------------------------------------------------
- Added the Draft of Angelus, which increases the max number of upgrade points for Living Armour. It's strawberry flavoured! - Added the Draft of Angelus, which increases the max number of upgrade points for Living Armour. It's strawberry flavoured!
- Fixed the Tome of Peritia again - <= and < are the same, right?
- Fixed an interaction between the Tome of Peritia and the Experienced upgrade
------------------------------------------------------ ------------------------------------------------------
Version 2.0.1-43 Version 2.0.1-43

View file

@ -83,6 +83,8 @@ public class ItemExperienceBook extends Item implements IVariantProvider
int neededExp = (int) Math.ceil((1 - progress) * expToNext); int neededExp = (int) Math.ceil((1 - progress) * expToNext);
float containedExp = (float) getStoredExperience(stack); float containedExp = (float) getStoredExperience(stack);
System.out.println("Needed: " + neededExp + ", contained: " + containedExp + ", exp to next: " + expToNext);
if (containedExp >= neededExp) if (containedExp >= neededExp)
{ {
setStoredExperience(stack, containedExp - neededExp); setStoredExperience(stack, containedExp - neededExp);
@ -160,10 +162,10 @@ public class ItemExperienceBook extends Item implements IVariantProvider
public static int getExperienceForNextLevel(int currentLevel) public static int getExperienceForNextLevel(int currentLevel)
{ {
if (currentLevel <= 16) if (currentLevel < 16)
{ {
return 2 * currentLevel + 7; return 2 * currentLevel + 7;
} else if (currentLevel <= 31) } else if (currentLevel < 31)
{ {
return 5 * currentLevel - 38; return 5 * currentLevel - 38;
} else } else

View file

@ -28,7 +28,8 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@Handler @Handler
public class StatTrackerHandler { public class StatTrackerHandler
{
private static float lastPlayerSwingStrength = 0; private static float lastPlayerSwingStrength = 0;
@ -91,7 +92,8 @@ public class StatTrackerHandler {
// Tracks: Fall Protect, Arrow Protect, Physical Protect, Grave Digger, Sprint Attack, Critical Strike, // Tracks: Fall Protect, Arrow Protect, Physical Protect, Grave Digger, Sprint Attack, Critical Strike,
@SubscribeEvent @SubscribeEvent
public void entityHurt(LivingHurtEvent event) { public void entityHurt(LivingHurtEvent event)
{
DamageSource source = event.getSource(); DamageSource source = event.getSource();
Entity sourceEntity = event.getSource().getEntity(); Entity sourceEntity = event.getSource().getEntity();
EntityLivingBase attackedEntity = event.getEntityLiving(); EntityLivingBase attackedEntity = event.getEntityLiving();
@ -137,7 +139,8 @@ public class StatTrackerHandler {
{ {
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
LivingArmour armour = ItemLivingArmour.armourMap.get(chestStack); LivingArmour armour = ItemLivingArmour.armourMap.get(chestStack);
if (armour != null) { if (armour != null)
{
ItemStack mainWeapon = player.getItemStackFromSlot(EntityEquipmentSlot.MAINHAND); ItemStack mainWeapon = player.getItemStackFromSlot(EntityEquipmentSlot.MAINHAND);
event.setAmount((float) (event.getAmount() + lastPlayerSwingStrength * armour.getAdditionalDamageOnHit(event.getAmount(), player, attackedEntity, mainWeapon))); event.setAmount((float) (event.getAmount() + lastPlayerSwingStrength * armour.getAdditionalDamageOnHit(event.getAmount(), player, attackedEntity, mainWeapon)));
@ -168,7 +171,7 @@ public class StatTrackerHandler {
} }
// Tracks: Experienced // Tracks: Experienced
@SubscribeEvent(priority = EventPriority.LOWEST) @SubscribeEvent(priority = EventPriority.LOW)
public void onExperiencePickup(PlayerPickupXpEvent event) public void onExperiencePickup(PlayerPickupXpEvent event)
{ {
EntityPlayer player = event.getEntityPlayer(); EntityPlayer player = event.getEntityPlayer();