Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/main/kotlin/com/lambda/config/groups/Targeting.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import net.minecraft.client.network.ClientPlayerEntity
import net.minecraft.client.network.OtherClientPlayerEntity
import net.minecraft.client.toast.SystemToast.hide
import net.minecraft.entity.LivingEntity
import net.minecraft.entity.PlayerLikeEntity
import net.minecraft.entity.player.PlayerEntity
import java.util.*

/**
Expand Down Expand Up @@ -103,6 +105,11 @@ abstract class Targeting(
*/
val priority by c.setting("${prefix}Priority", Priority.Distance, visibility = visibility).group(*baseGroup).index()

/**
* Whether to target named entities (e.g., players with custom names). Configurable with default set to `true`.
*/
val targetNamed by c.setting("${prefix}Target Named Entities", false, visibility = visibility).group(*baseGroup).index()

/**
* Validates whether a given entity is targetable for combat based on the field of view limit and other settings.
*
Expand All @@ -114,6 +121,7 @@ abstract class Targeting(
if (fov < 180 && player.rotation dist player.eyePos.rotationTo(entity.pos) > fov) return false
if (entity.uuid in illegalTargets) return false
if (entity.isDead) return false
if (entity.hasCustomName() && entity !is PlayerLikeEntity && !targetNamed) return false
return super.validate(player, entity)
}

Expand Down