diff options
author | awes12 <48301725+awes12@users.noreply.github.com> | 2024-05-24 17:40:31 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-24 16:40:31 +0200 |
commit | 071d36051c937b0ca82d3e3aeee8f212db1e2ef6 (patch) | |
tree | 26d5d5c1b494aa7c5bf4f05174a32118479b3dd4 | |
parent | 190e9ca2e4b64de7e1b19086a7bcb457b46eb5dc (diff) | |
download | skyhanni-071d36051c937b0ca82d3e3aeee8f212db1e2ef6.tar.gz skyhanni-071d36051c937b0ca82d3e3aeee8f212db1e2ef6.tar.bz2 skyhanni-071d36051c937b0ca82d3e3aeee8f212db1e2ef6.zip |
Improvement: Added a way to detect sheep and rabbits in the oasis. (#1812)
Co-authored-by: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com>
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt index 36f7d595b..2188cb174 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt @@ -1,5 +1,7 @@ package at.hannibal2.skyhanni.features.misc.trevor +import at.hannibal2.skyhanni.data.mob.Mob +import at.hannibal2.skyhanni.data.mob.MobData import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.EntityUtils.canBeSeen import at.hannibal2.skyhanni.utils.LocationUtils @@ -47,19 +49,19 @@ object TrevorSolver { } fun findMob() { - var canSee = false Minecraft.getMinecraft().theWorld ?: return for (entity in EntityUtils.getAllEntities()) { if (entity is EntityOtherPlayerMP) continue val name = entity.name + val isTrevor = MobData.entityToMob[entity]?.let { it.name != name && isTrevorMob(it) } ?: false val entityHealth = if (entity is EntityLivingBase) entity.baseMaxHealth.derpy() else 0 currentMob = TrevorMob.entries.firstOrNull { it.mobName.contains(name) } - if (animalHealths.any { it == entityHealth } && currentMob != null) { + if ((animalHealths.any { it == entityHealth } && currentMob != null) || isTrevor) { if (foundID == entity.entityId) { val dist = entity.position.toLorenzVec().distanceToPlayer() - if ((currentMob == TrevorMob.RABBIT || currentMob == TrevorMob.SHEEP) && mobLocation == TrapperMobArea.OASIS) return - - canSee = entity.canBeSeen() && dist < currentMob!!.renderDistance + val isOasisMob = currentMob == TrevorMob.RABBIT || currentMob == TrevorMob.SHEEP + if (isOasisMob && mobLocation == TrapperMobArea.OASIS && !isTrevor) return + val canSee = entity.canBeSeen() && dist < currentMob!!.renderDistance if (canSee) { if (mobLocation != TrapperMobArea.FOUND) { LorenzUtils.sendTitle("ยง2Saw ${currentMob!!.mobName}!", 3.seconds) @@ -79,6 +81,9 @@ object TrevorSolver { } } + private fun isTrevorMob(mob: Mob): Boolean = + TrevorTracker.TrapperMobRarity.entries.any { mob.name.startsWith(it.formattedName + " ", ignoreCase = true) } + fun resetLocation() { maxHeight = 0.0 minHeight = 0.0 |