Fixed Quick Feet, Elytra, and the jumping one (lol) on servers

This commit is contained in:
WayofTime 2016-08-07 20:53:00 -04:00
parent 7516f9c5d3
commit eceb041fab
2 changed files with 26 additions and 7 deletions

View file

@ -275,18 +275,22 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IMeshP
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && Keyboard.isKeyDown(Keyboard.KEY_M)) if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && Keyboard.isKeyDown(Keyboard.KEY_M))
{ {
StatTracker tracker = null; StatTracker tracker = null;
for (StatTracker searchTracker : armour.trackerMap.values()) { for (StatTracker searchTracker : armour.trackerMap.values())
if (searchTracker != null && searchTracker.providesUpgrade(upgrade.getUniqueIdentifier())) { {
if (searchTracker != null && searchTracker.providesUpgrade(upgrade.getUniqueIdentifier()))
{
tracker = searchTracker; tracker = searchTracker;
break; break;
} }
} }
if (tracker != null) { if (tracker != null)
{
double progress = tracker.getProgress(armour, upgrade.getUpgradeLevel()); 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))); tooltip.add(TextHelper.localize("tooltip.BloodMagic.livingArmour.upgrade.progress", TextHelper.localize(upgrade.getUnlocalizedName()), MathHelper.clamp_int((int) (progress * 100D), 0, 100)));
} }
} else { } else
{
tooltip.add(TextHelper.localize("tooltip.BloodMagic.livingArmour.upgrade.level", TextHelper.localize(upgrade.getUnlocalizedName()), upgrade.getUpgradeLevel() + 1)); tooltip.add(TextHelper.localize("tooltip.BloodMagic.livingArmour.upgrade.level", TextHelper.localize(upgrade.getUnlocalizedName()), upgrade.getUpgradeLevel() + 1));
} }
} }
@ -328,7 +332,7 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IMeshP
if (LivingArmour.hasFullSet(player)) if (LivingArmour.hasFullSet(player))
{ {
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST); ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(Constants.Mod.MODID + ".upgrade.elytra", chestStack); LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgradeFromNBT(Constants.Mod.MODID + ".upgrade.elytra", chestStack);
if (upgrade instanceof LivingArmourUpgradeElytra) if (upgrade instanceof LivingArmourUpgradeElytra)
{ {
if (spPlayer.motionY > -0.5D) if (spPlayer.motionY > -0.5D)
@ -507,6 +511,21 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IMeshP
return null; return null;
} }
public static LivingArmourUpgrade getUpgradeFromNBT(String uniqueIdentifier, ItemStack stack)
{
LivingArmour armour = getLivingArmourFromStack(stack);
for (Entry<String, LivingArmourUpgrade> entry : armour.upgradeMap.entrySet())
{
if (entry.getKey().equals(uniqueIdentifier))
{
return entry.getValue();
}
}
return null;
}
public static boolean hasLivingArmour(ItemStack stack) public static boolean hasLivingArmour(ItemStack stack)
{ {
UUID uuid = Utils.getUUID(stack); UUID uuid = Utils.getUUID(stack);

View file

@ -109,7 +109,7 @@ public class LivingArmourHandler
if (!player.isSneaking()) if (!player.isSneaking())
{ {
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(Constants.Mod.MODID + ".upgrade.jump", chestStack); LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgradeFromNBT(Constants.Mod.MODID + ".upgrade.jump", chestStack);
if (upgrade instanceof LivingArmourUpgradeJump) if (upgrade instanceof LivingArmourUpgradeJump)
{ {
@ -163,7 +163,7 @@ public class LivingArmourHandler
LivingArmour armour = ItemLivingArmour.getLivingArmourFromStack(chestStack); LivingArmour armour = ItemLivingArmour.getLivingArmourFromStack(chestStack);
if (armour != null) if (armour != null)
{ {
LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgrade(Constants.Mod.MODID + ".upgrade.movement", chestStack); LivingArmourUpgrade upgrade = ItemLivingArmour.getUpgradeFromNBT(Constants.Mod.MODID + ".upgrade.movement", chestStack);
if (upgrade instanceof LivingArmourUpgradeSpeed) if (upgrade instanceof LivingArmourUpgradeSpeed)
{ {