diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/slayer')
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt | 18 | ||||
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt | 11 |
2 files changed, 10 insertions, 19 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt index 87bccc642..a60d1e51a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt @@ -12,6 +12,7 @@ import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled import at.hannibal2.skyhanni.utils.EntityUtils +import at.hannibal2.skyhanni.utils.EntityUtils.canBeSeen import at.hannibal2.skyhanni.utils.EntityUtils.getAllNameTagsInRadiusWith import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture import at.hannibal2.skyhanni.utils.EntityUtils.isNPC @@ -29,7 +30,6 @@ import at.hannibal2.skyhanni.utils.RenderUtils.exactLocation import at.hannibal2.skyhanni.utils.RenderUtils.exactPlayerEyeLocation import at.hannibal2.skyhanni.utils.SoundUtils import at.hannibal2.skyhanni.utils.SoundUtils.playSound -import at.hannibal2.skyhanni.utils.getLorenzVec import at.hannibal2.skyhanni.utils.toLorenzVec import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers @@ -267,11 +267,7 @@ object VampireSlayerFeatures { fun pre(event: RenderLivingEvent.Pre<EntityOtherPlayerMP>) { if (!isEnabled()) return if (!config.seeThrough) return - if (entityList.contains(event.entity) && LocationUtils.canSee( - LocationUtils.playerEyeLocation(), - event.entity.getLorenzVec() - ) - ) { + if (entityList.contains(event.entity) && event.entity.canBeSeen()) { GlStateManager.disableDepth() } } @@ -280,11 +276,7 @@ object VampireSlayerFeatures { fun pre(event: RenderLivingEvent.Post<EntityOtherPlayerMP>) { if (!isEnabled()) return if (!config.seeThrough) return - if (entityList.contains(event.entity) && LocationUtils.canSee( - LocationUtils.playerEyeLocation(), - event.entity.getLorenzVec() - ) - ) { + if (entityList.contains(event.entity) && event.entity.canBeSeen()) { GlStateManager.enableDepth() } } @@ -364,7 +356,6 @@ object VampireSlayerFeatures { } } - @SubscribeEvent fun onWorldChange(event: LorenzWorldChangeEvent) { entityList.clear() @@ -372,7 +363,6 @@ object VampireSlayerFeatures { standList = mutableMapOf() } - @SubscribeEvent fun onParticle(event: ReceiveParticleEvent) { if (!isEnabled()) return @@ -389,4 +379,4 @@ object VampireSlayerFeatures { } fun isEnabled() = RiftAPI.inRift() && RiftAPI.inStillgoreChateau() -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt index d36a7be57..ae76d4c9b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt @@ -11,10 +11,11 @@ import at.hannibal2.skyhanni.events.RenderMobColoredEvent import at.hannibal2.skyhanni.events.ServerBlockChangeEvent import at.hannibal2.skyhanni.events.withAlpha import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled +import at.hannibal2.skyhanni.utils.EntityUtils.canBeSeen import at.hannibal2.skyhanni.utils.EntityUtils.getBlockInHand import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture import at.hannibal2.skyhanni.utils.ItemUtils.name -import at.hannibal2.skyhanni.utils.LocationUtils +import at.hannibal2.skyhanni.utils.LocationUtils.canBeSeen import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzLogger @@ -54,7 +55,7 @@ class EndermanSlayerFeatures { val entity = event.entity if (entity in endermenWithBeacons || entity in flyingBeacons) return - if (entity is EntityEnderman && showBeacon() && hasBeaconInHand(entity) && canSee(LocationUtils.playerEyeLocation(), entity.getLorenzVec())) { + if (entity is EntityEnderman && showBeacon() && hasBeaconInHand(entity) && entity.canBeSeen(15.0)) { endermenWithBeacons.add(entity) logger.log("Added enderman with beacon at ${entity.getLorenzVec()}") } @@ -62,7 +63,7 @@ class EndermanSlayerFeatures { if (entity is EntityArmorStand) { if (showBeacon()) { val stack = entity.inventory[4] ?: return - if (stack.name == "Beacon" && canSee(LocationUtils.playerEyeLocation(), entity.getLorenzVec())) { + if (stack.name == "Beacon" && entity.canBeSeen(15.0)) { flyingBeacons = flyingBeacons.editCopy { add(entity) } @@ -82,7 +83,7 @@ class EndermanSlayerFeatures { private fun hasBeaconInHand(enderman: EntityEnderman) = enderman.getBlockInHand()?.block == Blocks.beacon - private fun canSee(a: LorenzVec, b: LorenzVec) = LocationUtils.canSee(a, b) || a.distance(b) < 15 + private fun canSee(b: LorenzVec) = b.canBeSeen(15.0) private fun showBeacon() = beaconConfig.highlightBeacon || beaconConfig.showWarning || beaconConfig.showLine @@ -227,4 +228,4 @@ class EndermanSlayerFeatures { event.move(3, "slayer.endermanBeaconConfig.lineWidth", "slayer.endermen.endermanBeaconConfig.lineWidth") event.move(3, "slayer.endermanHighlightNukekebi", "slayer.endermen.highlightNukekebi") } -}
\ No newline at end of file +} |
