diff options
| author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-06-13 22:21:50 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-13 22:21:50 +0200 |
| commit | 529639fdd0683066eadffe93473a300a2177c008 (patch) | |
| tree | d89cd9aa2c04b4a8a839b9c3b1a56d2058fa7956 /src/main/java/at/hannibal2/skyhanni/features/summonings | |
| parent | 151865bca064421d48ec19279b759134fc428443 (diff) | |
| download | skyhanni-529639fdd0683066eadffe93473a300a2177c008.tar.gz skyhanni-529639fdd0683066eadffe93473a300a2177c008.tar.bz2 skyhanni-529639fdd0683066eadffe93473a300a2177c008.zip | |
Backend: for each (#1725)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/summonings')
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt index 8bea95eb4..8194e7b6d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt @@ -98,33 +98,32 @@ object SummoningMobManager { } if (searchArmorStands) { - EntityUtils.getEntities<EntityArmorStand>().filter { it !in summoningMobNametags } - .forEach { - val name = it.displayName.unformattedText - healthPattern.matchMatcher(name) { - val playerName = LorenzUtils.getPlayerName() - if (name.contains(playerName)) { - summoningMobNametags.add(it) - if (summoningMobNametags.size == summoningsSpawned) { - searchArmorStands = false - } + for (it in EntityUtils.getEntities<EntityArmorStand>().filter { it !in summoningMobNametags }) { + val name = it.displayName.unformattedText + healthPattern.matchMatcher(name) { + val playerName = LorenzUtils.getPlayerName() + if (name.contains(playerName)) { + summoningMobNametags.add(it) + if (summoningMobNametags.size == summoningsSpawned) { + searchArmorStands = false } } } + } } - if (searchMobs) { - val playerLocation = LocationUtils.playerLocation() - EntityUtils.getEntities<EntityLiving>().filter { - it !in summoningMobs.keys && it.getLorenzVec() - .distance(playerLocation) < 10 && it.ticksExisted < 2 - }.forEach { - summoningMobs[it] = SummoningMob(System.currentTimeMillis(), name = "Mob") - it.setColor(LorenzColor.GREEN) - updateData() - if (summoningMobs.size == summoningsSpawned) { - searchMobs = false - } + if (!searchMobs) return + val playerLocation = LocationUtils.playerLocation() + val list = EntityUtils.getEntities<EntityLiving>().filter { + it !in summoningMobs.keys && it.getLorenzVec() + .distance(playerLocation) < 10 && it.ticksExisted < 2 + } + for (entity in list) { + summoningMobs[entity] = SummoningMob(System.currentTimeMillis(), name = "Mob") + entity.setColor(LorenzColor.GREEN) + updateData() + if (summoningMobs.size == summoningsSpawned) { + searchMobs = false } } } |
