diff options
author | BuildTools <james.jenour@protonmail.com> | 2021-02-21 23:41:11 +0800 |
---|---|---|
committer | BuildTools <james.jenour@protonmail.com> | 2021-02-21 23:41:11 +0800 |
commit | 9ec720b7bde5e31681fe2f8605aac20560bd8516 (patch) | |
tree | fd9e51deba7425a21d6ef73bd10831b41bc3164f /src/main/java | |
parent | 06cb4d208801e276a0e4d96252c00ae01d9e522d (diff) | |
download | NotEnoughUpdates-9ec720b7bde5e31681fe2f8605aac20560bd8516.tar.gz NotEnoughUpdates-9ec720b7bde5e31681fe2f8605aac20560bd8516.tar.bz2 NotEnoughUpdates-9ec720b7bde5e31681fe2f8605aac20560bd8516.zip |
PRE24.1
Diffstat (limited to 'src/main/java')
7 files changed, 275 insertions, 151 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java index 5a453247..963b91c3 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java @@ -23,6 +23,7 @@ import net.minecraftforge.fml.common.gameevent.TickEvent; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.MutablePair; import org.apache.commons.lang3.tuple.Pair; +import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL30; @@ -47,8 +48,8 @@ public class CapeManager { public JsonObject lastJsonSync = null; private String[] capes = new String[]{"patreon1", "patreon2", "fade", "contrib", "nullzee", - "gravy", "space", "mcworld", "lava", "packshq", "mbstaff", "thebakery", "negative", "void", "ironmoon", "krusty", "furf", "soldier" }; - public Boolean[] specialCapes = new Boolean[]{ true, true, false, true, true, true, false, false, false, true, true, true, false, false, true, false, true, true }; + "gravy", "space", "mcworld", "lava", "packshq", "mbstaff", "thebakery", "negative", "void", "ironmoon", "krusty", "furf", "soldier", "dsm" }; + public Boolean[] specialCapes = new Boolean[]{ true, true, false, true, true, true, false, false, false, true, true, true, false, false, true, false, true, true, true }; public static CapeManager getInstance() { return INSTANCE; @@ -197,7 +198,7 @@ public class CapeManager { } @SubscribeEvent - public void onWorldLoad(WorldEvent.Load event) { + public void onWorldLoad(WorldEvent.Unload event) { if(playerMap != null) playerMap.clear(); } @@ -231,15 +232,11 @@ public class CapeManager { if(playerMap == null) { playerMap = HashBiMap.create(Minecraft.getMinecraft().theWorld.playerEntities.size()); } - HashSet<String> contains = new HashSet<>(); + playerMap.clear(); for(EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) { String uuid = player.getUniqueID().toString().replace("-", ""); - contains.add(uuid); - if(!playerMap.containsValue(player) && !playerMap.containsKey(uuid)) { - playerMap.put(uuid, player); - } + playerMap.put(uuid, player); } - playerMap.keySet().retainAll(contains); } @SubscribeEvent diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java index 3814e2ba..98b8827e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java @@ -345,7 +345,7 @@ public class NEUCape { public void onRenderPlayer(RenderPlayerEvent.Post e) { EntityPlayer player = e.entityPlayer; - if(currentPlayer != null && currentPlayer != player) return; + if(currentPlayer != null && keepCurrentPlayer && currentPlayer != player) return; if(player.getActivePotionEffect(Potion.invisibility) != null) return; if(player.isSpectator() || player.isInvisible()) return; @@ -605,6 +605,20 @@ public class NEUCape { crouchTicks = 0; } + Vector3f avgPosition = avgFixedPosition(); + for(int y=0; y<nodes.size(); y++) { + for(int x=0; x<nodes.get(y).size(); x++) { + CapeNode node = nodes.get(y).get(x); + + Vector3f delta = Vector3f.sub(node.position, avgPosition, null); + + if(delta.lengthSquared() > 5*5) { + Vector3f norm = delta.normalise(null); + node.position = Vector3f.add(avgPosition, norm, null); + } + } + } + oldPlayerAngle = playerAngle; for(int y=0; y<nodes.size(); y++) { @@ -696,6 +710,24 @@ public class NEUCape { return accum; } + private Vector3f avgFixedPosition() { + Vector3f accum = new Vector3f(); + int numFixed = 0; + for(int y=0; y<nodes.size(); y++) { + for(int x=0; x<nodes.get(y).size(); x++) { + CapeNode node = nodes.get(y).get(x); + if(node.fixed) { + Vector3f.add(accum, node.position, accum); + numFixed++; + } + } + } + if(numFixed != 0) { + accum.scale(1f/numFixed); + } + return accum; + } + private void renderCape(EntityPlayer player, float partialRenderTick) { ensureCapeNodesCreated(player); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java index 5c80cf32..bce6da90 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java @@ -219,6 +219,9 @@ public class PetInfoOverlay extends TextOverlay { pet.petLevel = GuiProfileViewer.getPetLevel(petsJson.get("pet_levels").getAsJsonArray(), rarity.petOffset, petObj.get("exp").getAsFloat()); JsonElement heldItem = petObj.get("heldItem"); pet.petItem = heldItem.isJsonNull() ? null : heldItem.getAsString(); + if(rarity != Rarity.MYTHIC && pet.petItem != null && pet.petItem.equals("PET_ITEM_TIER_BOOST")) { + rarity = Rarity.values()[rarity.ordinal()+1]; + } JsonObject petTypes = petsJson.get("pet_types").getAsJsonObject(); pet.petXpType = petTypes.has(pet.petType) ? petTypes.get(pet.petType.toUpperCase()).getAsString().toLowerCase() : "unknown"; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java index 5a04d535..2ff43bd8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -66,14 +66,11 @@ public class NEUConfig extends Config { return; case 4: editOverlay(activeConfigCategory, OverlayManager.petInfoOverlay, petOverlay.petInfoPosition); - /*Minecraft.getMinecraft().displayGuiScreen(new GuiPositionEditor( - NotEnoughUpdates.INSTANCE.config.petOverlay.petInfoPosition, - 150, 22, () -> { - }, () -> { - }, () -> NotEnoughUpdates.INSTANCE.openGui = new GuiScreenElementWrapper( - new NEUConfigEditor(NotEnoughUpdates.INSTANCE.config, activeConfigCategoryF)) - ));*/ return; + case 5: + editOverlay(activeConfigCategory, OverlayManager.timersOverlay, miscOverlays.todoPosition); + return; + } } @@ -128,6 +125,13 @@ public class NEUConfig extends Config { @Expose @Category( + name = "Misc Overlays", + desc = "Misc Overlays" + ) + public MiscOverlays miscOverlays = new MiscOverlays(); + + @Expose + @Category( name = "Dungeons", desc = "Dungeons" ) @@ -965,6 +969,74 @@ public class NEUConfig extends Config { public String dungBatColour = "0:255:12:255:0"; } + public static class MiscOverlays { + @ConfigOption( + name = "Todo Overlay", + desc = "" + ) + @ConfigEditorAccordion(id = 0) + public boolean todoAccordion = false; + + @Expose + @ConfigOption( + name = "Enable Todo Overlay", + desc = "Show an overlay that reminds you to do important tasks" + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean todoOverlay = true; + + @Expose + @ConfigOption( + name = "Todo Text", + desc = "\u00a7eDrag text to change the appearance of the overlay\n" + + "\u00a7rIf you want to see the time until something is available, click \"Add\" and then the respective timer" + ) + @ConfigEditorDraggableList( + exampleText = { + "\u00a73Cakes: \u00a7eInactive!", + "\u00a73Cookie Buff: \u00a7eInactive!", + "\u00a73Godpot: \u00a7eInactive!", + "\u00a73Puzzler: \u00a7eReady!", + "\u00a73Fetchur: \u00a7eReady!", + "\u00a73Commissions: \u00a7eReady!", + "\u00a73Experiments: \u00a7eReady!", + "\u00a73Cakes: \u00a7e1d21h", + "\u00a73Cookie Buff: \u00a7e2d23h", + "\u00a73Godpot: \u00a7e19h", + "\u00a73Puzzler: \u00a7e13h", + "\u00a73Fetchur: \u00a7e3h38m", + "\u00a73Commissions: \u00a7e3h38m", + "\u00a73Experiments: \u00a7e3h38m"} + ) + @ConfigAccordionId(id = 0) + public List<Integer> todoText = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6)); + + @Expose + @ConfigOption( + name = "Todo Position", + desc = "Change the position of the Todo overlay" + ) + @ConfigEditorButton( + runnableId = 5, + buttonText = "Edit" + ) + @ConfigAccordionId(id = 0) + public Position todoPosition = new Position(100, 0); + + + @Expose + @ConfigOption( + name = "Todo Style", + desc = "Change the style of the todo overlay" + ) + @ConfigEditorDropdown( + values = {"Background", "No Shadow", "Shadow", "Full Shadow"} + ) + @ConfigAccordionId(id = 0) + public int todoStyle = 0; + } + public static class EnchSolvers { @Expose @ConfigOption( @@ -1501,13 +1573,13 @@ public class NEUConfig extends Config { } public static class HiddenProfileSpecific { - @Expose public long godPotionDrunk = 0; - @Expose public long puzzlerCompleted = 0; - @Expose public long firstCakeAte = 0; - @Expose public long fetchurCompleted = 0; - @Expose public long commissionsCompleted = 0; - @Expose public long experimentsCompleted = 0; - @Expose public long cookieBuffRemaining = 0; + @Expose public long godPotionDrunk = 0L; + @Expose public long puzzlerCompleted = 0L; + @Expose public long firstCakeAte = 0L; + @Expose public long fetchurCompleted = 0L; + @Expose public long commissionsCompleted = 0L; + @Expose public long experimentsCompleted = 0L; + @Expose public long cookieBuffRemaining = 0L; @Expose public int commissionMilestone = 0; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java index e5f7b2a8..64b27351 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java @@ -19,8 +19,29 @@ public class OverlayManager { public static final List<TextOverlay> textOverlays = new ArrayList<>(); static { - textOverlays.add(timersOverlay = new TimersOverlay(new Position(50, 100), ArrayList::new, () -> { - int style = NotEnoughUpdates.INSTANCE.config.mining.overlayStyle; + List<String> todoDummy = Lists.newArrayList( + "\u00a73Cakes: \u00a7eInactive!", + "\u00a73Cookie Buff: \u00a7eInactive!", + "\u00a73Godpot: \u00a7eInactive!", + "\u00a73Puzzler: \u00a7eReady!", + "\u00a73Fetchur: \u00a7eReady!", + "\u00a73Commissions: \u00a7eReady!", + "\u00a73Experiments: \u00a7eReady!", + "\u00a73Cakes: \u00a7e1d21h", + "\u00a73Cookie Buff: \u00a7e2d23h", + "\u00a73Godpot: \u00a7e19h", + "\u00a73Puzzler: \u00a7e13h", + "\u00a73Fetchur: \u00a7e3h38m", + "\u00a73Commissions: \u00a7e3h38m", + "\u00a73Experiments: \u00a7e3h38m"); + textOverlays.add(timersOverlay = new TimersOverlay(NotEnoughUpdates.INSTANCE.config.miscOverlays.todoPosition, () -> { + List<String> strings = new ArrayList<>(); + for(int i : NotEnoughUpdates.INSTANCE.config.miscOverlays.todoText) { + if(i >= 0 && i < todoDummy.size()) strings.add(todoDummy.get(i)); + } + return strings; + }, () -> { + int style = NotEnoughUpdates.INSTANCE.config.miscOverlays.todoStyle; if(style >= 0 && style < TextOverlayStyle.values().length) { return TextOverlayStyle.values()[style]; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TextOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TextOverlay.java index 55500f91..f46dd945 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TextOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TextOverlay.java @@ -108,6 +108,8 @@ public abstract class TextOverlay { return new Vector2f(x, y); } + protected void renderLine(String line, Vector2f position) {} + private void render(List<String> strings) { if(strings == null) return; @@ -144,20 +146,26 @@ public abstract class TextOverlay { yOff += 3; } else { for(String s2 : s.split("\n")) { + Vector2f pos = new Vector2f(x+paddingX, y+paddingY+yOff); + renderLine(s2, pos); + + int xPad = (int)pos.x; + int yPad = (int)pos.y; + if(style == TextOverlayStyle.FULL_SHADOW) { String clean = Utils.cleanColourNotModifiers(s2); for(int xO=-2; xO<=2; xO++) { for(int yO=-2; yO<=2; yO++) { if(Math.abs(xO) != Math.abs(yO)) { Minecraft.getMinecraft().fontRendererObj.drawString(clean, - x+paddingX+xO/2f, y+paddingY+yOff+yO/2f, + xPad+xO/2f, yPad+yO/2f, new Color(0, 0, 0, 200/Math.max(Math.abs(xO), Math.abs(yO))).getRGB(), false); } } } } Minecraft.getMinecraft().fontRendererObj.drawString(s2, - x+paddingX, y+paddingY+yOff, 0xffffff, style == TextOverlayStyle.MC_SHADOW); + xPad, yPad, 0xffffff, style == TextOverlayStyle.MC_SHADOW); yOff += 10; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java index a2a1817f..49d992b9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java @@ -10,6 +10,8 @@ import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.IInventory; @@ -21,6 +23,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import org.lwjgl.util.vector.Vector2f; import java.util.*; import java.util.function.Supplier; @@ -31,6 +34,8 @@ import static net.minecraft.util.EnumChatFormatting.*; public class TimersOverlay extends TextOverlay { + private static final Pattern PATTERN_ACTIVE_EFFECTS = Pattern.compile("\u00a77You have \u00a7r\u00a7e(\\d+) \u00a7r\u00a77active effects."); + public TimersOverlay(Position position, Supplier<List<String>> dummyStrings, Supplier<TextOverlayStyle> styleSupplier) { super(position, dummyStrings, styleSupplier); } @@ -84,7 +89,71 @@ public class TimersOverlay extends TextOverlay { } } - private static final Pattern PATTERN_ACTIVE_EFFECTS = Pattern.compile("\u00a77You have \u00a7r\u00a7e(\\d+) \u00a7r\u00a77active effects."); + @Override + protected Vector2f getSize(List<String> strings) { + return super.getSize(strings).translate(12, 0); + } + + private static final ItemStack CAKES_ICON = new ItemStack(Items.cake); + private static final ItemStack PUZZLER_ICON = new ItemStack(Items.book); + private static ItemStack[] FETCHUR_ICONS = null; + private static final ItemStack COMMISSIONS_ICON = new ItemStack(Items.iron_pickaxe); + private static final ItemStack EXPERIMENTS_ICON = new ItemStack(Items.enchanted_book); + private static final ItemStack COOKIE_ICON = new ItemStack(Items.cookie); + + @Override + protected void renderLine(String line, Vector2f position) { + ItemStack icon = null; + + String clean = Utils.cleanColour(line); + String beforeColon = clean.split(":")[0]; + switch(beforeColon) { + case "Cakes": icon = CAKES_ICON; break; + case "Puzzler": icon = PUZZLER_ICON; break; + case "Godpot": icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("GOD_POTION")); break; + case "Fetchur": { + if(FETCHUR_ICONS == null) { + FETCHUR_ICONS = new ItemStack[] { + new ItemStack(Blocks.wool, 50, 14), + new ItemStack(Blocks.glass, 20, 4), + new ItemStack(Items.compass, 1, 0), + new ItemStack(Items.prismarine_crystals, 20, 0), + new ItemStack(Items.fireworks, 1, 0), + NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("CHEAP_COFFEE")), + new ItemStack(Items.oak_door, 1, 0), + new ItemStack(Items.rabbit_foot, 3, 0), + NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("SUPERBOOM_TNT")), + new ItemStack(Blocks.pumpkin, 1, 0), + new ItemStack(Items.flint_and_steel, 1, 0), + new ItemStack(Blocks.quartz_ore, 50, 0), + new ItemStack(Items.ender_pearl, 16, 0) + }; + } + long currentTime = System.currentTimeMillis(); + + long fetchurIndex = (currentTime-18000000)/86400000 % 13 - 4; + if(fetchurIndex < 0) fetchurIndex += 13; + + icon = FETCHUR_ICONS[(int)fetchurIndex]; + break; + } + case "Commissions": icon = COMMISSIONS_ICON; break; + case "Experiments": icon = EXPERIMENTS_ICON; break; + case "Cookie Buff": icon = COOKIE_ICON; break; + } + + if(icon != null) { + GlStateManager.pushMatrix(); + GlStateManager.translate(position.x, position.y, 0); + GlStateManager.scale(0.5f, 0.5f, 1f); + Utils.drawItemStack(icon, 0, 0); + GlStateManager.popMatrix(); + + position.x += 12; + } + + super.renderLine(line, position); + } @Override public void update() { @@ -130,7 +199,7 @@ public class TimersOverlay extends TextOverlay { } boolean foundCookieBuffText = false; - if(SBInfo.getInstance().footer != null) { + if(SBInfo.getInstance().getLocation() != null && !SBInfo.getInstance().getLocation().equals("dungeon") && SBInfo.getInstance().footer != null) { String formatted = SBInfo.getInstance().footer.getFormattedText(); for(String line : formatted.split("\n")) { Matcher activeEffectsMatcher = PATTERN_ACTIVE_EFFECTS.matcher(line); @@ -159,7 +228,7 @@ public class TimersOverlay extends TextOverlay { } if("ydhms".contains(""+c)) { try { - int val = Integer.parseInt(number.toString()); + long val = Integer.parseInt(number.toString()); switch(c) { case 'y': hidden.cookieBuffRemaining += val*365*24*60*60*1000; break; case 'd': hidden.cookieBuffRemaining += val*24*60*60*1000; break; @@ -185,154 +254,76 @@ public class TimersOverlay extends TextOverlay { } } - overlayStrings = new ArrayList<>(); + if(!NotEnoughUpdates.INSTANCE.config.miscOverlays.todoOverlay) { + overlayStrings = null; + return; + } + + HashMap<Integer, String> map = new HashMap<>(); long cakeEnd = hidden.firstCakeAte + 1000*60*60*48 - currentTime; if(cakeEnd < 0) { - overlayStrings.add(DARK_AQUA+"Cakes: "+YELLOW+"Ready!"); + map.put(0, DARK_AQUA+"Cakes: "+YELLOW+"Inactive!"); + map.put(0+7, DARK_AQUA+"Cakes: "+YELLOW+"Inactive!"); } else { - overlayStrings.add(DARK_AQUA+"Cakes: "+YELLOW+Utils.prettyTime(cakeEnd)); + map.put(0+7, DARK_AQUA+"Cakes: "+YELLOW+Utils.prettyTime(cakeEnd)); } - long puzzlerEnd = hidden.puzzlerCompleted + 1000*60*60*24 - currentTime; - if(puzzlerEnd < 0) { - overlayStrings.add(DARK_AQUA+"Puzzler: "+YELLOW+"Ready!"); + if(hidden.cookieBuffRemaining <= 0) { + map.put(1, DARK_AQUA+"Cookie Buff: "+YELLOW+"Inactive!"); + map.put(1+7, DARK_AQUA+"Cookie Buff: "+YELLOW+"Inactive!"); } else { - overlayStrings.add(DARK_AQUA+"Puzzler: "+YELLOW+Utils.prettyTime(puzzlerEnd)); + map.put(1+7, DARK_AQUA+"Cookie Buff: "+YELLOW+Utils.prettyTime(hidden.cookieBuffRemaining)); } - if(!hideGodpot) { - long godpotEnd = hidden.godPotionDrunk + 1000*60*60*24 - currentTime; - if(godpotEnd < 0) { - overlayStrings.add(DARK_AQUA+"Godpot: "+YELLOW+"Inactive!"); - } else { - overlayStrings.add(DARK_AQUA+"Godpot: "+YELLOW+Utils.prettyTime(puzzlerEnd)); + long godpotEnd = hidden.godPotionDrunk + 1000*60*60*24 - currentTime; + if(godpotEnd < 0) { + if(!hideGodpot) { + map.put(2, DARK_AQUA+"Godpot: "+YELLOW+"Inactive!"); + map.put(2+7, DARK_AQUA+"Godpot: "+YELLOW+"Inactive!"); } + } else { + map.put(2+7, DARK_AQUA+"Godpot: "+YELLOW+Utils.prettyTime(godpotEnd)); + } + + long puzzlerEnd = hidden.puzzlerCompleted + 1000*60*60*24 - currentTime; + if(puzzlerEnd < 0) { + map.put(3, DARK_AQUA+"Puzzler: "+YELLOW+"Ready!"); + map.put(3+7, DARK_AQUA+"Puzzler: "+YELLOW+"Ready!"); + } else { + map.put(3+7, DARK_AQUA+"Puzzler: "+YELLOW+Utils.prettyTime(puzzlerEnd)); } long midnightReset = (currentTime-18000000)/86400000*86400000+18000000; long fetchurComplete = hidden.fetchurCompleted; if(fetchurComplete < midnightReset) { - overlayStrings.add(DARK_AQUA+"Fetchur: "+YELLOW+"Ready!"); + map.put(4, DARK_AQUA+"Fetchur: "+YELLOW+"Ready!"); + map.put(4+7, DARK_AQUA+"Fetchur: "+YELLOW+"Ready!"); } else { - overlayStrings.add(DARK_AQUA+"Fetchur: "+YELLOW+Utils.prettyTime(midnightReset + 86400000 - currentTime)); + map.put(4+7, DARK_AQUA+"Fetchur: "+YELLOW+Utils.prettyTime(midnightReset + 86400000 - currentTime)); } if(hidden.commissionsCompleted < midnightReset) { - overlayStrings.add(DARK_AQUA+"Commissions: "+YELLOW+"Ready!"); + map.put(5, DARK_AQUA+"Commissions: "+YELLOW+"Ready!"); + map.put(5+7, DARK_AQUA+"Commissions: "+YELLOW+"Ready!"); } else { - overlayStrings.add(DARK_AQUA+"Commissions: "+YELLOW+Utils.prettyTime(midnightReset + 86400000 - currentTime)); + map.put(5+7, DARK_AQUA+"Commissions: "+YELLOW+Utils.prettyTime(midnightReset + 86400000 - currentTime)); } if(hidden.experimentsCompleted < midnightReset) { - overlayStrings.add(DARK_AQUA+"Experiments: "+YELLOW+"Ready!"); + map.put(6, DARK_AQUA+"Experiments: "+YELLOW+"Ready!"); + map.put(6+7, DARK_AQUA+"Experiments: "+YELLOW+"Ready!"); } else { - overlayStrings.add(DARK_AQUA+"Experiments: "+YELLOW+Utils.prettyTime(midnightReset + 86400000 - currentTime)); + map.put(6+7, DARK_AQUA+"Experiments: "+YELLOW+Utils.prettyTime(midnightReset + 86400000 - currentTime)); } - if(hidden.cookieBuffRemaining <= 0) { - overlayStrings.add(DARK_AQUA+"Cookie Buff: "+YELLOW+"Inactive!"); - } else { - overlayStrings.add(DARK_AQUA+"Cookie Buff: "+YELLOW+Utils.prettyTime(hidden.cookieBuffRemaining)); - } - - /*List<NetworkPlayerInfo> players = playerOrdering.sortedCopy(Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()); - Minecraft.getMinecraft().thePlayer.sendQueue. - for(NetworkPlayerInfo info : players) { - String name = Minecraft.getMinecraft().ingameGUI.getTabList().getPlayerName(info); - if(name.contains("Mithril Powder:")) { - mithrilPowder = DARK_AQUA+Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", ""); - } - if(name.equals(RESET.toString()+BLUE+BOLD+"Forges"+RESET)) { - commissions = false; - forges = true; - continue; - } else if(name.equals(RESET.toString()+BLUE+BOLD+"Commissions"+RESET)) { - commissions = true; - forges = false; - continue; - } - String clean = StringUtils.cleanColour(name); - if(forges && clean.startsWith(" ")) { - char firstChar = clean.trim().charAt(0); - if(firstChar < '0' || firstChar > '9') { - forges = false; - } else { - if(name.contains("LOCKED")) continue; - if(name.contains("EMPTY")) { - forgeStringsEmpty.add(DARK_AQUA+"Forge "+ Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", "")); - } else { - forgeStrings.add(DARK_AQUA+"Forge "+ Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", "")); - } - } - } else if(commissions && clean.startsWith(" ")) { - String[] split = clean.trim().split(": "); - if(split.length == 2) { - if(split[1].endsWith("%")) { - try { - float progress = Float.parseFloat(split[1].replace("%", ""))/100; - progress = LerpUtils.clampZeroOne(progress); - commissionProgress.put(split[0], progress); - } catch(Exception ignored) {} - } else { - commissionProgress.put(split[0], 1.0f); - } - } - } else { - commissions = false; - forges = false; - } - }*/ - - /*boolean hasAny = false; - if(NotEnoughUpdates.INSTANCE.config.mining.dwarvenOverlay) { - overlayStrings.addAll(commissionsStrings); - hasAny = true; - } - if(NotEnoughUpdates.INSTANCE.config.mining.powderOverlay) { - if(mithrilPowder != null) { - if(hasAny) overlayStrings.add(null); - overlayStrings.add(DARK_AQUA+mithrilPowder); - hasAny = true; - } - } - if(NotEnoughUpdates.INSTANCE.config.mining.forgeOverlay) { - if(hasAny) overlayStrings.add(null); - overlayStrings.addAll(forgeStrings); - }*/ - - /*for(int index : NotEnoughUpdates.INSTANCE.config.mining.dwarvenText) { - switch(index) { - case 0: - overlayStrings.addAll(commissionsStrings); break; - case 1: - overlayStrings.add(mithrilPowder); break; - case 2: - overlayStrings.addAll(forgeStrings); break; - case 3: - overlayStrings.addAll(forgeStringsEmpty); break; + overlayStrings = new ArrayList<>(); + for(int index : NotEnoughUpdates.INSTANCE.config.miscOverlays.todoText) { + if(map.containsKey(index)) { + overlayStrings.add(map.get(index)); } } - - if(overlayStrings.isEmpty()) overlayStrings = null;*/ + if(overlayStrings.isEmpty()) overlayStrings = null; } - private static final Ordering<NetworkPlayerInfo> playerOrdering = Ordering.from(new PlayerComparator()); - - @SideOnly(Side.CLIENT) - static class PlayerComparator implements Comparator<NetworkPlayerInfo> { - private PlayerComparator() { } - - public int compare(NetworkPlayerInfo o1, NetworkPlayerInfo o2) { - ScorePlayerTeam team1 = o1.getPlayerTeam(); - ScorePlayerTeam team2 = o2.getPlayerTeam(); - return ComparisonChain.start().compareTrueFirst( - o1.getGameType() != WorldSettings.GameType.SPECTATOR, - o2.getGameType() != WorldSettings.GameType.SPECTATOR) - .compare(team1 != null ? team1.getRegisteredName() : "", team2 != null ? team2.getRegisteredName() : "") - .compare(o1.getGameProfile().getName(), o2.getGameProfile().getName()).result(); - } - } - - } |