From ebdeedb91341e2c111dfac6b73860abf04839f67 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 15 Apr 2023 20:28:54 +0200 Subject: better positioning of the status text below the visitor name, and hiding the text entirely when more than 15 blocks way --- .../features/garden/visitor/GardenVisitorFeatures.kt | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt index 134f2e4b7..f722d2671 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt @@ -235,10 +235,11 @@ class GardenVisitorFeatures { if (config.visitorHighlightStatus != 1 && config.visitorHighlightStatus != 2) return for (visitor in visitors.values) { - visitor.getEntity()?.let { - val location = it.getLorenzVec().add(0.0, 2.2, 0.0) - val text = visitor.status.displayName - event.drawString(location, text) + visitor.getNameTagEntity()?.getLorenzVec()?.let { + if (it.distance(LocationUtils.playerLocation()) < 15) { + val text = visitor.status.displayName + event.drawString(it.add(0.0, 2.23, 0.0), text) + } } } } @@ -383,7 +384,7 @@ class GardenVisitorFeatures { for (name in visitorsInTab) { if (!visitors.containsKey(name)) { visitors[name] = Visitor(name, status = VisitorStatus.NEW) - LorenzUtils.debug("new visitor '$name'") +// LorenzUtils.debug("new visitor '$name'") if (config.visitorNotificationTitle) { TitleUtils.sendTitle("§eNew Visitor", 5_000) } @@ -461,8 +462,6 @@ class GardenVisitorFeatures { // LorenzUtils.debug(message) } - private fun Visitor.getEntity() = Minecraft.getMinecraft().theWorld.getEntityByID(entityId) - private fun findEntity(nameTag: EntityArmorStand, visitor: Visitor) { for (entity in Minecraft.getMinecraft().theWorld.loadedEntityList) { if (entity is EntityArmorStand) continue @@ -556,7 +555,11 @@ class GardenVisitorFeatures { var status: VisitorStatus, var inSacks: Boolean = false, val items: MutableMap = mutableMapOf(), - ) + ) { + fun getEntity() = Minecraft.getMinecraft().theWorld.getEntityByID(entityId) + + fun getNameTagEntity() = Minecraft.getMinecraft().theWorld.getEntityByID(nameTagEntityId) + } enum class VisitorStatus(val displayName: String, val color: Int) { NEW("§e§lNew", LorenzColor.YELLOW.toColor().withAlpha(100)), -- cgit