aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
diff options
context:
space:
mode:
authorLulonaut <67191924+Lulonaut@users.noreply.github.com>2022-07-05 08:13:22 +0200
committerGitHub <noreply@github.com>2022-07-05 06:13:22 +0000
commit1ed053c9a8bbbbbe9b34c61fcdcc1a43d78118fd (patch)
tree37c09e229a874019246271729850d14fc6594afc /src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
parent2cd45dc50ca58fe265f637d84800de7dad96cdda (diff)
downloadnotenoughupdates-1ed053c9a8bbbbbe9b34c61fcdcc1a43d78118fd.tar.gz
notenoughupdates-1ed053c9a8bbbbbe9b34c61fcdcc1a43d78118fd.tar.bz2
notenoughupdates-1ed053c9a8bbbbbe9b34c61fcdcc1a43d78118fd.zip
Merge pull request #179
* magical power * major flaw * rarity
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
index ce0ecc4a..3745d72e 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
@@ -1947,4 +1947,29 @@ public class Utils {
true, true
);
}
+
+ /**
+ * Finds the rarity from the lore of an item.
+ * -1 = UNKNOWN
+ * 0 = COMMON
+ * 1 = UNCOMMON
+ * 2 = RARE
+ * 3 = EPIC
+ * 4 = LEGENDARY
+ * 5 = MYTHIC
+ * 6 = SPECIAL
+ * 7 = VERY SPECIAL
+ */
+ public static int getRarityFromLore(JsonArray lore) {
+ for (int i = lore.size() - 1; i >= 0; i--) {
+ String line = lore.get(i).getAsString();
+
+ for (int j = 0; j < rarityArrC.length; j++) {
+ if (line.startsWith(rarityArrC[j])) {
+ return j;
+ }
+ }
+ }
+ return -1;
+ }
}