diff options
| author | efefury <69400149+efefury@users.noreply.github.com> | 2022-09-11 09:31:27 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-11 11:31:27 +0200 |
| commit | 47af0b3eee70a5c8d7c86fff19155a97a9204708 (patch) | |
| tree | d0716683e3dc534ff75e71208650aa3a647ea766 /src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java | |
| parent | d203640d5296bde151596388aa6df332393d0a1c (diff) | |
| download | notenoughupdates-47af0b3eee70a5c8d7c86fff19155a97a9204708.tar.gz notenoughupdates-47af0b3eee70a5c8d7c86fff19155a97a9204708.tar.bz2 notenoughupdates-47af0b3eee70a5c8d7c86fff19155a97a9204708.zip | |
cleaned up neu overlay (#241)
* made equipment overlay own class
lmk if there's any bugs
* fix infer (i think)
* fuck infer
* First refactoringering
* Fix more stuff
* itemlisting
* NEU 3.0 release notes
* fixed nea bug
https://imgur.com/a/Sg3iw74
* whitespace
* fixed equipment overlay
not working ? and caching
* nopoing
idk what im doing
* FHJNX GHD
trwsmokürtsew tze jiozterdgjjiüzetr jipztr
* Revert "FHJNX GHD"
This reverts commit 24eceba3db5e500be296f5a96412bd8b95647a22.
* Revert "nopoing"
This reverts commit bee07cb98f8b9672c2e1bc192c6c3e5ae8b02b95.
* Revert "fixed equipment overlay"
This reverts commit b15376f934a738900e2dd98efdb0d4a7ec131dfa.
* idk i think this works
maybe
* ???
?????????
* no more black lines
* equipment cache
* Fix lag with optifine and removal of unused field.
Removed onMouseClick as it was triggered more than once per tick when optifine is installed.
Removed tooltipsToDisplay field (as it was replaced by a local variable).
* this should be true by default to keep old behaviour
* itemList now doesn't close when clicking the searchbar
itemList will now only close when searchMode is triggered.
* Infer moment
hoping this doesn't trigger it.
Co-authored-by: nea <romangraef@gmail.com>
Co-authored-by: Lulonaut <lulonaut@tutanota.de>
Co-authored-by: Ascynx <78341107+Ascynx@users.noreply.github.com>
Co-authored-by: nopo <noahogno@gmail.com>
Co-authored-by: Ascynx <miaoum2128@gmail.com>
Co-authored-by: Roman / Linnea Gräf <roman.graef@gmail.com>
Co-authored-by: Lorenz <lo.scherf@gmail.com>
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java | 36 |
1 files changed, 22 insertions, 14 deletions
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 90300bbc..f58ced51 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java @@ -26,13 +26,13 @@ import com.google.gson.JsonElement; import com.google.gson.JsonNull; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -import io.github.moulberry.notenoughupdates.NEUOverlay; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.config.Position; import io.github.moulberry.notenoughupdates.core.util.StringUtils; import io.github.moulberry.notenoughupdates.core.util.lerp.LerpUtils; import io.github.moulberry.notenoughupdates.listener.RenderListener; import io.github.moulberry.notenoughupdates.options.NEUConfig; +import io.github.moulberry.notenoughupdates.overlays.EquipmentOverlay; import io.github.moulberry.notenoughupdates.overlays.TextOverlay; import io.github.moulberry.notenoughupdates.overlays.TextOverlayStyle; import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer; @@ -134,6 +134,12 @@ public class PetInfoOverlay extends TextOverlay { public String petXpType; public String petItem; public String skin; + + public String getPetId(boolean withoutBoost) { + return petType + ";" + (withoutBoost ? rarity.petId - 1 : rarity.petId); + + } + } public static class PetConfig { @@ -243,7 +249,8 @@ public class PetInfoOverlay extends TextOverlay { } private static Pet getClosestPet(String petType, int petId, String petItem, float petLevel) { - Set<Pet> pets = config.petMap.values().stream().filter(pet -> pet.petType.equals(petType) && pet.rarity.petId == petId).collect( + Set<Pet> pets = config.petMap.values().stream().filter(pet -> pet.petType.equals(petType) && + pet.rarity.petId == petId).collect( Collectors.toSet()); if (pets.isEmpty()) { @@ -254,7 +261,10 @@ public class PetInfoOverlay extends TextOverlay { return pets.iterator().next(); } - Set<Pet> itemMatches = pets.stream().filter(pet -> Objects.equals(petItem, pet.petItem)).collect(Collectors.toSet()); + Set<Pet> itemMatches = pets + .stream() + .filter(pet -> Objects.equals(petItem, pet.petItem)) + .collect(Collectors.toSet()); if (itemMatches.size() == 1) { return itemMatches.iterator().next(); @@ -452,11 +462,12 @@ public class PetInfoOverlay extends TextOverlay { } } - if (currentPet.petLevel.level < (currentPet.petLevel.maxLevel - 1) || !NotEnoughUpdates.INSTANCE.config.petOverlay.petOverlayText.contains(6)) { + if (currentPet.petLevel.level < (currentPet.petLevel.maxLevel - 1) || + !NotEnoughUpdates.INSTANCE.config.petOverlay.petOverlayText.contains(6)) { float remainingMax = currentPet.petLevel.maxXP - currentPet.petLevel.totalXp; if (remaining > 0) { if (xpGain < 1000) { - etaMaxStr = EnumChatFormatting.AQUA + "Until L" + currentPet.petLevel.maxLevel + ": " + + etaMaxStr = EnumChatFormatting.AQUA + "Until L" + currentPet.petLevel.maxLevel + ": " + EnumChatFormatting.YELLOW + "N/A"; } else { etaMaxStr = EnumChatFormatting.AQUA + "Until L" + currentPet.petLevel.maxLevel + ": " + @@ -563,7 +574,7 @@ public class PetInfoOverlay extends TextOverlay { JsonObject petInfo = new JsonParser().parse(ea.getString("petInfo")).getAsJsonObject(); petType = petInfo.get("type").getAsString(); rarity = Rarity.valueOf(petInfo.get("tier").getAsString()); - level = GuiProfileViewer. getPetLevel( + level = GuiProfileViewer.getPetLevel( petType, rarity.name(), Utils.getElementAsFloat(petInfo.get("exp"), 0) // Should only default if from item list and repo missing exp:0 @@ -782,7 +793,8 @@ public class PetInfoOverlay extends TextOverlay { if (currentPet.rarity.petId == 5) { mythicRarity = 4; } - JsonObject petItem = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(currentPet.skin != null ? currentPet.skin : (currentPet.petType + ";" + mythicRarity)); + JsonObject petItem = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get( + currentPet.skin != null ? currentPet.skin : (currentPet.petType + ";" + mythicRarity)); if (petItem != null) { Vector2f position = getPosition(overlayWidth, overlayHeight); int x = (int) position.x; @@ -799,7 +811,8 @@ public class PetInfoOverlay extends TextOverlay { Pet currentPet2 = getCurrentPet2(); if (currentPet2 != null) { - JsonObject petItem2 = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(currentPet2.skin != null ? currentPet2.skin : (currentPet2.petType + ";" + currentPet2.rarity.petId)); + JsonObject petItem2 = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get( + currentPet2.skin != null ? currentPet2.skin : (currentPet2.petType + ";" + currentPet2.rarity.petId)); if (petItem2 != null) { Vector2f position = getPosition(overlayWidth, overlayHeight); int x = (int) position.x; @@ -1037,12 +1050,7 @@ public class PetInfoOverlay extends TextOverlay { String chatMessage = Utils.cleanColour(event.message.getUnformattedText()); Matcher autopetMatcher = AUTOPET_EQUIP.matcher(event.message.getFormattedText()); - if (event.message.getUnformattedText().startsWith("You summoned your") || - System.currentTimeMillis() - NEUOverlay.cachedPetTimer < 500) { - NEUOverlay.cachedPetTimer = System.currentTimeMillis(); - NEUOverlay.shouldUseCachedPet = false; - } else if (autopetMatcher.matches()) { - NEUOverlay.shouldUseCachedPet = false; + if (autopetMatcher.matches()) { try { lastLevelHovered = Integer.parseInt(autopetMatcher.group(1)); } catch (NumberFormatException ignored) { |
