Fixed a minor issue
This commit is contained in:
parent
25cf5236ea
commit
99482d8fd0
2 changed files with 8 additions and 3 deletions
|
@ -195,7 +195,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||||
|
|
||||||
for(Map.Entry<Upgrade, Integer> entry : upgrades.entrySet())
|
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(): ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,12 +96,17 @@ public class TileComponentUpgrade implements ITileComponent
|
||||||
|
|
||||||
public int getUpgrades(Upgrade upgrade)
|
public int getUpgrades(Upgrade upgrade)
|
||||||
{
|
{
|
||||||
|
if(upgrades.get(upgrade) == null)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return upgrades.get(upgrade);
|
return upgrades.get(upgrade);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addUpgrade(Upgrade 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)
|
public void setUpgrades(Upgrade upgrade, int amount)
|
||||||
|
@ -116,7 +121,7 @@ public class TileComponentUpgrade implements ITileComponent
|
||||||
|
|
||||||
public void removeUpgrade(Upgrade upgrade)
|
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)
|
if(upgrades.get(upgrade) == 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue