diff --git a/src/main/kotlin/com/lambda/config/groups/Targeting.kt b/src/main/kotlin/com/lambda/config/groups/Targeting.kt index 7cc483ff8..aa26101db 100644 --- a/src/main/kotlin/com/lambda/config/groups/Targeting.kt +++ b/src/main/kotlin/com/lambda/config/groups/Targeting.kt @@ -34,6 +34,8 @@ import net.minecraft.client.network.ClientPlayerEntity import net.minecraft.client.network.OtherClientPlayerEntity import net.minecraft.entity.Entity import net.minecraft.entity.LivingEntity +import net.minecraft.entity.PlayerLikeEntity +import net.minecraft.entity.player.PlayerEntity import java.util.* /** @@ -101,6 +103,11 @@ abstract class Targeting( */ val priority by c.setting("${prefix}Priority", Priority.Distance, visibility = visibility).group(*baseGroup).index() + /** + * Whether to target named entities that are not players. 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. * @@ -111,7 +118,9 @@ abstract class Targeting( override fun validate(player: ClientPlayerEntity, entity: Entity): Boolean { if (fov < 180 && player.rotation dist player.eyePos.rotationTo(entity.pos) > fov) return false if (entity.uuid in illegalTargets) return false - if ((entity as? LivingEntity)?.isDead == true) return false + if (entity.isDead) return false + if (entity.hasCustomName() && entity !is PlayerLikeEntity && !targetNamed) return false + if ((entity as? LivingEntity)?.isDead == true) return false return super.validate(player, entity) }