diff --git a/src/main/kotlin/com/lambda/config/groups/Targeting.kt b/src/main/kotlin/com/lambda/config/groups/Targeting.kt index 7163303e8..197904a44 100644 --- a/src/main/kotlin/com/lambda/config/groups/Targeting.kt +++ b/src/main/kotlin/com/lambda/config/groups/Targeting.kt @@ -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.* /** @@ -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. * @@ -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) }