diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-04-15 20:28:54 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-04-15 20:28:54 +0200 |
commit | ebdeedb91341e2c111dfac6b73860abf04839f67 (patch) | |
tree | 06f89df64d8a554957779e8a2520bc8ebd020a7c /src/main/java/at | |
parent | 8e685fd9f76055b1f0d63341a3071620b3674ec3 (diff) | |
download | skyhanni-ebdeedb91341e2c111dfac6b73860abf04839f67.tar.gz skyhanni-ebdeedb91341e2c111dfac6b73860abf04839f67.tar.bz2 skyhanni-ebdeedb91341e2c111dfac6b73860abf04839f67.zip |
better positioning of the status text below the visitor name, and hiding the text entirely when more than 15 blocks way
Diffstat (limited to 'src/main/java/at')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt | 19 |
1 files changed, 11 insertions, 8 deletions
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<String, Int> = 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)), |