Fixed a minor issue

This commit is contained in:
Aidan C. Brady 2014-07-21 22:24:27 -04:00
parent 25cf5236ea
commit 99482d8fd0
2 changed files with 8 additions and 3 deletions

View file

@ -195,7 +195,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
for(Map.Entry<Upgrade, Integer> entry : upgrades.entrySet())
{
list.add(entry.getKey().getColor() + "- " + entry.getKey().getName() + (entry.getKey().canMultiply() ? ": " + EnumColor.GREY + entry.getValue(): ""));
list.add(entry.getKey().getColor() + "- " + entry.getKey().getName() + (entry.getKey().canMultiply() ? ": " + EnumColor.GREY + "x" + entry.getValue(): ""));
}
}
}

View file

@ -96,12 +96,17 @@ public class TileComponentUpgrade implements ITileComponent
public int getUpgrades(Upgrade upgrade)
{
if(upgrades.get(upgrade) == null)
{
return 0;
}
return upgrades.get(upgrade);
}
public void addUpgrade(Upgrade upgrade)
{
upgrades.put(upgrade, Math.min(upgrade.getMax(), upgrades.get(upgrade)+1));
upgrades.put(upgrade, Math.min(upgrade.getMax(), getUpgrades(upgrade)+1));
}
public void setUpgrades(Upgrade upgrade, int amount)
@ -116,7 +121,7 @@ public class TileComponentUpgrade implements ITileComponent
public void removeUpgrade(Upgrade upgrade)
{
upgrades.put(upgrade, Math.max(0, upgrades.get(upgrade)-1));
upgrades.put(upgrade, Math.max(0, getUpgrades(upgrade)-1));
if(upgrades.get(upgrade) == 0)
{