Added a way to view the progress towards the next upgrade level

Override `getProgress()` and return a value between 0.0 (0%) and 1.0 (100%)
This commit is contained in:
Nicholas Ignoffo 2016-07-29 21:10:22 -07:00
parent 3ad0969644
commit 7516f9c5d3
24 changed files with 187 additions and 1 deletions

View file

@ -41,6 +41,20 @@ public abstract class StatTracker
public abstract List<LivingArmourUpgrade> getUpgrades(); public abstract List<LivingArmourUpgrade> getUpgrades();
/**
* Used to obtain the progress from the current level to the next level.
*
* 0.0 being 0% - 1.0 being 100%.
*
* @param livingArmour
* The equipped LivingArmour
* @return the progress from the current level to the next level.
*/
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return 1.0D;
}
public final boolean isDirty() public final boolean isDirty()
{ {
return isDirty; return isDirty;

View file

@ -8,6 +8,7 @@ import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.UUID; import java.util.UUID;
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.renderer.ItemMeshDefinition; import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.model.ModelResourceLocation;
@ -22,6 +23,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.datasync.DataParameter; import net.minecraft.network.datasync.DataParameter;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.ISpecialArmor; import net.minecraftforge.common.ISpecialArmor;
import net.minecraftforge.fml.relauncher.ReflectionHelper; import net.minecraftforge.fml.relauncher.ReflectionHelper;
@ -45,6 +47,7 @@ import WayofTime.bloodmagic.util.helper.TextHelper;
import com.google.common.collect.HashMultimap; import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import org.lwjgl.input.Keyboard;
public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IMeshProvider public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IMeshProvider
{ {
@ -269,7 +272,23 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IMeshP
LivingArmourUpgrade upgrade = entry.getValue(); LivingArmourUpgrade upgrade = entry.getValue();
if (upgrade != null) if (upgrade != null)
{ {
tooltip.add(TextHelper.localize("tooltip.BloodMagic.livingArmour.upgrade.level", TextHelper.localize(upgrade.getUnlocalizedName()), (upgrade.getUpgradeLevel() + 1))); if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && Keyboard.isKeyDown(Keyboard.KEY_M))
{
StatTracker tracker = null;
for (StatTracker searchTracker : armour.trackerMap.values()) {
if (searchTracker != null && searchTracker.providesUpgrade(upgrade.getUniqueIdentifier())) {
tracker = searchTracker;
break;
}
}
if (tracker != null) {
double progress = tracker.getProgress(armour, upgrade.getUpgradeLevel());
tooltip.add(TextHelper.localize("tooltip.BloodMagic.livingArmour.upgrade.progress", TextHelper.localize(upgrade.getUnlocalizedName()), MathHelper.clamp_int((int) (progress * 100D), 0, 100)));
}
} else {
tooltip.add(TextHelper.localize("tooltip.BloodMagic.livingArmour.upgrade.level", TextHelper.localize(upgrade.getUnlocalizedName()), upgrade.getUpgradeLevel() + 1));
}
} }
} }

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -95,6 +96,12 @@ public class StatTrackerArrowProtect extends StatTracker
return upgradeList; return upgradeList;
} }
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalDamage, damageRequired, currentLevel);
}
@Override @Override
public boolean providesUpgrade(String key) public boolean providesUpgrade(String key)
{ {

View file

@ -5,6 +5,7 @@ import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import WayofTime.bloodmagic.api.livingArmour.StatTracker; import WayofTime.bloodmagic.api.livingArmour.StatTracker;
import WayofTime.bloodmagic.livingArmour.LivingArmour; import WayofTime.bloodmagic.livingArmour.LivingArmour;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeArrowShot; import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeArrowShot;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -95,6 +96,12 @@ public class StatTrackerArrowShot extends StatTracker
return upgradeList; return upgradeList;
} }
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalShots, shotsRequired, currentLevel);
}
@Override @Override
public boolean providesUpgrade(String key) public boolean providesUpgrade(String key)
{ {

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -95,6 +96,12 @@ public class StatTrackerCriticalStrike extends StatTracker
return upgradeList; return upgradeList;
} }
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalDamageDealt, damageRequired, currentLevel);
}
@Override @Override
public boolean providesUpgrade(String key) public boolean providesUpgrade(String key)
{ {

View file

@ -5,6 +5,7 @@ import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import WayofTime.bloodmagic.api.livingArmour.StatTracker; import WayofTime.bloodmagic.api.livingArmour.StatTracker;
import WayofTime.bloodmagic.livingArmour.LivingArmour; import WayofTime.bloodmagic.livingArmour.LivingArmour;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeDigging; import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeDigging;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -95,6 +96,12 @@ public class StatTrackerDigging extends StatTracker
return upgradeList; return upgradeList;
} }
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalBlocksDug, blocksRequired, currentLevel);
}
@Override @Override
public boolean providesUpgrade(String key) public boolean providesUpgrade(String key)
{ {

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -95,6 +96,12 @@ public class StatTrackerExperience extends StatTracker
return upgradeList; return upgradeList;
} }
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalExperienceGained, experienceRequired, currentLevel);
}
@Override @Override
public boolean providesUpgrade(String key) public boolean providesUpgrade(String key)
{ {

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -95,6 +96,12 @@ public class StatTrackerFallProtect extends StatTracker
return upgradeList; return upgradeList;
} }
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalDamage, damageRequired, currentLevel);
}
@Override @Override
public boolean providesUpgrade(String key) public boolean providesUpgrade(String key)
{ {

View file

@ -3,6 +3,7 @@ package WayofTime.bloodmagic.livingArmour.tracker;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -77,6 +78,12 @@ public class StatTrackerFireResist extends StatTracker
return upgradeList; return upgradeList;
} }
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalFireTicks, fireTicksRequired, currentLevel);
}
@Override @Override
public boolean providesUpgrade(String key) public boolean providesUpgrade(String key)
{ {

View file

@ -5,6 +5,7 @@ import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import WayofTime.bloodmagic.api.livingArmour.StatTracker; import WayofTime.bloodmagic.api.livingArmour.StatTracker;
import WayofTime.bloodmagic.livingArmour.LivingArmour; import WayofTime.bloodmagic.livingArmour.LivingArmour;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeKnockbackResist; import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeKnockbackResist;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -97,6 +98,12 @@ public class StatTrackerFood extends StatTracker
return upgradeList; return upgradeList;
} }
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(foodEaten, foodRequired, currentLevel);
}
@Override @Override
public boolean providesUpgrade(String key) public boolean providesUpgrade(String key)
{ {

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -95,6 +96,12 @@ public class StatTrackerGraveDigger extends StatTracker
return upgradeList; return upgradeList;
} }
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalDamageDealt, damageRequired, currentLevel);
}
@Override @Override
public boolean providesUpgrade(String key) public boolean providesUpgrade(String key)
{ {

View file

@ -5,6 +5,7 @@ import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import WayofTime.bloodmagic.api.livingArmour.StatTracker; import WayofTime.bloodmagic.api.livingArmour.StatTracker;
import WayofTime.bloodmagic.livingArmour.LivingArmour; import WayofTime.bloodmagic.livingArmour.LivingArmour;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeGrimReaperSprint; import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeGrimReaperSprint;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -102,6 +103,12 @@ public class StatTrackerGrimReaperSprint extends StatTracker
return upgradeList; return upgradeList;
} }
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalDeaths, deathsRequired, currentLevel);
}
@Override @Override
public boolean providesUpgrade(String key) public boolean providesUpgrade(String key)
{ {

View file

@ -5,6 +5,7 @@ import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import WayofTime.bloodmagic.api.livingArmour.StatTracker; import WayofTime.bloodmagic.api.livingArmour.StatTracker;
import WayofTime.bloodmagic.livingArmour.LivingArmour; import WayofTime.bloodmagic.livingArmour.LivingArmour;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeHealthboost; import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeHealthboost;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -95,6 +96,12 @@ public class StatTrackerHealthboost extends StatTracker
return upgradeList; return upgradeList;
} }
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalHealthGenned, healthedRequired, currentLevel);
}
@Override @Override
public boolean providesUpgrade(String key) public boolean providesUpgrade(String key)
{ {

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -96,6 +97,12 @@ public class StatTrackerJump extends StatTracker
return upgradeList; return upgradeList;
} }
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalJumps, jumpsRequired, currentLevel);
}
@Override @Override
public boolean providesUpgrade(String key) public boolean providesUpgrade(String key)
{ {

View file

@ -5,6 +5,7 @@ import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import WayofTime.bloodmagic.api.livingArmour.StatTracker; import WayofTime.bloodmagic.api.livingArmour.StatTracker;
import WayofTime.bloodmagic.livingArmour.LivingArmour; import WayofTime.bloodmagic.livingArmour.LivingArmour;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeMeleeDamage; import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeMeleeDamage;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -95,6 +96,12 @@ public class StatTrackerMeleeDamage extends StatTracker
return upgradeList; return upgradeList;
} }
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalDamageDealt, damageRequired, currentLevel);
}
@Override @Override
public boolean providesUpgrade(String key) public boolean providesUpgrade(String key)
{ {

View file

@ -5,6 +5,7 @@ import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import WayofTime.bloodmagic.api.livingArmour.StatTracker; import WayofTime.bloodmagic.api.livingArmour.StatTracker;
import WayofTime.bloodmagic.livingArmour.LivingArmour; import WayofTime.bloodmagic.livingArmour.LivingArmour;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeSpeed; import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeSpeed;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -105,6 +106,12 @@ public class StatTrackerMovement extends StatTracker
return upgradeList; return upgradeList;
} }
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalMovement, blocksRequired, currentLevel);
}
@Override @Override
public boolean providesUpgrade(String key) public boolean providesUpgrade(String key)
{ {

View file

@ -5,6 +5,7 @@ import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import WayofTime.bloodmagic.api.livingArmour.StatTracker; import WayofTime.bloodmagic.api.livingArmour.StatTracker;
import WayofTime.bloodmagic.livingArmour.LivingArmour; import WayofTime.bloodmagic.livingArmour.LivingArmour;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradePhysicalProtect; import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradePhysicalProtect;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -95,6 +96,12 @@ public class StatTrackerPhysicalProtect extends StatTracker
return upgradeList; return upgradeList;
} }
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalDamage, damageRequired, currentLevel);
}
@Override @Override
public boolean providesUpgrade(String key) public boolean providesUpgrade(String key)
{ {

View file

@ -3,6 +3,7 @@ package WayofTime.bloodmagic.livingArmour.tracker;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects; import net.minecraft.init.MobEffects;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@ -78,6 +79,12 @@ public class StatTrackerPoison extends StatTracker
return upgradeList; return upgradeList;
} }
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalPoisonTicks, poisonTicksRequired, currentLevel);
}
@Override @Override
public boolean providesUpgrade(String key) public boolean providesUpgrade(String key)
{ {

View file

@ -5,6 +5,7 @@ import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import WayofTime.bloodmagic.api.livingArmour.StatTracker; import WayofTime.bloodmagic.api.livingArmour.StatTracker;
import WayofTime.bloodmagic.livingArmour.LivingArmour; import WayofTime.bloodmagic.livingArmour.LivingArmour;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeSelfSacrifice; import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeSelfSacrifice;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -96,6 +97,12 @@ public class StatTrackerSelfSacrifice extends StatTracker
return upgradeList; return upgradeList;
} }
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalSacrifices, sacrificesRequired, currentLevel);
}
@Override @Override
public boolean providesUpgrade(String key) public boolean providesUpgrade(String key)
{ {

View file

@ -5,6 +5,7 @@ import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import WayofTime.bloodmagic.api.livingArmour.StatTracker; import WayofTime.bloodmagic.api.livingArmour.StatTracker;
import WayofTime.bloodmagic.livingArmour.LivingArmour; import WayofTime.bloodmagic.livingArmour.LivingArmour;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeSolarPowered; import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeSolarPowered;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -95,6 +96,12 @@ public class StatTrackerSolarPowered extends StatTracker
return upgradeList; return upgradeList;
} }
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalHealthGenned, healthedRequired, currentLevel);
}
@Override @Override
public boolean providesUpgrade(String key) public boolean providesUpgrade(String key)
{ {

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -95,6 +96,12 @@ public class StatTrackerSprintAttack extends StatTracker
return upgradeList; return upgradeList;
} }
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalDamageDealt, damageRequired, currentLevel);
}
@Override @Override
public boolean providesUpgrade(String key) public boolean providesUpgrade(String key)
{ {

View file

@ -103,6 +103,15 @@ public class StatTrackerStepAssist extends StatTracker
return upgradeList; return upgradeList;
} }
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
if (currentLevel == 1)
return 1.0D;
return totalMovement / (double) blocksRequired;
}
@Override @Override
public boolean providesUpgrade(String key) public boolean providesUpgrade(String key)
{ {

View file

@ -199,6 +199,16 @@ public class Utils
return false; return false;
} }
public static double calculateStandardProgress(Number currentValue, int[] requiredValues, int currentLevel)
{
int nextLevel = currentLevel + 1;
if (nextLevel >= requiredValues.length)
return 1.0D;
int required = requiredValues[nextLevel];
return Double.parseDouble("" + currentValue) / (double) required;
}
@Nullable @Nullable
public static IItemHandler getInventory(TileEntity tile, @Nullable EnumFacing facing) public static IItemHandler getInventory(TileEntity tile, @Nullable EnumFacing facing)
{ {

View file

@ -378,6 +378,7 @@ tooltip.BloodMagic.livingArmour.upgrade.elytra=Elytra
tooltip.BloodMagic.livingArmour.upgrade.slowness=Limp Leg tooltip.BloodMagic.livingArmour.upgrade.slowness=Limp Leg
tooltip.BloodMagic.livingArmour.upgrade.crippledArm=Crippled Arm tooltip.BloodMagic.livingArmour.upgrade.crippledArm=Crippled Arm
tooltip.BloodMagic.livingArmour.upgrade.level=%s (Level %d) tooltip.BloodMagic.livingArmour.upgrade.level=%s (Level %d)
tooltip.BloodMagic.livingArmour.upgrade.progress=%s (%d/100)
tooltip.BloodMagic.livingArmour.upgrade.points=&6Upgrade points: %s / %s tooltip.BloodMagic.livingArmour.upgrade.points=&6Upgrade points: %s / %s
tooltip.BloodMagic.will=Will Quality: %1$,.2f tooltip.BloodMagic.will=Will Quality: %1$,.2f