mirror of
https://github.com/GTNewHorizons/WirelessCraftingTerminal.git
synced 2026-11-14 01:14:13 +00:00
Merge pull request #82 from Spongman/patch-1
fix NullPointerException during creative crafting search
This commit is contained in:
commit
afc48db7ce
1 file changed
+7
-3
@@ -109,6 +109,8 @@ public class ItemMagnet extends Item {
|
||||
list.add(color("aqua") + "==============================");
|
||||
String shift = LocaleHandler.PressShift.getLocal().replace("Shift", color("yellow") + color("bold") + color("italics") + "Shift" + color("gray"));
|
||||
if (isShiftKeyDown()) {
|
||||
ItemStack itemStack = getItemStack();
|
||||
|
||||
String info = LocaleHandler.MagnetDesc.getLocal();
|
||||
for (String line : Splitter.on("\n").split(WordUtils.wrap(info, 37, "\n", false))) {
|
||||
list.add(line.trim());
|
||||
@@ -117,7 +119,7 @@ public class ItemMagnet extends Item {
|
||||
list.add("");
|
||||
list.add(color("italics") + "" + LocaleHandler.MagnetDesc2.getLocal());
|
||||
|
||||
if (isActivated(getItemStack())) {
|
||||
if (isActivated(itemStack)) {
|
||||
String boundKey = Keyboard.getKeyName(KeybindHandler.openMagnetFilter.getKeyCode());
|
||||
if (!boundKey.equals("NONE")) {
|
||||
list.add(color("italics") + LocaleHandler.OrPress.getLocal() + " " + color("yellow") + color("bold") + "[" + boundKey + "]");
|
||||
@@ -151,7 +153,7 @@ public class ItemMagnet extends Item {
|
||||
list.add((!doesMagnetIgnoreNBT() ? " " + not : color("green")) + " " + ignoring + " " + nbtData);
|
||||
list.add((!doesMagnetIgnoreMeta() ? " " + not : color("green")) + " " + ignoring + " " + metaData);
|
||||
|
||||
List<ItemStack> filteredItems = getFilteredItems(getItemStack());
|
||||
List<ItemStack> filteredItems = getFilteredItems(itemStack);
|
||||
|
||||
if (filteredItems != null) {
|
||||
list.add("");
|
||||
@@ -524,6 +526,8 @@ public class ItemMagnet extends Item {
|
||||
}
|
||||
|
||||
protected boolean isActivated(ItemStack item) {
|
||||
if (item == null)
|
||||
return false;
|
||||
return item.getItemDamage() != 0;
|
||||
}
|
||||
|
||||
@@ -532,4 +536,4 @@ public class ItemMagnet extends Item {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user