From 57591e02c221d4015cb562caa2e0365a965006d0 Mon Sep 17 00:00:00 2001 From: DoKM Date: Sat, 25 Sep 2021 17:01:15 +0200 Subject: Add divine support --- .../notenoughupdates/NEUEventListener.java | 29 +++------------------ .../miscgui/AccessoryBagOverlay.java | 28 ++++++++++---------- .../moulberry/notenoughupdates/util/Utils.java | 30 +++++++++++++++++++++- 3 files changed, 46 insertions(+), 41 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 9344649f..9cb63a67 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -1727,30 +1727,7 @@ public class NEUEventListener { } } - private static String[] rarityArrC = new String[] { - EnumChatFormatting.WHITE+EnumChatFormatting.BOLD.toString()+"COMMON", - EnumChatFormatting.GREEN+EnumChatFormatting.BOLD.toString()+"UNCOMMON", - EnumChatFormatting.BLUE+EnumChatFormatting.BOLD.toString()+"RARE", - EnumChatFormatting.DARK_PURPLE+EnumChatFormatting.BOLD.toString()+"EPIC", - EnumChatFormatting.GOLD+EnumChatFormatting.BOLD.toString()+"LEGENDARY", - EnumChatFormatting.LIGHT_PURPLE+EnumChatFormatting.BOLD.toString()+"MYTHIC", - EnumChatFormatting.RED+EnumChatFormatting.BOLD.toString()+"SPECIAL", - EnumChatFormatting.RED+EnumChatFormatting.BOLD.toString()+"VERY SPECIAL", - EnumChatFormatting.DARK_RED+EnumChatFormatting.BOLD.toString()+"SUPREME", - }; - private static final HashMap rarityArrMap = new HashMap<>(); - static { - rarityArrMap.put("COMMON", rarityArrC[0]); - rarityArrMap.put("UNCOMMON", rarityArrC[1]); - rarityArrMap.put("RARE", rarityArrC[2]); - rarityArrMap.put("EPIC", rarityArrC[3]); - rarityArrMap.put("LEGENDARY", rarityArrC[4]); - rarityArrMap.put("MYTHIC", rarityArrC[5]); - rarityArrMap.put("SPECIAL", rarityArrC[6]); - rarityArrMap.put("VERY SPECIAL", rarityArrC[7]); - rarityArrMap.put("SUPREME", rarityArrC[8]); - } private HashSet percentStats = new HashSet<>(); { @@ -1825,9 +1802,9 @@ public class NEUEventListener { out: for (int i = list.tagCount(); i >= 0; i--) { String line = list.getStringTagAt(i); - for(int j=0; j entry : enchantsObj.entrySet()) { - if(line.contains(rarityArrC[j] + " " + entry.getKey()) || line.contains(rarityArrC[j] + " DUNGEON " + entry.getKey())) { + if(line.contains(Utils.rarityArrC[j] + " " + entry.getKey()) || line.contains(Utils.rarityArrC[j] + " DUNGEON " + entry.getKey())) { allItemEnchs = entry.getValue().getAsJsonArray(); break out; } @@ -1906,7 +1883,7 @@ public class NEUEventListener { JsonElement statsE = reforgeInfo.get("reforgeStats"); - String rarityFormatted = rarityArrMap.getOrDefault(rarity, rarity); + String rarityFormatted = Utils.rarityArrMap.getOrDefault(rarity, rarity); JsonElement reforgeAbilityE = reforgeInfo.get("reforgeAbility"); String reforgeAbility = null; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java index ee83cb28..f5e784a4 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java @@ -172,7 +172,7 @@ public class AccessoryBagOverlay { int yIndex = 0; for(Map.Entry entry : talismanCountRarity.descendingMap().entrySet()) { - String rarityName = rarityArrC[entry.getKey()]; + String rarityName = Utils.rarityArrC[entry.getKey()]; Utils.renderAlignedString(rarityName, EnumChatFormatting.WHITE.toString()+entry.getValue(), x+5, y+20+11*yIndex, 70); yIndex++; } @@ -887,17 +887,17 @@ public class AccessoryBagOverlay { // private static String[] rarityArr = new String[] { // "COMMON", "UNCOMMON", "RARE", "EPIC", "LEGENDARY", "MYTHIC", "SPECIAL", "VERY SPECIAL", "SUPREME" // }; - private static String[] rarityArrC = new String[] { - EnumChatFormatting.WHITE+EnumChatFormatting.BOLD.toString()+"COMMON", - EnumChatFormatting.GREEN+EnumChatFormatting.BOLD.toString()+"UNCOMMON", - EnumChatFormatting.BLUE+EnumChatFormatting.BOLD.toString()+"RARE", - EnumChatFormatting.DARK_PURPLE+EnumChatFormatting.BOLD.toString()+"EPIC", - EnumChatFormatting.GOLD+EnumChatFormatting.BOLD.toString()+"LEGENDARY", - EnumChatFormatting.LIGHT_PURPLE+EnumChatFormatting.BOLD.toString()+"MYTHIC", - EnumChatFormatting.RED+EnumChatFormatting.BOLD.toString()+"SPECIAL", - EnumChatFormatting.RED+EnumChatFormatting.BOLD.toString()+"VERY SPECIAL", - EnumChatFormatting.DARK_RED+EnumChatFormatting.BOLD.toString()+"SUPREME", - }; +// private static String[] rarityArrC = new String[] { +// EnumChatFormatting.WHITE+EnumChatFormatting.BOLD.toString()+"COMMON", +// EnumChatFormatting.GREEN+EnumChatFormatting.BOLD.toString()+"UNCOMMON", +// EnumChatFormatting.BLUE+EnumChatFormatting.BOLD.toString()+"RARE", +// EnumChatFormatting.DARK_PURPLE+EnumChatFormatting.BOLD.toString()+"EPIC", +// EnumChatFormatting.GOLD+EnumChatFormatting.BOLD.toString()+"LEGENDARY", +// EnumChatFormatting.LIGHT_PURPLE+EnumChatFormatting.BOLD.toString()+"MYTHIC", +// EnumChatFormatting.RED+EnumChatFormatting.BOLD.toString()+"SPECIAL", +// EnumChatFormatting.RED+EnumChatFormatting.BOLD.toString()+"VERY SPECIAL", +// EnumChatFormatting.DARK_RED+EnumChatFormatting.BOLD.toString()+"SUPREME", +// }; public static int checkItemType(ItemStack stack, boolean contains, String... typeMatches) { NBTTagCompound tag = stack.getTagCompound(); if(tag != null) { @@ -955,8 +955,8 @@ public class AccessoryBagOverlay { NBTTagList list = display.getTagList("Lore", 8); for (int i = list.tagCount(); i >= 0; i--) { String line = list.getStringTagAt(i); - for(int j=0; j rarityArrMap = new HashMap<>(); + static { + rarityArrMap.put("COMMON", rarityArrC[0]); + rarityArrMap.put("UNCOMMON", rarityArrC[1]); + rarityArrMap.put("RARE", rarityArrC[2]); + rarityArrMap.put("EPIC", rarityArrC[3]); + rarityArrMap.put("LEGENDARY", rarityArrC[4]); + rarityArrMap.put("MYTHIC", rarityArrC[5]); + rarityArrMap.put("SPECIAL", rarityArrC[6]); + rarityArrMap.put("VERY SPECIAL", rarityArrC[7]); + rarityArrMap.put("SUPREME", rarityArrC[8]); + rarityArrMap.put("DIVINE", rarityArrC[9]); + + } + public static String getRarityFromInt(int rarity){ if(rarity < 0|| rarity >= rarityArr.length){ return rarityArr[0]; } return rarityArr[rarity]; -- cgit