diff options
| author | Moulberry <james.jenour@student.scotch.wa.edu.au> | 2020-10-18 21:01:11 +1100 |
|---|---|---|
| committer | Moulberry <james.jenour@student.scotch.wa.edu.au> | 2020-10-18 21:01:11 +1100 |
| commit | a0402708801b525145d01d0f4da17f0ba9d93455 (patch) | |
| tree | ce0b58df707388449558073df3aa9492efaf8978 | |
| parent | 275fe45caa8eb1048914d864aafae21f3f3a1157 (diff) | |
| download | NotEnoughUpdates-a0402708801b525145d01d0f4da17f0ba9d93455.tar.gz NotEnoughUpdates-a0402708801b525145d01d0f4da17f0ba9d93455.tar.bz2 NotEnoughUpdates-a0402708801b525145d01d0f4da17f0ba9d93455.zip | |
1.4
74 files changed, 2683 insertions, 322 deletions
diff --git a/build.gradle b/build.gradle index 06d19abe..45038326 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'com.github.johnrengelman.shadow' sourceCompatibility = 1.8 targetCompatibility = 1.8 -version = "1.3-REL" +version = "1.4-REL" group= "io.github.moulberry" archivesBaseName = "NotEnoughUpdates" String modid = "notenoughupdates" diff --git a/src/main/java/io/github/moulberry/notenoughupdates/AccessoryBagOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/AccessoryBagOverlay.java index 65d4efc7..1011f3cc 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/AccessoryBagOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/AccessoryBagOverlay.java @@ -1,11 +1,13 @@ package io.github.moulberry.notenoughupdates; import com.google.gson.JsonArray; +import com.google.gson.JsonElement; import com.google.gson.JsonObject; import io.github.moulberry.notenoughupdates.profileviewer.PlayerStats; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.client.gui.inventory.GuiContainer; @@ -41,6 +43,7 @@ public class AccessoryBagOverlay { private static final int TAB_BONUS = 2; private static final int TAB_DUP = 3; 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", @@ -53,6 +56,8 @@ public class AccessoryBagOverlay { 8), Utils.createItemStack(Item.getItemFromBlock(Blocks.barrier), EnumChatFormatting.DARK_AQUA+"Missing", 0), + Utils.createItemStack(Item.getItemFromBlock(Blocks.redstone_block), EnumChatFormatting.DARK_AQUA+"Optimizer", + 0), }; private static int currentTab = TAB_BASIC; @@ -82,6 +87,36 @@ public class AccessoryBagOverlay { if(currentTab > TAB_MISSING) currentTab = TAB_MISSING; } + 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) { + mainWeapon = 1; + } 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(mouseY > y+32 && mouseY < y+43) { + forceCC = set; + } else if(mouseY > y+52 && mouseY < y+63) { + forceAS = set; + } else if(mouseY > y+72 && mouseY < y+83) { + useGodPot = set; + } else if(mouseY > y+92 && mouseY < y+103) { + allowShaded = set; + } + } + } + return true; } catch(Exception e) { return false; @@ -94,6 +129,8 @@ public class AccessoryBagOverlay { talismanCountRarity = null; totalStats = null; reforgeStats = null; + duplicates = null; + missing = null; } private static Set<ItemStack> accessoryStacks = new HashSet<>(); @@ -116,7 +153,7 @@ public class AccessoryBagOverlay { } } - Utils.drawStringCenteredScaledMaxWidth("# By Rarity", Minecraft.getMinecraft().fontRendererObj, x+40, y+12, true, 70, + Utils.drawStringCenteredScaledMaxWidth("# By Rarity", Minecraft.getMinecraft().fontRendererObj, x+40, y+12, false, 70, new Color(80, 80, 80).getRGB()); int yIndex = 0; @@ -137,7 +174,7 @@ public class AccessoryBagOverlay { } } - Utils.drawStringCenteredScaledMaxWidth("Total Stats", Minecraft.getMinecraft().fontRendererObj, x+40, y+12, true, 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++) { @@ -166,7 +203,7 @@ public class AccessoryBagOverlay { } } - Utils.drawStringCenteredScaledMaxWidth("Reforge Stats", Minecraft.getMinecraft().fontRendererObj, x+40, y+12, true, 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++) { @@ -186,13 +223,241 @@ public class AccessoryBagOverlay { } } - private static Set<ItemStack> duplicates = new HashSet<>(); + private static Set<ItemStack> duplicates = null; public static void renderDuplicatesOverlay(int x, int y) { - Utils.drawStringCenteredScaledMaxWidth("Duplicates", Minecraft.getMinecraft().fontRendererObj, x+40, y+12, true, 70, - new Color(80, 80, 80).getRGB()); + if(duplicates == null) { + JsonObject misc = Utils.getConstant("misc"); + 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, + new Color(80, 80, 80).getRGB()); + return; + } + JsonObject talisman_upgrades = talisman_upgrades_element.getAsJsonObject(); + + duplicates = new HashSet<>(); + + Set<String> prevInternalnames = new HashSet<>(); + for(ItemStack stack : accessoryStacks) { + String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(stack); + + if(prevInternalnames.contains(internalname)) { + duplicates.add(stack); + continue; + } + prevInternalnames.add(internalname); + + if(talisman_upgrades.has(internalname)) { + JsonArray upgrades = talisman_upgrades.get(internalname).getAsJsonArray(); + for(ItemStack stack2 : accessoryStacks) { + if(stack != stack2) { + String internalname2 = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(stack2); + for(int j=0; j<upgrades.size(); j++) { + String upgrade = upgrades.get(j).getAsString(); + if(internalname2.equals(upgrade)) { + duplicates.add(stack); + break; + } + } + } + } + } + } + } + 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, + new Color(80, 80, 80).getRGB()); + + int yIndex = 0; + for(ItemStack duplicate : duplicates) { + renderAlignedString(duplicate.getDisplayName(), "", x+5, y+20+11*yIndex, 70); + if(duplicates.size() > 11) { + if(++yIndex >= 10) break; + } else { + if(++yIndex >= 11) break; + } + } + + 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) { + JsonObject misc = Utils.getConstant("misc"); + 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, + new Color(80, 80, 80).getRGB()); + return; + } + JsonObject talisman_upgrades = talisman_upgrades_element.getAsJsonObject(); + + 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") >= 0) { + missingInternal.add(entry.getKey()); + } + } + } + + 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()) { + JsonArray upgrades = talisman_upgrade_element.getValue().getAsJsonArray(); + for(int j=0; j<upgrades.size(); j++) { + String upgrade = upgrades.get(j).getAsString(); + if(internalname.equals(upgrade)) { + missingInternal.remove(talisman_upgrade_element.getKey()); + break; + } + } + } + } + + missingInternal.sort(getItemComparator()); + + for(String internal : missingInternal) { + missing.add(NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(internal))); + } + } + 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, + new Color(80, 80, 80).getRGB()); + + int yIndex = 0; + for(ItemStack missingStack : missing) { + renderAlignedString(missingStack.getDisplayName(), "", x+5, y+20+11*yIndex, 70); + if(missing.size() > 11) { + if(++yIndex >= 10) break; + } else { + if(++yIndex >= 11) break; + } + } + + if(missing.size() > 11) { + Utils.drawStringCenteredScaledMaxWidth("+" + (missing.size()-10) + " More", + Minecraft.getMinecraft().fontRendererObj, x+40, y+16+121, false, 70, + new Color(80, 80, 80).getRGB()); + } + } + } + + private static boolean forceCC = false; + private static boolean forceAS = false; + private static boolean useGodPot = true; + private sta |
