diff options
| author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-10-16 15:50:41 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-16 15:50:41 -0400 |
| commit | 7c00af18febf6c0b833c7633b4fb60a9a1bb93af (patch) | |
| tree | f02de145362d6a1399651ade4a130d565d7f0ba3 /src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java | |
| parent | b11742988dec635b5c5da7c2363803cbfafb37b1 (diff) | |
| download | notenoughupdates-7c00af18febf6c0b833c7633b4fb60a9a1bb93af.tar.gz notenoughupdates-7c00af18febf6c0b833c7633b4fb60a9a1bb93af.tar.bz2 notenoughupdates-7c00af18febf6c0b833c7633b4fb60a9a1bb93af.zip | |
Code Clean Up (#2)
* intellij code clean up
* optimize imports
* format
* intellij suggestions
* fix empty catch issues
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java | 549 |
1 files changed, 282 insertions, 267 deletions
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 f5e784a4..d3b24e2c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java @@ -48,36 +48,36 @@ public class AccessoryBagOverlay { private static final int TAB_MISSING = 4; private static final int TAB_OPTIMIZER = 5; - private static final ItemStack[] TAB_STACKS = new ItemStack[] { - Utils.createItemStack(Items.dye, EnumChatFormatting.DARK_AQUA+"Basic Information", - 10, EnumChatFormatting.GREEN+"- Talis count by rarity"), - Utils.createItemStack(Items.diamond_sword, EnumChatFormatting.DARK_AQUA+"Total Stat Bonuses", + private static final ItemStack[] TAB_STACKS = new ItemStack[]{ + Utils.createItemStack(Items.dye, EnumChatFormatting.DARK_AQUA + "Basic Information", + 10, EnumChatFormatting.GREEN + "- Talis count by rarity"), + Utils.createItemStack(Items.diamond_sword, EnumChatFormatting.DARK_AQUA + "Total Stat Bonuses", 0), - Utils.createItemStack(Item.getItemFromBlock(Blocks.anvil), EnumChatFormatting.DARK_AQUA+"Total Stat Bonuses (from reforges)", + Utils.createItemStack(Item.getItemFromBlock(Blocks.anvil), EnumChatFormatting.DARK_AQUA + "Total Stat Bonuses (from reforges)", 0), - Utils.createItemStack(Items.dye, EnumChatFormatting.DARK_AQUA+"Duplicates", + Utils.createItemStack(Items.dye, EnumChatFormatting.DARK_AQUA + "Duplicates", 8), - Utils.createItemStack(Item.getItemFromBlock(Blocks.barrier), EnumChatFormatting.DARK_AQUA+"Missing", + Utils.createItemStack(Item.getItemFromBlock(Blocks.barrier), EnumChatFormatting.DARK_AQUA + "Missing", 0), - Utils.createItemStack(Item.getItemFromBlock(Blocks.redstone_block), EnumChatFormatting.DARK_AQUA+"Optimizer", + Utils.createItemStack(Item.getItemFromBlock(Blocks.redstone_block), EnumChatFormatting.DARK_AQUA + "Optimizer", 0), }; private static int currentTab = TAB_BASIC; public static boolean mouseClick() { - if(Minecraft.getMinecraft().currentScreen instanceof GuiChest) { + if (Minecraft.getMinecraft().currentScreen instanceof GuiChest) { GuiChest eventGui = (GuiChest) Minecraft.getMinecraft().currentScreen; ContainerChest cc = (ContainerChest) eventGui.inventorySlots; String containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText(); - if(!containerName.trim().startsWith("Accessory Bag")) { + if (!containerName.trim().startsWith("Accessory Bag")) { return false; } } else { return false; } - if(!Mouse.getEventButtonState()) return false; + if (!Mouse.getEventButtonState()) return false; try { ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); @@ -92,47 +92,47 @@ public class AccessoryBagOverlay { int guiLeft = (int) Utils.getField(GuiContainer.class, Minecraft.getMinecraft().currentScreen, "guiLeft", "field_147003_i"); int guiTop = (int) Utils.getField(GuiContainer.class, Minecraft.getMinecraft().currentScreen, "guiTop", "field_147009_r"); - if(mouseX < guiLeft+xSize+3 || mouseX > guiLeft+xSize+80+28) return false; - if(mouseY < guiTop || mouseY > guiTop+166) return false; + if (mouseX < guiLeft + xSize + 3 || mouseX > guiLeft + xSize + 80 + 28) return false; + if (mouseY < guiTop || mouseY > guiTop + 166) return false; - if(mouseX > guiLeft+xSize+83 && mouseY < guiTop+20*TAB_MISSING+22) { - currentTab = (mouseY - guiTop)/20; - if(currentTab < 0) currentTab = 0; - if(currentTab > TAB_MISSING) currentTab = TAB_MISSING; + if (mouseX > guiLeft + xSize + 83 && mouseY < guiTop + 20 * TAB_MISSING + 22) { + currentTab = (mouseY - guiTop) / 20; + if (currentTab < 0) currentTab = 0; + if (currentTab > TAB_MISSING) currentTab = TAB_MISSING; } - if(currentTab == TAB_OPTIMIZER) { - int x = guiLeft+xSize+3; + if (currentTab == TAB_OPTIMIZER) { + int x = guiLeft + xSize + 3; int y = guiTop; - if(mouseY > y+92 && mouseY < y+103) { - if(mouseX > x+5 && mouseX < x+75) { - mainWeapon = (int)Math.floor((mouseX-x-5)/70f*9); - if(mainWeapon < 1) { + if (mouseY > y + 92 && mouseY < y + 103) { + if (mouseX > x + 5 && mouseX < x + 75) { + mainWeapon = (int) Math.floor((mouseX - x - 5) / 70f * 9); + if (mainWeapon < 1) { mainWeapon = 1; - } else if(mainWeapon > 9) { + } else if (mainWeapon > 9) { mainWeapon = 9; } } } - if(mouseX > x+5 && mouseX < x+35 || mouseX > x+45 && mouseX < x+75) { - boolean set = mouseX > x+5 && mouseX < x+35; + if (mouseX > x + 5 && mouseX < x + 35 || mouseX > x + 45 && mouseX < x + 75) { + boolean set = mouseX > x + 5 && mouseX < x + 35; - if(mouseY > y+32 && mouseY < y+43) { + if (mouseY > y + 32 && mouseY < y + 43) { forceCC = set; - } else if(mouseY > y+52 && mouseY < y+63) { + } else if (mouseY > y + 52 && mouseY < y + 63) { forceAS = set; - } else if(mouseY > y+72 && mouseY < y+83) { + } else if (mouseY > y + 72 && mouseY < y + 83) { useGodPot = set; - } else if(mouseY > y+92 && mouseY < y+103) { + } else if (mouseY > y + 92 && mouseY < y + 103) { allowShaded = set; } } } return true; - } catch(Exception e) { + } catch (Exception e) { return false; } } @@ -151,104 +151,107 @@ public class AccessoryBagOverlay { private static Set<Integer> pagesVisited = new HashSet<>(); public static void renderVisitOverlay(int x, int y) { - Utils.drawStringCenteredScaledMaxWidth("Please visit all", Minecraft.getMinecraft().fontRendererObj, x+40, y+78, true, 70, -1); - Utils.drawStringCenteredScaledMaxWidth("pages of the bag", Minecraft.getMinecraft().fontRendererObj, x+40, y+86, true, 70, -1); + Utils.drawStringCenteredScaledMaxWidth("Please visit all", Minecraft.getMinecraft().fontRendererObj, x + 40, y + 78, true, 70, -1); + Utils.drawStringCenteredScaledMaxWidth("pages of the bag", Minecraft.getMinecraft().fontRendererObj, x + 40, y + 86, true, 70, -1); } private static TreeMap<Integer, Integer> talismanCountRarity = null; + public static void renderBasicOverlay(int x, int y) { - if(talismanCountRarity == null) { + if (talismanCountRarity == null) { talismanCountRarity = new TreeMap<>(); - for(ItemStack stack : accessoryStacks) { + for (ItemStack stack : accessoryStacks) { int rarity = getRarity(stack); - if(rarity >= 0) { - talismanCountRarity.put(rarity, talismanCountRarity.getOrDefault(rarity, 0)+1); + if (rarity >= 0) { + talismanCountRarity.put(rarity, talismanCountRarity.getOrDefault(rarity, 0) + 1); } } } - Utils.drawStringCenteredScaledMaxWidth("# By Rarity", Minecraft.getMinecraft().fontRendererObj, x+40, y+12, false, 70, + Utils.drawStringCenteredScaledMaxWidth("# By Rarity", Minecraft.getMinecraft().fontRendererObj, x + 40, y + 12, false, 70, new Color(80, 80, 80).getRGB()); int yIndex = 0; - for(Map.Entry<Integer, Integer> entry : talismanCountRarity.descendingMap().entrySet()) { + for (Map.Entry<Integer, Integer> entry : talismanCountRarity.descendingMap().entrySet()) { String rarityName = Utils.rarityArrC[entry.getKey()]; - Utils.renderAlignedString(rarityName, EnumChatFormatting.WHITE.toString()+entry.getValue(), x+5, y+20+11*yIndex, 70); + Utils.renderAlignedString(rarityName, EnumChatFormatting.WHITE.toString() + entry.getValue(), x + 5, y + 20 + 11 * yIndex, 70); yIndex++; } } - private static PlayerStats.Stats totalStats = null; + public static void renderTotalStatsOverlay(int x, int y) { - if(totalStats == null) { + if (totalStats == null) { totalStats = new PlayerStats.Stats(); - for(ItemStack stack : accessoryStacks) { - if(stack != null) totalStats.add(getStatForItem(stack, STAT_PATTERN_MAP, true)); + for (ItemStack stack : accessoryStacks) { + if (stack != null) totalStats.add(getStatForItem(stack, STAT_PATTERN_MAP, true)); } } - Utils.drawStringCenteredScaledMaxWidth("Total Stats", Minecraft.getMinecraft().fontRendererObj, x+40, y+12, false, 70, + Utils.drawStringCenteredScaledMaxWidth("Total Stats", Minecraft.getMinecraft().fontRendererObj, x + 40, y + 12, false, 70, new Color(80, 80, 80).getRGB()); int yIndex = 0; - for(int i=0; i<PlayerStats.defaultStatNames.length; i++) { + for (int i = 0; i < PlayerStats.defaultStatNames.length; i++) { String statName = PlayerStats.defaultStatNames[i]; String statNamePretty = PlayerStats.defaultStatNamesPretty[i]; int val = Math.round(totalStats.get(statName)); - if(Math.abs(val) < 1E-5) continue; + if (Math.abs(val) < 1E-5) continue; GlStateManager.color(1, 1, 1, 1); GlStateManager.enableBlend(); GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - Utils.renderAlignedString(statNamePretty, EnumChatFormatting.WHITE.toString()+val, x+5, y+20+11*yIndex, 70); + Utils.renderAlignedString(statNamePretty, EnumChatFormatting.WHITE.toString() + val, x + 5, y + 20 + 11 * yIndex, 70); yIndex++; } } private static PlayerStats.Stats reforgeStats = null; + public static void renderReforgeStatsOverlay(int x, int y) { - if(reforgeStats == null) { + if (reforgeStats == null) { reforgeStats = new PlayerStats.Stats(); - for(ItemStack stack : accessoryStacks) { - if(stack != null) reforgeStats.add(getStatForItem(stack, STAT_PATTERN_MAP_BONUS, false)); + for (ItemStack stack : accessoryStacks) { + if (stack != null) reforgeStats.add(getStatForItem(stack, STAT_PATTERN_MAP_BONUS, false)); } } - Utils.drawStringCenteredScaledMaxWidth("Reforge Stats", Minecraft.getMinecraft().fontRendererObj, x+40, y+12, false, 70, + Utils.drawStringCenteredScaledMaxWidth("Reforge Stats", Minecraft.getMinecraft().fontRendererObj, x + 40, y + 12, false, 70, new Color(80, 80, 80).getRGB()); int yIndex = 0; - for(int i=0; i<PlayerStats.defaultStatNames.length; i++) { + for (int i = 0; i < PlayerStats.defaultStatNames.length; i++) { String statName = PlayerStats.defaultStatNames[i]; String statNamePretty = PlayerStats.defaultStatNamesPretty[i]; int val = Math.round(reforgeStats.get(statName)); - if(Math.abs(val) < 1E-5) continue; + if (Math.abs(val) < 1E-5) continue; GlStateManager.color(1, 1, 1, 1); GlStateManager.enableBlend(); GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - Utils.renderAlignedString(statNamePretty, EnumChatFormatting.WHITE.toString()+val, x+5, y+20+11*yIndex, 70); + Utils.renderAlignedString(statNamePretty, EnumChatFormatting.WHITE.toString() + val, x + 5, y + 20 + 11 * yIndex, 70); yIndex++; } } private static Set<ItemStack> duplicates = null; + public static void renderDuplicatesOverlay(int x, int y) { - if(duplicates == null) { + if (duplicates == null) { JsonObject misc = Constants.MISC; - if(misc == null) { - Utils.drawStringCenteredScaledMaxWidth("Duplicates: ERROR", Minecraft.getMinecraft().fontRendererObj, x+40, y+12, false, 70, + if (misc == null) { + Utils.drawStringCenteredScaledMaxWidth("Duplicates: ERROR", Minecraft.getMinecraft().fontRendererObj, x + 40, y + 12, false, 70, new Color(80, 80, 80).getRGB()); return; } JsonElement talisman_upgrades_element = misc.get("talisman_upgrades"); - if(talisman_upgrades_element == null) { - Utils.drawStringCenteredScaledMaxWidth("Duplicates: ERROR", Minecraft.getMinecraft().fontRendererObj, x+40, y+12, false, 70, + if (talisman_upgrades_element == null) { + Utils.drawStringCenteredScaledMaxWidth("Duplicates: ERROR", Minecraft.getMinecraft().fontRendererObj, x + 40, y + 12, false, 70, new Color(80, 80, 80).getRGB()); return; } @@ -257,23 +260,23 @@ public class AccessoryBagOverlay { duplicates = new HashSet<>(); Set<String> prevInternalnames = new HashSet<>(); - for(ItemStack stack : accessoryStacks) { + for (ItemStack stack : accessoryStacks) { String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(stack); - if(prevInternalnames.contains(internalname)) { + if (prevInternalnames.contains(internalname)) { duplicates.add(stack); continue; } prevInternalnames.add(internalname); - if(talisman_upgrades.has(internalname)) { + if (talisman_upgrades.has(internalname)) { JsonArray upgrades = talisman_upgrades.get(internalname).getAsJsonArray(); - for(ItemStack stack2 : accessoryStacks) { - if(stack != stack2) { + for (ItemStack stack2 : accessoryStacks) { + if (stack != stack2) { String internalname2 = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(stack2); - for(int j=0; j<upgrades.size(); j++) { + for (int j = 0; j < upgrades.size(); j++) { String upgrade = upgrades.get(j).getAsString(); - if(internalname2.equals(upgrade)) { + if (internalname2.equals(upgrade)) { duplicates.add(stack); break; } @@ -283,44 +286,45 @@ public class AccessoryBagOverlay { } } } - if(duplicates.isEmpty()) { - Utils.drawStringCenteredScaledMaxWidth("No Duplicates", Minecraft.getMinecraft().fontRendererObj, x+40, y+12, false, 70, + if (duplicates.isEmpty()) { + Utils.drawStringCenteredScaledMaxWidth("No Duplicates", Minecraft.getMinecraft().fontRendererObj, x + 40, y + 12, false, 70, new Color(80, 80, 80).getRGB()); } else { - Utils.drawStringCenteredScaledMaxWidth("Duplicates: " + duplicates.size(), Minecraft.getMinecraft().fontRendererObj, x+40, y+12, false, 70, + Utils.drawStringCenteredScaledMaxWidth("Duplicates: " + duplicates.size(), Minecraft.getMinecraft().fontRendererObj, x + 40, y + 12, false, 70, new Color(80, 80, 80).getRGB()); int yIndex = 0; - for(ItemStack duplicate : duplicates) { + for (ItemStack duplicate : duplicates) { String s = duplicate.getDisplayName(); - Utils.renderShadowedString(s, x+40, y+20+11*yIndex, 70); - if(duplicates.size() > 11) { - if(++yIndex >= 10) break; + Utils.renderShadowedString(s, x + 40, y + 20 + 11 * yIndex, 70); + if (duplicates.size() > 11) { + if (++yIndex >= 10) break; } else { - if(++yIndex >= 11) break; + if (++yIndex >= 11) break; } } - - if(duplicates.size() > 11) { - Utils.drawStringCenteredScaledMaxWidth("+" + (duplicates.size()-10) + " More", - Minecraft.getMinecraft().fontRendererObj, x+40, y+16+121, false, 70, + + if (duplicates.size() > 11) { + Utils.drawStringCenteredScaledMaxWidth("+" + (duplicates.size() - 10) + " More", + Minecraft.getMinecraft().fontRendererObj, x + 40, y + 16 + 121, false, 70, new Color(80, 80, 80).getRGB()); } } } private static List<ItemStack> missing = null; + public static void renderMissingOverlay(int x, int y) { - if(missing == null) { + if (missing == null) { JsonObject misc = Constants.MISC; - if(misc == null) { - Utils.drawStringCenteredScaledMaxWidth("Duplicates: ERROR", Minecraft.getMinecraft().fontRendererObj, x+40, y+12, false, 70, + if (misc == null) { + Utils.drawStringCenteredScaledMaxWidth("Duplicates: ERROR", Minecraft.getMinecraft().fontRendererObj, x + 40, y + 12, false, 70, new Color(80, 80, 80).getRGB()); return; } JsonElement talisman_upgrades_element = misc.get("talisman_upgrades"); - if(talisman_upgrades_element == null) { - Utils.drawStringCenteredScaledMaxWidth("Duplicates: ERROR", Minecraft.getMinecraft().fontRendererObj, x+40, y+12, false, 70, + if (talisman_upgrades_element == null) { + Utils.drawStringCenteredScaledMaxWidth("Duplicates: ERROR", Minecraft.getMinecraft().fontRendererObj, x + 40, y + 12, false, 70, new Color(80, 80, 80).getRGB()); return; } @@ -329,23 +333,23 @@ public class AccessoryBagOverlay { missing = new ArrayList<>(); List<String> missingInternal = new ArrayList<>(); - for(Map.Entry<String, JsonObject> entry : NotEnoughUpdates.INSTANCE.manager.getItemInformation().entrySet()) { - if(entry.getValue().has("lore")) { - if(checkItemType(entry.getValue().get("lore").getAsJsonArray(), "ACCESSORY", "HATCCESSORY", "DUNGEON ACCESSORY") >= 0) { + for (Map.Entry<String, JsonObject> entry : NotEnoughUpdates.INSTANCE.manager.getItemInformation().entrySet()) { + if (entry.getValue().has("lore")) { + if (checkItemType(entry.getValue().get("lore").getAsJsonArray(), "ACCESSORY", "HATCCESSORY", "DUNGEON ACCESSORY") >= 0) { missingInternal.add(entry.getKey()); } } } - for(ItemStack stack : accessoryStacks) { + for (ItemStack stack : accessoryStacks) { String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(stack); missingInternal.remove(internalname); - for(Map.Entry<String, JsonElement> talisman_upgrade_element : talisman_upgrades.entrySet()) { + for (Map.Entry<String, JsonElement> talisman_upgrade_element : talisman_upgrades.entrySet()) { JsonArray upgrades = talisman_upgrade_element.getValue().getAsJsonArray(); - for(int j=0; j<upgrades.size(); j++) { + for (int j = 0; j < upgrades.size(); j++) { String upgrade = upgrades.get(j).getAsString(); - if(internalname.equals(upgrade)) { + if (internalname.equals(upgrade)) { missingInternal.remove(talisman_upgrade_element.getKey()); break; } @@ -356,14 +360,14 @@ public class AccessoryBagOverlay { missingInternal.sort(getItemComparator()); Set<String> missingDisplayNames = new HashSet<>(); - for(String internal : missingInternal) { + for (String internal : missingInternal) { boolean hasDup = false; - if(talisman_upgrades.has(internal)) { + if (talisman_upgrades.has(internal)) { JsonArray upgrades = talisman_upgrades.get(internal).getAsJsonArray(); - for(int j=0; j<upgrades.size(); j++) { + for (int j = 0; j < upgrades.size(); j++) { String upgrade = upgrades.get(j).getAsString(); - if(missingInternal.contains(upgrade)) { + if (missingInternal.contains(upgrade)) { hasDup = true; break; } @@ -372,26 +376,26 @@ public class AccessoryBagOverlay { ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(internal), false); - if(missingDisplayNames.contains(stack.getDisplayName())) continue; + if (missingDisplayNames.contains(stack.getDisplayName())) continue; missingDisplayNames.add(stack.getDisplayName()); - if(hasDup) { - stack.setStackDisplayName(stack.getDisplayName()+"*"); + if (hasDup) { + stack.setStackDisplayName(stack.getDisplayName() + "*"); } missing.add(stack); } } - if(missing.isEmpty()) { - Utils.drawStringCenteredScaledMaxWidth("No Missing", Minecraft.getMinecraft().fontRendererObj, x+40, y+12, false, 70, + if (missing.isEmpty()) { + Utils.drawStringCenteredScaledMaxWidth("No Missing", Minecraft.getMinecraft().fontRendererObj, x + 40, y + 12, false, 70, new Color(80, 80, 80).getRGB()); } else { - Utils.drawStringCenteredScaledMaxWidth("Missing: " + missing.size(), Minecraft.getMinecraft().fontRendererObj, x+40, y+12, false, 70, + Utils.drawStringCenteredScaledMaxWidth("Missing: " + missing.size(), Minecraft.getMinecraft().fontRendererObj, x + 40, y + 12, false, 70, new Color(80, 80, 80).getRGB()); int yIndex = 0; long currentTime = System.currentTimeMillis(); - int marqueeOffset = (int)(currentTime/500 % 100); - for(ItemStack missingStack : missing) { + int marqueeOffset = (int) (currentTime / 500 % 100); + for (ItemStack missingStack : missing) { String s = missingStack.getDisplayName(); //int marueeOffset @@ -402,24 +406,24 @@ public class AccessoryBagOverlay { s = Minecraft.getMinecraft().fontRendererObj.trimStringToWidth(s, 70); String clean = StringUtils.cleanColourNotModifiers(s); - for(int xO = -1; xO <= 1; xO++) { - for(int yO = -1; yO <= 1; yO++) { + for (int xO = -1; xO <= 1; xO++) { + for (int yO = -1; yO <= 1; yO++) { int col = 0xff202020; //if(xO != 0 && yO != 0) col = 0xff252525; - Minecraft.getMinecraft().fontRendererObj.drawString(clean, x+5+xO, y+20+11*yIndex+yO, col, false); + Minecraft.getMinecraft().fontRendererObj.drawString(clean, x + 5 + xO, y + 20 + 11 * yIndex + yO, col, false); } } - Minecraft.getMinecraft().fontRendererObj.drawString(s, x+5, y+20+11*yIndex, 0xffffff, false); - if(missing.size() > 11) { - if(++yIndex >= 10) break; + Minecraft.getMinecraft().fontRendererObj.drawString(s, x + 5, y + 20 + 11 * yIndex, 0xffffff, false); + if (missing.size() > 11) { + if (++yIndex >= 10) break; } else { - if(++yIndex >= 11) break; + if (++yIndex >= 11) break; } } - if(missing.size() > 11) { + if (missing.size() > 11) { Utils.drawStringCenteredScaledMaxWidth("Show All", - Minecraft.getMinecraft().fontRendererObj, x+40, y+16+121, false, 70, + Minecraft.getMinecraft().fontRendererObj, x + 40, y + 16 + 121, false, 70, new Color(80, 80, 80).getRGB()); final ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft()); @@ -428,22 +432,22 @@ public class AccessoryBagOverlay { int mouseX = Mouse.getX() * scaledWidth / Minecraft.getMinecraft().displayWidth; int mouseY = scaledHeight - Mouse.getY() * scaledHeight / Minecraft.getMinecraft().displayHeight - 1; - if(mouseX > x && mouseX < x+80 && - mouseY > y+11+121 && mouseY < y+21+121) { + if (mouseX > x && mouseX < x + 80 && + mouseY > y + 11 + 121 && mouseY < y + 21 + 121) { List<String> text = new ArrayList<>(); StringBuilder line = new StringBuilder(); int leftMaxSize = 0; int middleMaxSize = 0; - for(int i=0; i<missing.size(); i += 3) { + for (int i = 0; i < missing.size(); i += 3) { leftMaxSize = Math.max(leftMaxSize, Minecraft.getMinecraft().fontRendererObj. getStringWidth(missing.get(i).getDisplayName())); } - for(int i=1; i<missing.size(); i += 3) { + for (int i = 1; i < missing.size(); i += 3) { middleMaxSize = Math.max(middleMaxSize, Minecraft.getMinecraft().fontRendererObj. getStringWidth(missing.get(i).getDisplayName())); } - for(int i=0; i<missing.size(); i++) { - if(i % 3 == 0 && i > 0) { + for (int i = 0; i < missing.size(); i++) { + if (i % 3 == 0 && i > 0) { text.add(line.toString()); line = new StringBuilder(); } @@ -451,13 +455,13 @@ public class AccessoryBagOverlay { int nameLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(name.toString()); int padSize = -1; - if(i % 3 == 0) padSize = leftMaxSize; - if(i % 3 == 1) padSize = middleMaxSize; - if(padSize > 0) { + if (i % 3 == 0) padSize = leftMaxSize; + if (i % 3 == 1) padSize = middleMaxSize; + if (padSize > 0) { float padNum = (padSize - nameLen) / 4.0f; - int remainder = (int)((padNum % 1) * 4); - while(padNum >= 1) { - if(remainder > 0) { + int remainder = (int) ((padNum % 1) * 4); + while (padNum >= 1) { + if (remainder > 0) { name.append(EnumChatFormatting.BOLD).append(" "); remainder--; } else { @@ -467,22 +471,22 @@ public class AccessoryBagOverlay { } } line.append('\u00A7').append(Utils.getPrimaryColourCode(missing.get(i).getDisplayName())); - if(i < 9) { - line.append((char)('\u2776'+i)).append(' '); + if (i < 9) { + line.append((char) ('\u2776' + i)).append(' '); } else { line.append("\u2b24 "); } line.append(name); - if(i % 3 < 2) line.append(" "); + if (i % 3 < 2) line.append(" "); } GlStateManager.pushMatrix(); - GlStateManager.scale(2f/scaledresolution.getScaleFactor(), 2f/scaledresolution.getScaleFactor(), 1); + GlStateManager.scale(2f / scaledresolution.getScaleFactor(), 2f / scaledresolution.getScaleFactor(), 1); Utils.drawHoveringText(text, - mouseX*scaledresolution.getScaleFactor()/2, - mouseY*scaledresolution.getScaleFactor()/2, - scaledWidth*scaledresolution.getScaleFactor()/2, - scaledHeight*scaledresolution.getScaleFactor()/2, -1, Minecraft.getMinecraft().fontRendererObj); + mouseX * scaledresolution.getScaleFactor() / 2, + mouseY * scaledresolution.getScaleFactor() / 2, + scaledWidth * scaledresolution.getScaleFactor() / 2, + scaledHeight * scaledresolution.getScaleFactor() / 2, -1, Minecraft.getMinecraft().fontRendererObj); GlStateManager.popMatrix(); } } @@ -496,62 +500,62 @@ public class AccessoryBagOverlay { private static int mainWeapon = 1; public static void renderOptimizerOverlay(int x, int y) { - Utils.drawStringCenteredScaledMaxWidth("Optimizer", Minecraft.getMinecraft().fontRendererObj, x+40, y+12, false, 70, + Utils.drawStringCenteredScaledMaxWidth("Optimizer", Minecraft.getMinecraft().fontRendererObj, x + 40, y + 12, false, 70, new Color(80, 80, 80).getRGB()); int light = new Color(220, 220, 220).getRGB(); int dark = new Color(170, 170, 170).getRGB(); - Gui.drawRect(x+5, y+32, x+35, y+43, forceCC?dark:light); - Gui.drawRect(x+45, y+32, x+75, y+43, forceCC?light:dark); + Gui.drawRect(x + 5, y + 32, x + 35, y + 43, forceCC ? dark : light); + Gui.drawRect(x + 45, y + 32, x + 75, y + 43, forceCC ? light : dark); - Gui.drawRect(x+5, y+52, x+35, y+63, forceAS?dark:light); - Gui.drawRect(x+45, y+52, x+75, y+63, forceAS?light:dark); + Gui.drawRect(x + 5, y + 52, x + 35, y + 63, forceAS ? dark : light); + Gui.drawRect(x + 45, y + 52, x + 75, y + 63, forceAS ? light : dark); - Gui.drawRect(x+5, y+72, x+35, y+83, useGodPot?dark:light); - Gui.drawRect(x+45, y+72, x+75, y+83, useGodPot?light:dark); + Gui.drawRect(x + 5, y + 72, x + 35, y + 83, useGodPot ? dark : light); + Gui.drawRect(x + 45, y + 72, x + 75, y + 83, useGodPot ? light : dark); - Gui.drawRect(x+5, y+92, x+35, y+103, allowShaded?dark:light); - Gui.drawRect(x+45, y+92, x+75, y+103, allowShaded?light:dark); + Gui.drawRect(x + 5, y + 92, x + 35, y + 103, allowShaded ? dark : light); + Gui.drawRect(x + 45, y + 92, x + 75, y + 103, allowShaded ? light : dark); - Gui.drawRect(x+5, y+102, x+75, y+113, light); - Gui.drawRect(x+5+(int)((mainWeapon-1)/9f*70), y+102, x+5+(int)(mainWeapon/9f*70), y+113, dark); + Gui.drawRect(x + 5, y + 102, x + 75, y + 113, light); + Gui.drawRect(x + 5 + (int) ((mainWeapon - 1) / 9f * 70), y + 102, x + 5 + (int) (mainWeapon / 9f * 70), y + 113, dark); - Utils.drawStringCenteredScaledMaxWidth("Force 100% CC", Minecraft.getMinecraft().fontRendererObj, x+40, y+27, false, 70, + Utils.drawStringCenteredScaledMaxWidth("Force 100% CC", Minecraft.getMinecraft().fontRendererObj, x + 40, y + 27, false, 70, new Color(80, 80, 80).getRGB()); - Utils.drawStringCenteredScaledMaxWidth((forceCC?EnumChatFormatting.GREEN:EnumChatFormatting.GRAY)+"YES", - Minecraft.getMinecraft().fontRendererObj, x+20, y+37, + Utils.drawStringCenteredScaledMaxWidth((forceCC ? EnumChatFormatting.GREEN : EnumChatFormatting.GRAY) + "YES", + Minecraft.getMinecraft().fontRendererObj, x + 20, y + 37, true, 30, new Color(80, 80, 80).getRGB()); - Utils.drawStringCenteredScaledMaxWidth((forceCC?EnumChatFormatting.GRAY:EnumChatFormatting.RED)+"NO", Minecraft.getMinecraft().fontRendererObj, x+60, y+37, + Utils.drawStringCenteredScaledMaxWidth((forceCC ? EnumChatFormatting.GRAY : EnumChatFormatting.RED) + "NO", Minecraft.getMinecraft().fontRendererObj, x + 60, y + 37, true, 30, new Color(80, 80, 80).getRGB()); - Utils.drawStringCenteredScaledMaxWidth("Force 100% ATKSPEED", Minecraft.getMinecraft().fontRendererObj, x+40, y+47, false, 70, + Utils.drawStringCenteredScaledMaxWidth("Force 100% ATKSPEED", Minecraft.getMinecraft().fontRendererObj, x + 40, y + 47, false, 70, new Color(80, 80, 80).getRGB()); - Utils.drawStringCenteredScaledMaxWidth((forceAS?EnumChatFormatting.GREEN:EnumChatFormatting.GRAY)+"YES", Minecraft.getMinecraft().fontRendererObj, x+20, y+57, + Utils.drawStringCenteredScaledMaxWidth((forceAS ? EnumChatFormatting.GREEN : EnumChatFormatting.GRAY) + "YES", Minecraft.getMinecraft().fontRendererObj, x + 20, y + 57, true, 30, new Color(80, 80, 80).getRGB()); - Utils.drawStringCenteredScaledMaxWidth((forceAS?EnumChatFormatting.GRAY:EnumChatFormatting.RED)+"NO", Minecraft.getMinecraft().fontRendererObj, x+60, y+57, + Utils.drawStringCenteredScaledMaxWidth((forceAS ? EnumChatFormatting.GRAY : EnumChatFormatting.RED) + "NO", Minecraft.getMinecraft().fontRendererObj, x + 60, y + 57, true, 30, new Color(80, 80, 80).getRGB()); - Utils.drawStringCenteredScaledMaxWidth("Use God Potion", Minecraft.getMinecraft().fontRendererObj, x+40, y+67, false, 70, + Utils.drawStringCenteredScaledMaxWidth("Use God Potion", Minecraft.getMinecraft().fontRendererObj, x + 40, y + 67, false, 70, new Color(80, 80, 80).getRGB()); - Utils.drawStringCenteredScaledMaxWidth((useGodPot?EnumChatFormatting.GREEN:EnumChatFormatting.GRAY)+"YES", Minecraft.getMinecraft().fontRendererObj, x+20, y+77, + Utils.drawStringCenteredScaledMaxWidth((useGodPot ? EnumChatFormatting.GREEN : EnumChatFormatting.GRAY) + "YES", Minecraft.getMinecraft().fontRendererObj, x + 20, y + 77, true, 30, new Color(80, 80, 80).getRGB()); - Utils.drawStringCenteredScaledMaxWidth((useGodPot?EnumChatFormatting.GRAY:EnumChatFormatting.RED)+"NO", Minecraft.getMinecraft().fontRendererObj, x+60, y+77, + Utils.drawStringCenteredScaledMaxWidth((useGodPot ? EnumChatFormatting.GRAY : EnumChatFormatting.RED) + "NO", Minecraft.getMinecraft().fontRendererObj, x + 60, y + 77, true, 30, new Color(80, 80, 80).getRGB()); - Utils.drawStringCenteredScaledMaxWidth("Use God Potion", Minecraft.getMinecraft().fontRendererObj, x+40, y+87, false, 70, + Utils.drawStringCenteredScaledMaxWidth("Use God Potion", Minecraft.getMinecraft().fontRendererObj, x + 40, y + 87, false, 70, new Color(80, 80, 80).getRGB()); - Utils.drawStringCenteredScaledMaxWidth((allowShaded?EnumChatFormatting.GREEN:EnumChatFormatting.GRAY)+"YES", - Minecraft.getMinecraft().fontRendererObj, x+20, y+97, + Utils.drawStringCenteredScaledMaxWidth((allowShaded ? EnumChatFormatting.GREEN : EnumChatFormatting.GRAY) + "YES", + Minecraft.getMinecraft().fontRendererObj, x + 20, y + 97, true, 30, new Color(80, 80, 80).getRGB()); - Utils.drawStringCenteredScaledMaxWidth((allowShaded?EnumChatFormatting.GRAY:EnumChatFormatting.RED)+"NO", - Minecraft.getMinecraft().fontRendererObj, x+60, y+97, + Utils.drawStringCenteredScaledMaxWidth((allowShaded ? EnumChatFormatting.GRAY : EnumChatFormatting.RED) + "NO", + Minecraft.getMinecraft().fontRendererObj, x + 60, y + 97, true, 30, new Color(80, 80, 80).getRGB()); - - Utils.drawStringCenteredScaledMaxWidth("Main Weapon", Minecraft.getMinecraft().fontRendererObj, x+40, y+107, false, 70, + + Utils.drawStringCenteredScaledMaxWidth("Main Weapon", Minecraft.getMinecraft().fontRendererObj, x + 40, y + 107, false, 70, new Color(80, 80, 80).getRGB()); Utils.drawStringCenteredScaled("1 2 3 4 5 6 7 8 9", - Minecraft.getMinecraft().fontRendererObj, x+40, y+117, + Minecraft.getMinecraft().fontRendererObj, x + 40, y + 117, true, 70, new Color(80, 80, 80).getRGB()); } @@ -559,41 +563,43 @@ public class AccessoryBagOverlay { return (o1, o2) -> { float cost1; JsonObject o1Auc = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfo(o1); - if(o1Auc != null && o1Auc.has("price")) { + if (o1Auc != null && o1Auc.has("price")) { cost1 = o1Auc.get("price").getAsFloat(); } else { cost1 = NotEnoughUpdates.INSTANCE.manager.auctionManager.getCraftCost(o1).craftCost; } float cost2; JsonObject o2Auc = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfo(o2); - if(o2Auc != null && o2Auc.has("price")) { + if (o2Auc != null && o2Auc.has("price")) { cost2 = o2Auc.get("price").getAsFloat(); } else { cost2 = NotEnoughUpdates.INSTANCE.manager.auctionManager.getCraftCost(o2).craftCost; } - if(cost1 == -1 && cost2 == -1) return o1.compareTo(o2); - if(cost1 == -1) return 1; - if(cost2 == -1) return -1; + if (cost1 == -1 && cost2 == -1) return o1.compareTo(o2); + if (cost1 == -1) return 1; + if (cost2 == -1) return -1; - if(cost1 < cost2) return -1; - if(cost1 > cost2) return 1; + if (cost1 < cost2) return -1; + if (cost1 > cost2) return 1; return o1.compareTo(o2); }; } + private static boolean inAccessoryBag = false; - public static boolean isInAccessoryBag(){ + + public static boolean isInAccessoryBag() { return inAccessoryBag; } - public static void renderOverlay() { + public static void renderOverlay() { inAccessoryBag = false; - if(Minecraft.getMinecraft().currentScreen instanceof GuiChest && NEUEventListener.invento |
