From 84d060a961e892c713eed16dd898c9f7f10fdd40 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 22 Jun 2023 18:21:02 +0200 Subject: code cleanup --- .../java/at/hannibal2/skyhanni/features/rift/CruxWarnings.kt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/CruxWarnings.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/CruxWarnings.kt index 295104caa..39834a6bd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/CruxWarnings.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/CruxWarnings.kt @@ -21,12 +21,9 @@ class CruxWarnings { private fun checkForShy() { try { if (!(RiftAPI.inRift() || !SkyHanniMod.feature.rift.crux.shyWarning)) return - val world = Minecraft.getMinecraft().theWorld ?: return - val loadedEntityList = world.getLoadedEntityList() ?: return - for (entity in loadedEntityList) { - if (entity.name in shyNames && entity.distanceToPlayer() < 8) { - TitleUtils.sendTitle("§eLook away!", 250) - } + val list = Minecraft.getMinecraft().theWorld?.getLoadedEntityList() ?: return + if (list.any { it.name in shyNames && it.distanceToPlayer() < 8 }) { + TitleUtils.sendTitle("§eLook away!", 250) } } catch (e: Throwable) { CopyErrorCommand.logError(e, "Check for Shy failed") -- cgit