Skip to content

Commit 0130e72

Browse files
committed
use the entity selection settings group in nametags
1 parent 3557e6a commit 0130e72

File tree

1 file changed

+7
-9
lines changed
  • src/main/kotlin/com/lambda/module/modules/render

1 file changed

+7
-9
lines changed

src/main/kotlin/com/lambda/module/modules/render/Nametags.kt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
package com.lambda.module.modules.render
1919

20-
import com.lambda.Lambda.mc
2120
import com.lambda.config.applyEdits
21+
import com.lambda.config.groups.EntitySelectionSettings
2222
import com.lambda.config.groups.ScreenTextSettings
2323
import com.lambda.friend.FriendManager.isFriend
2424
import com.lambda.graphics.mc.RenderBuilder
@@ -28,8 +28,6 @@ import com.lambda.graphics.text.FontHandler.getDefaultFont
2828
import com.lambda.graphics.util.DynamicAABB.Companion.interpolatedBox
2929
import com.lambda.module.Module
3030
import com.lambda.module.tag.ModuleTag
31-
import com.lambda.util.EntityUtils
32-
import com.lambda.util.EntityUtils.entityGroup
3331
import com.lambda.util.NamedEnum
3432
import com.lambda.util.extension.fullHealth
3533
import com.lambda.util.extension.maxFullHealth
@@ -56,6 +54,7 @@ object Nametags : Module(
5654
) {
5755
private enum class Group(override val displayName: String) : NamedEnum {
5856
General("General"),
57+
Entities("Entities"),
5958
Background("Background"),
6059
Text("Text")
6160
}
@@ -65,14 +64,9 @@ object Nametags : Module(
6564
Other("Other")
6665
}
6766

68-
private val entities by setting("Entities", setOf(EntityUtils.EntityGroup.Player), EntityUtils.EntityGroup.entries).group(Group.General)
6967
private val itemScale by setting("Item Scale", 3f, 0.4f..5f, 0.01f).group(Group.General)
7068
private val yOffset by setting("Y Offset", 0.2, 0.0..1.0, 0.01).group(Group.General)
71-
private val background by setting("Background", true).group(Group.Background)
72-
private val backgroundColor by setting("Background Color", Color(0, 0, 0, 60)) { background }.group(Group.Background)
73-
private val backgroundSize by setting("Background Size", 1.0f, 1.0f..2.0f, 0.01f) { background }.group(Group.Background)
7469
private val spacing by setting("Spacing", 0, 0..10, 1).group(Group.General)
75-
private val self by setting("Self", false).group(Group.General)
7670
private val health by setting("Health", true).group(Group.General)
7771
private val ping by setting("Ping", true).group(Group.General)
7872
private val gear by setting("Gear", true).group(Group.General)
@@ -82,6 +76,10 @@ object Nametags : Module(
8276
private val itemNameScale by setting("Item Name Scale", 0.7f, 0.1f..1.0f, 0.01f) { itemName }.group(Group.General)
8377
private val itemCount by setting("Item Count", true).group(Group.General)
8478
private val durabilityMode by setting("Durability Mode", DurabilityMode.Text) { gear }.group(Group.General)
79+
private val entitySelectionSettings = EntitySelectionSettings(c = this, baseGroup = arrayOf(Group.Entities))
80+
private val background by setting("Background", true).group(Group.Background)
81+
private val backgroundColor by setting("Background Color", Color(0, 0, 0, 60)) { background }.group(Group.Background)
82+
private val backgroundSize by setting("Background Size", 1.0f, 1.0f..2.0f, 0.01f) { background }.group(Group.Background)
8583
//ToDo: Implement
8684
// private val enchantments by setting("Enchantments", false) { gear }
8785

@@ -245,7 +243,7 @@ object Nametags : Module(
245243

246244
@JvmStatic
247245
fun shouldRenderNametag(entity: Entity) =
248-
entity.entityGroup in entities && (self || entity !== mc.player) && (entity !is LivingEntity || entity.isAlive)
246+
entitySelectionSettings.isSelected(entity) && (entity !is LivingEntity || entity.isAlive)
249247

250248
private enum class DurabilityMode(val text: Boolean, val bar: Boolean) {
251249
None(false, false),

0 commit comments

Comments
 (0)