diff options
Diffstat (limited to 'src')
3 files changed, 35 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/mob/MobData.kt b/src/main/java/at/hannibal2/skyhanni/data/mob/MobData.kt index b8da58d41..acd8cad6c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/mob/MobData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/mob/MobData.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.data.mob import at.hannibal2.skyhanni.events.MobEvent +import at.hannibal2.skyhanni.utils.CollectionUtils.takeIfAllNotNull import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.getLorenzVec import net.minecraft.entity.EntityLivingBase @@ -56,6 +57,11 @@ class MobData { this?.let { armor -> mob.invoke(armor)?.let { found(it) } ?: somethingWentWrong } ?: notYetFound + + fun List<EntityArmorStand?>.makeMobResult(mob: (List<EntityArmorStand>) -> Mob?) = + this.takeIfAllNotNull()?.let { armor -> + mob.invoke(armor)?.let { found(it) } ?: somethingWentWrong + } ?: notYetFound } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/mob/MobFilter.kt b/src/main/java/at/hannibal2/skyhanni/data/mob/MobFilter.kt index be67bb6c4..44b54a913 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/mob/MobFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/mob/MobFilter.kt @@ -58,18 +58,19 @@ object MobFilter { private val repoGroup = RepoPattern.group("mob.detection") + /** REGEX-TEST: Wither Husk 500M❤ */ val mobNameFilter by repoGroup.pattern( "filter.basic", - "(?:\\[\\w+(?<level>\\d+)\\] )?(?<corrupted>.Corrupted )?(?<name>.*) [\\d❤]+" + "(?:\\[\\w+(?<level>\\d+)\\] )?(?<corrupted>.Corrupted )?(?<name>[^ᛤ]*)(?: ᛤ)? [\\dBMk.,❤]+" ) val slayerNameFilter by repoGroup.pattern("filter.slayer", "^. (?<name>.*) (?<tier>[IV]+) \\d+.*") val bossMobNameFilter by repoGroup.pattern( "filter.boss", - "^. (?:\\[\\w+(?<level>\\d+)\\] )?(?<name>.*) (?:[\\d\\/Mk.,❤]+|█+) .$" + "^. (?:\\[\\w+(?<level>\\d+)\\] )?(?<name>[^ᛤ]*)(?: ᛤ)? (?:[\\d\\/BMk.,❤]+|█+) .$" ) val dungeonNameFilter by repoGroup.pattern( "filter.dungeon", - "^(?:(?<star>✯)\\s)?(?:(?<attribute>${DungeonAttribute.toRegexLine})\\s)?(?:\\[[\\w\\d]+\\]\\s)?(?<name>.+)\\s[^\\s]+$" + "^(?:(?<star>✯)\\s)?(?:(?<attribute>${DungeonAttribute.toRegexLine})\\s)?(?:\\[[\\w\\d]+\\]\\s)?(?<name>[^ᛤ]+)(?: ᛤ)?\\s[^\\s]+$" ) val summonFilter by repoGroup.pattern("filter.summon", "^(?<owner>\\w+)'s (?<name>.*) \\d+.*") val dojoFilter by repoGroup.pattern("filter.dojo", "^(?:(?<points>\\d+) pts|(?<empty>\\w+))$") @@ -82,7 +83,7 @@ object MobFilter { val wokeSleepingGolemPattern by repoGroup.pattern("pattern.dungeon.woke.golem", "(?:§c§lWoke|§5§lSleeping) Golem§r") val jerryMagmaCubePattern by repoGroup.pattern( "pattern.jerry.magma.cube", - "§c(?:Cubie|Maggie|Cubert|Cübe|Cubette|Magmalene|Lucky 7|8ball|Mega Cube|Super Cube) §a\\d+§8\\/§a\\d+§c❤" + "§c(?:Cubie|Maggie|Cubert|Cübe|Cubette|Magmalene|Lucky 7|8ball|Mega Cube|Super Cube)(?: ᛤ)? §a\\d+§8\\/§a\\d+§c❤" ) val summonOwnerPattern by repoGroup.pattern("pattern.summon.owner", ".*Spawned by: (?<name>.*).*") @@ -209,7 +210,15 @@ object MobFilter { baseEntity is EntityBat -> createBat(baseEntity) baseEntity.isFarmMob() -> createFarmMobs(baseEntity)?.let { MobResult.found(it) } - baseEntity is EntityDragon -> MobResult.found(MobFactories.basic(baseEntity, baseEntity.cleanName())) + baseEntity is EntityDragon -> when (LorenzUtils.skyBlockIsland) { + IslandType.CATACOMBS -> (8..16).map { MobUtils.getArmorStand(baseEntity, it) } + .makeMobResult { + MobFactories.boss(baseEntity, it.first(), it.drop(1)) + } + + else -> MobResult.found(MobFactories.basic(baseEntity, baseEntity.cleanName())) + } + baseEntity is EntityGiantZombie && baseEntity.name == "Dinnerbone" -> MobResult.found( MobFactories.projectile( baseEntity, @@ -229,6 +238,13 @@ object MobFilter { ) ) + baseEntity is EntityOtherPlayerMP && baseEntity.name == "Decoy " -> MobResult.found( + MobFactories.special( + baseEntity, + "Decoy" + ) + ) + else -> null } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt index d37ddad09..a9f5ec6c1 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/CollectionUtils.kt @@ -163,4 +163,12 @@ object CollectionUtils { this.add(newValue) true } else false + + @Suppress("UNCHECKED_CAST") + fun <T> Iterable<T?>.takeIfAllNotNull(): Iterable<T>? = + takeIf { null !in this } as? Iterable<T> + + @Suppress("UNCHECKED_CAST") + fun <T> List<T?>.takeIfAllNotNull(): List<T>? = + takeIf { null !in this } as? List<T> } |