aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java
diff options
context:
space:
mode:
authorRoman / Linnea Gräf <roman.graef@gmail.com>2022-09-08 14:12:03 +0200
committerGitHub <noreply@github.com>2022-09-08 14:12:03 +0200
commitc671d5c03fb5d0410645d8b6edc56adeda3d94a7 (patch)
treeaefebc84b904e8476cbedbdc4cb4e2bf54f5831d /src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java
parent1695ef38badc02ed6b5abae2d7bb6175e62855bc (diff)
downloadnotenoughupdates-c671d5c03fb5d0410645d8b6edc56adeda3d94a7.tar.gz
notenoughupdates-c671d5c03fb5d0410645d8b6edc56adeda3d94a7.tar.bz2
notenoughupdates-c671d5c03fb5d0410645d8b6edc56adeda3d94a7.zip
Add item ids to Books in more places (#256)
* Add item ids to Books in more places Add item ids to Enchanted Books in the Bazaar and in the Experimentation Table. Add ItemResolutionQuery as a new way to query items and item ids. Co-authored-by: romangraef <roman.graef@gmail.com> * Update 2.1.md * Infer found a bug that already existed before. * add support for animated crab hats Co-authored-by: hannibal00212 <24389977+hannibal00212@users.noreply.github.com> Co-authored-by: nopo <noahogno@gmail.com>
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java
index 3a2db0fb..cffdd164 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java
@@ -73,7 +73,10 @@ public class ItemUtils {
}
public static List<String> getLore(ItemStack is) {
- NBTTagCompound tagCompound = is.getTagCompound();
+ return getLore(is.getTagCompound());
+ }
+
+ public static List<String> getLore(NBTTagCompound tagCompound) {
if (tagCompound == null) {
return Collections.emptyList();
}
@@ -84,4 +87,13 @@ public class ItemUtils {
}
return list;
}
+
+ public static String getDisplayName(NBTTagCompound compound) {
+ if (compound == null) return null;
+ String string = compound.getCompoundTag("display").getString("Name");
+ if (string == null || string.isEmpty())
+ return null;
+ return string;
+ }
+
}