diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt | 13 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt | 23 |
2 files changed, 23 insertions, 13 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt index 69a5a0548..35831f55c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt @@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.withAlpha import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled +import at.hannibal2.skyhanni.test.command.CopyErrorCommand import at.hannibal2.skyhanni.utils.* import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText @@ -50,9 +51,15 @@ class TrevorFeatures { init { fixedRateTimer(name = "skyhanni-update-trapper", period = 1000L) { - if (onFarmingIsland()) { - updateTrapper() - TrevorSolver.findMob() + try { + if (onFarmingIsland()) { + updateTrapper() + TrevorSolver.findMob() + } + } catch (error: Throwable) { + CopyErrorCommand.errorMessage = error.toString() + CopyErrorCommand.errorStackTrace = error.stackTrace.asList() + LorenzUtils.chat("§c[SkyHanni] encountered an error when updating the trapper solver, please run /shcopyerror") } } } 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 3d6c91417..46b367e7d 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 @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.toLorenzVec import net.minecraft.client.Minecraft +import net.minecraft.client.entity.EntityOtherPlayerMP import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.item.EntityArmorStand @@ -42,33 +43,35 @@ object TrevorSolver { val world = Minecraft.getMinecraft().theWorld ?: return for (entity in world.getLoadedEntityList()) { val name = entity.name - // looking at 2 diff entities rn + if (entity is EntityOtherPlayerMP) continue + // looking at 2 diff entities rn - Mostly fixed I think as it returns val entityHealth = if (entity is EntityLivingBase) entity.baseMaxHealth else 0 if (intArrayOf(100, 500, 1000, 5000, 10000).any { it == entityHealth }) { if (animalNames.any { it == name }) { if (LocationUtils.canSee(LocationUtils.playerLocation(), entity.position.toLorenzVec())) { - if (entity.isInvisibleToPlayer(Minecraft.getMinecraft().thePlayer)) return - - if (foundID == entity.entityId) { - mobLocation = CurrentMobArea.FOUND - mobCoordinates = entity.position.toLorenzVec() - } else { - foundID = entity.entityId + if (!entity.isInvisibleToPlayer(Minecraft.getMinecraft().thePlayer)) { + if (foundID == entity.entityId) { + mobLocation = CurrentMobArea.FOUND + mobCoordinates = entity.position.toLorenzVec() + } else { + foundID = entity.entityId + } + return } - return } } } if (entity is EntityArmorStand) { for (animal in animalNames) { - if (name.contains(animal)) { + if (name.contains(animal) && name.contains("§c❤")) { if (foundID == entity.entityId) { mobLocation = CurrentMobArea.FOUND mobCoordinates = entity.position.toLorenzVec() } else { foundID = entity.entityId } + return } } } |