diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-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 |