From 99482d8fd017180a1cf8fc19e71da34c81780f8f Mon Sep 17 00:00:00 2001 From: "Aidan C. Brady" Date: Mon, 21 Jul 2014 22:24:27 -0400 Subject: [PATCH] Fixed a minor issue --- src/main/java/mekanism/common/item/ItemBlockMachine.java | 2 +- .../common/tile/component/TileComponentUpgrade.java | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/mekanism/common/item/ItemBlockMachine.java b/src/main/java/mekanism/common/item/ItemBlockMachine.java index ab4867291..6f9da9f79 100644 --- a/src/main/java/mekanism/common/item/ItemBlockMachine.java +++ b/src/main/java/mekanism/common/item/ItemBlockMachine.java @@ -195,7 +195,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec for(Map.Entry 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(): "")); } } } diff --git a/src/main/java/mekanism/common/tile/component/TileComponentUpgrade.java b/src/main/java/mekanism/common/tile/component/TileComponentUpgrade.java index 198bdcb4a..2a1818f80 100644 --- a/src/main/java/mekanism/common/tile/component/TileComponentUpgrade.java +++ b/src/main/java/mekanism/common/tile/component/TileComponentUpgrade.java @@ -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) {