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
------------------------------------------------------
- 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

View file

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

View file

@ -28,7 +28,8 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@Handler
public class StatTrackerHandler {
public class StatTrackerHandler
{
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,
@SubscribeEvent
public void entityHurt(LivingHurtEvent event) {
public void entityHurt(LivingHurtEvent event)
{
DamageSource source = event.getSource();
Entity sourceEntity = event.getSource().getEntity();
EntityLivingBase attackedEntity = event.getEntityLiving();
@ -137,7 +139,8 @@ public class StatTrackerHandler {
{
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
LivingArmour armour = ItemLivingArmour.armourMap.get(chestStack);
if (armour != null) {
if (armour != null)
{
ItemStack mainWeapon = player.getItemStackFromSlot(EntityEquipmentSlot.MAINHAND);
event.setAmount((float) (event.getAmount() + lastPlayerSwingStrength * armour.getAdditionalDamageOnHit(event.getAmount(), player, attackedEntity, mainWeapon)));
@ -168,7 +171,7 @@ public class StatTrackerHandler {
}
// Tracks: Experienced
@SubscribeEvent(priority = EventPriority.LOWEST)
@SubscribeEvent(priority = EventPriority.LOW)
public void onExperiencePickup(PlayerPickupXpEvent event)
{
EntityPlayer player = event.getEntityPlayer();