@@ -3,6 +3,7 @@ package com.lambda.client.module.modules.render
3
3
import com.lambda.client.commons.extension.ceilToInt
4
4
import com.lambda.client.commons.extension.floorToInt
5
5
import com.lambda.client.commons.utils.MathUtils
6
+ import com.lambda.client.event.SafeClientEvent
6
7
import com.lambda.client.event.events.RenderOverlayEvent
7
8
import com.lambda.client.event.listener.listener
8
9
import com.lambda.client.module.Category
@@ -11,6 +12,7 @@ import com.lambda.client.module.modules.client.ClickGUI
11
12
import com.lambda.client.module.modules.client.CustomFont
12
13
import com.lambda.client.module.modules.client.GuiColors
13
14
import com.lambda.client.module.modules.client.Hud
15
+ import com.lambda.client.module.modules.combat.TotemPopCounter
14
16
import com.lambda.client.module.modules.misc.LogoutLogger
15
17
import com.lambda.client.util.EnchantmentUtils
16
18
import com.lambda.client.util.EntityUtils
@@ -60,7 +62,6 @@ object Nametags : Module(
60
62
private val invisible by setting(" Invisible" , true , { page == Page .ENTITY_TYPE })
61
63
private val range by setting(" Range" , 64 , 0 .. 256 , 4 , { page == Page .ENTITY_TYPE })
62
64
63
- /* Content */
64
65
private val line1left = setting(" Line 1 Left" , ContentType .NONE , { page == Page .CONTENT })
65
66
private val line1center = setting(" Line 1 Center" , ContentType .NONE , { page == Page .CONTENT })
66
67
private val line1right = setting(" Line 1 Right" , ContentType .NONE , { page == Page .CONTENT })
@@ -95,7 +96,7 @@ object Nametags : Module(
95
96
}
96
97
97
98
private enum class ContentType {
98
- NONE , NAME , TYPE , TOTAL_HP , HP , ABSORPTION , PING , DISTANCE , ENTITY_ID
99
+ NONE , NAME , TYPE , TOTAL_HP , HP , ABSORPTION , PING , DISTANCE , ENTITY_ID , TOTEM_POP_COUNT
99
100
}
100
101
101
102
private val pingColorGradient = ColorGradient (
@@ -114,7 +115,7 @@ object Nametags : Module(
114
115
115
116
private val line1Settings = arrayOf(line1left, line1center, line1right)
116
117
private val line2Settings = arrayOf(line2left, line2center, line2right)
117
- val entityMap = TreeMap <Entity , TextComponent >(compareByDescending { mc.player.getPositionEyes(1f ).distanceTo(it.getPositionEyes(1f )) })
118
+ private val entityMap = TreeMap <Entity , TextComponent >(compareByDescending { mc.player.getPositionEyes(1f ).distanceTo(it.getPositionEyes(1f )) })
118
119
private val itemMap = TreeSet <ItemGroup >(compareByDescending { mc.player.getPositionEyes(1f ).distanceTo(it.getCenter(1f )) })
119
120
120
121
private var updateTick = 0
@@ -403,7 +404,7 @@ object Nametags : Module(
403
404
}
404
405
}
405
406
406
- private fun getContent (contentType : ContentType , entity : Entity ) = when (contentType) {
407
+ private fun SafeClientEvent. getContent (contentType : ContentType , entity : Entity ) = when (contentType) {
407
408
ContentType .NONE -> {
408
409
null
409
410
}
@@ -415,44 +416,56 @@ object Nametags : Module(
415
416
TextComponent .TextElement (getEntityType(entity), GuiColors .text)
416
417
}
417
418
ContentType .TOTAL_HP -> {
418
- if (entity !is EntityLivingBase ) {
419
- null
420
- } else {
419
+ if (entity is EntityLivingBase ) {
421
420
val totalHp = MathUtils .round(entity.health + entity.absorptionAmount, 1 ).toString()
422
421
TextComponent .TextElement (totalHp, getHpColor(entity))
422
+ } else {
423
+ null
423
424
}
424
425
}
425
426
ContentType .HP -> {
426
- if (entity !is EntityLivingBase ) {
427
- null
428
- } else {
427
+ if (entity is EntityLivingBase ) {
429
428
val hp = MathUtils .round(entity.health, 1 ).toString()
430
429
TextComponent .TextElement (hp, getHpColor(entity))
430
+ } else {
431
+ null
431
432
}
432
433
}
433
434
ContentType .ABSORPTION -> {
434
- if (entity !is EntityLivingBase || entity.absorptionAmount == 0f ) {
435
- null
436
- } else {
435
+ if (entity is EntityLivingBase && entity.absorptionAmount != 0f ) {
437
436
val absorption = MathUtils .round(entity.absorptionAmount, 1 ).toString()
438
437
TextComponent .TextElement (absorption, ColorHolder (234 , 204 , 32 , GuiColors .text.a))
438
+ } else {
439
+ null
439
440
}
440
441
}
441
442
ContentType .PING -> {
442
- if (entity !is EntityOtherPlayerMP ) {
443
- null
443
+ if (entity is EntityOtherPlayerMP ) {
444
+ connection.getPlayerInfo(entity.uniqueID)?.responseTime?.let {
445
+ TextComponent .TextElement (" ${it} ms" , pingColorGradient.get(it.toFloat()).apply { a = GuiColors .text.a })
446
+ }
444
447
} else {
445
- val ping = mc.connection?.getPlayerInfo(entity.uniqueID)?.responseTime ? : 0
446
- TextComponent .TextElement (" ${ping} ms" , pingColorGradient.get(ping.toFloat()).apply { a = GuiColors .text.a })
448
+ null
447
449
}
448
450
}
449
451
ContentType .DISTANCE -> {
450
- val dist = MathUtils .round(mc. player.getDistance(entity), 1 ).toString()
452
+ val dist = MathUtils .round(player.getDistance(entity), 1 ).toString()
451
453
TextComponent .TextElement (" ${dist} m" , GuiColors .text)
452
454
}
453
455
ContentType .ENTITY_ID -> {
454
456
TextComponent .TextElement (" ID: ${entity.entityId} " , GuiColors .text)
455
457
}
458
+ ContentType .TOTEM_POP_COUNT -> {
459
+ // Note: The totem pop counting functionality is embedded in the TotemPopCounter module,
460
+ // hence, it needs to be active in order for this to work.
461
+ if (entity is EntityOtherPlayerMP ) {
462
+ if (TotemPopCounter .isDisabled) TotemPopCounter .enable()
463
+ val count = TotemPopCounter .popCountMap.getOrDefault(entity, 0 )
464
+ TextComponent .TextElement (" PT: $count " , GuiColors .text)
465
+ } else {
466
+ null
467
+ }
468
+ }
456
469
}
457
470
458
471
private fun getEntityType (entity : Entity ) = entity.javaClass.simpleName.replace(" Entity" , " " )
0 commit comments