diff options
author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2023-05-10 17:42:26 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-10 09:42:26 +0200 |
commit | b7b4c4bde154e6177d03367024a6537133841309 (patch) | |
tree | d8a6f03816501674971b9e49c76ae10a42c17d21 /src/main/java/at/hannibal2/skyhanni/features/misc | |
parent | e5d9561f8cdedff4c29a5b6153997a10ceaae921 (diff) | |
download | skyhanni-b7b4c4bde154e6177d03367024a6537133841309.tar.gz skyhanni-b7b4c4bde154e6177d03367024a6537133841309.tar.bz2 skyhanni-b7b4c4bde154e6177d03367024a6537133841309.zip |
Fix features and copy error (#97)
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 } } } |